diff --git a/src/main/java/uk/gov/dvsa/enums/CertificateTemplates.java b/src/main/java/uk/gov/dvsa/enums/CertificateTemplates.java
index de00f9f3..1066985e 100644
--- a/src/main/java/uk/gov/dvsa/enums/CertificateTemplates.java
+++ b/src/main/java/uk/gov/dvsa/enums/CertificateTemplates.java
@@ -42,7 +42,11 @@ public enum CertificateTemplates {
IVA30("CommercialVehicles/IVA30"),
- MSVA30("CommercialVehicles/MSVA30");
+ MSVA30("CommercialVehicles/MSVA30"),
+
+ VTG12("CommercialVehicles/Abandoned"),
+
+ VTP12("CommercialVehicles/Abandoned");
private final String certificateTemplateName;
diff --git a/src/main/java/uk/gov/dvsa/enums/CertificateTypes.java b/src/main/java/uk/gov/dvsa/enums/CertificateTypes.java
index 242193d3..274d62a5 100644
--- a/src/main/java/uk/gov/dvsa/enums/CertificateTypes.java
+++ b/src/main/java/uk/gov/dvsa/enums/CertificateTypes.java
@@ -55,7 +55,9 @@ public enum CertificateTypes {
IVA30("CVS/IVA30"),
- MSVA30("CVS/MSVA30");
+ MSVA30("CVS/MSVA30"),
+ VTG12("CVS/VTG12"),
+ VTP12("CVS/VTP12");
private final String certificateType;
diff --git a/src/main/java/uk/gov/dvsa/enums/DocumentsConfig.java b/src/main/java/uk/gov/dvsa/enums/DocumentsConfig.java
index 03e44fc5..e1b071f3 100644
--- a/src/main/java/uk/gov/dvsa/enums/DocumentsConfig.java
+++ b/src/main/java/uk/gov/dvsa/enums/DocumentsConfig.java
@@ -108,7 +108,13 @@ public enum DocumentsConfig {
new String[]{CertificateTemplates.IVA30.getCertificateTemplateName()}),
MSVA30(CertificateTypes.MSVA30.getCertificateType(), MSVA30.class,
- new String[]{CertificateTemplates.MSVA30.getCertificateTemplateName()});
+ new String[]{CertificateTemplates.MSVA30.getCertificateTemplateName()}),
+
+ VTG12(CertificateTypes.VTG12.getCertificateType(), VTG12.class,
+ new String[]{CertificateTemplates.VTG12.getCertificateTemplateName()}),
+
+ VTP12(CertificateTypes.VTP12.getCertificateType(), VTP12.class,
+ new String[]{CertificateTemplates.VTP12.getCertificateTemplateName()});
private final String documentName;
diff --git a/src/main/java/uk/gov/dvsa/model/cvs/AbandonedCertificate.java b/src/main/java/uk/gov/dvsa/model/cvs/AbandonedCertificate.java
new file mode 100644
index 00000000..e00cd43f
--- /dev/null
+++ b/src/main/java/uk/gov/dvsa/model/cvs/AbandonedCertificate.java
@@ -0,0 +1,51 @@
+package uk.gov.dvsa.model.cvs;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import uk.gov.dvsa.model.Document;
+import uk.gov.dvsa.model.cvs.certificateData.AbandonedData;
+import uk.gov.dvsa.model.cvs.certificateData.Signature;
+
+public abstract class AbandonedCertificate extends Document {
+ protected String regulationText;
+ protected String vehicleTypeText;
+ protected String titleTextIncludingRollingHeaders;
+ protected String sectionTextRef;
+ protected String formNumber;
+ @JsonProperty("ABANDONED_DATA")
+ private AbandonedData data;
+ @JsonProperty("Signature")
+ private Signature signature;
+
+ public String getRegulationText() { return this.regulationText; }
+
+ public String getVehicleTypeText() { return this.vehicleTypeText; }
+
+ public String getTitleTextIncludingRollingHeaders() {
+ return this.titleTextIncludingRollingHeaders;
+ }
+
+ public String getSectionTextRef() { return this.sectionTextRef; }
+
+ public String getFormNumber() { return formNumber; }
+
+ public AbandonedData getData() {
+ return data;
+ }
+
+ public Signature getSignature() {
+ return signature;
+ }
+
+ public Document setData(AbandonedData data) {
+ this.data = data;
+ return this;
+ }
+
+ public void setSignature(Signature signature) {
+ this.signature = signature;
+ }
+
+ public String getDocumentType() {
+ return this.getDocumentName().split("/")[1];
+ }
+}
diff --git a/src/main/java/uk/gov/dvsa/model/cvs/VTG12.java b/src/main/java/uk/gov/dvsa/model/cvs/VTG12.java
new file mode 100644
index 00000000..a8ff2b96
--- /dev/null
+++ b/src/main/java/uk/gov/dvsa/model/cvs/VTG12.java
@@ -0,0 +1,13 @@
+package uk.gov.dvsa.model.cvs;
+
+public class VTG12 extends AbandonedCertificate {
+
+ public VTG12() {
+ super();
+ super.regulationText = "Regulations 7 and 8 of the Goods Vehicles (Plating and Testing) Regulations 1988 as Amended";
+ super.vehicleTypeText = "In respect of the goods vehicle with registration number / chassis serial number / trailer identification mark :";
+ super.titleTextIncludingRollingHeaders = "Goods Vehicle for Examination";
+ super.formNumber = "0440";
+ super.sectionTextRef = "49 and 51";
+ }
+}
diff --git a/src/main/java/uk/gov/dvsa/model/cvs/VTP12.java b/src/main/java/uk/gov/dvsa/model/cvs/VTP12.java
new file mode 100644
index 00000000..9ad313b3
--- /dev/null
+++ b/src/main/java/uk/gov/dvsa/model/cvs/VTP12.java
@@ -0,0 +1,13 @@
+package uk.gov.dvsa.model.cvs;
+
+public class VTP12 extends AbandonedCertificate {
+
+ public VTP12() {
+ super();
+ super.regulationText = "Regulation 13 of the Motor Vehicles (Tests) Regulations 1981 as amended";
+ super.vehicleTypeText = "In respect of the public service vehicle with registration number / chassis serial number :";
+ super.titleTextIncludingRollingHeaders = "Public Service Vehicle for Examination";
+ super.formNumber = "0453";
+ super.sectionTextRef = "45";
+ }
+}
diff --git a/src/main/java/uk/gov/dvsa/model/cvs/certificateData/AbandonedData.java b/src/main/java/uk/gov/dvsa/model/cvs/certificateData/AbandonedData.java
new file mode 100644
index 00000000..e9ddf59c
--- /dev/null
+++ b/src/main/java/uk/gov/dvsa/model/cvs/certificateData/AbandonedData.java
@@ -0,0 +1,68 @@
+package uk.gov.dvsa.model.cvs.certificateData;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class AbandonedData {
+ @JsonProperty("RegistrationNumber")
+ private String registrationNumber;
+ @JsonProperty("ReasonsForRefusal")
+ private String[] reasonsForRefusal;
+ @JsonProperty("TestStationName")
+ private String testStationName;
+ @JsonProperty("TestStationPNumber")
+ private String testStationPNumber;
+ @JsonProperty("IssuersName")
+ private String issuersName;
+ @JsonProperty("AdditionalComments")
+ private String additionalComments;
+ @JsonProperty("DateOfTheTest")
+ private String dateOfTheTest;
+
+ public AbandonedData() {
+ }
+
+ public AbandonedData(String registrationNumber,
+ String[] reasonsForRefusal,
+ String dateOfTheTest,
+ String testStationName,
+ String testStationPNumber,
+ String issuersName,
+ String additionalComments) {
+ this.registrationNumber = registrationNumber;
+ this.reasonsForRefusal = reasonsForRefusal;
+ this.dateOfTheTest = dateOfTheTest;
+ this.testStationName = testStationName;
+ this.testStationPNumber = testStationPNumber;
+ this.issuersName = issuersName;
+ this.additionalComments = additionalComments;
+ }
+
+ public String[] getRegistrationNumber() {
+ return registrationNumber.split("");
+ }
+
+ public String[] getReasonsForRefusal() {
+ return reasonsForRefusal;
+ }
+
+ public String getTestStationName() {
+ return testStationName;
+ }
+
+ public String getTestStationPNumber() {
+ return testStationPNumber;
+ }
+
+ public String getIssuersName() {
+ return issuersName;
+ }
+
+ public String getAdditionalComments() {
+ return additionalComments;
+ }
+
+ public String getDateOfTheTest() {
+ return dateOfTheTest;
+ }
+
+}
diff --git a/src/main/resources/assets/stylesheets/Abandoned.hbs b/src/main/resources/assets/stylesheets/Abandoned.hbs
new file mode 100644
index 00000000..25a0578a
--- /dev/null
+++ b/src/main/resources/assets/stylesheets/Abandoned.hbs
@@ -0,0 +1,212 @@
+@font-face {
+ font-family: nta;
+ font-weight: 100;
+ src: url({{root}}/assets/fonts/NTA-Light.ttf);
+ -fs-pdf-font-embed: embed;
+ -fs-pdf-font-encoding: Identity-H
+}
+
+@font-face {
+ font-family: nta-bold;
+ font-weight: 700;
+ src: url({{root}}/assets/fonts/NTA-Bold.ttf);
+ -fs-pdf-font-embed: embed;
+ -fs-pdf-font-encoding: Identity-H
+}
+
+@font-face {
+ font-family: gds-transport;
+ font-weight: 400;
+ src: url({{root}}/assets/fonts/GDSTransportWebsite.ttf);
+ -fs-pdf-font-embed: embed;
+ -fs-pdf-font-encoding: Identity-H
+}
+
+body,
+html {
+ font-family: nta;
+ font-weight: 100;
+ line-height: 1;
+ margin: 0;
+ -fs-page-sequence: start;
+ page-break-before: always
+}
+
+.header__crest-img {
+ min-width: 180px;
+ min-height: 112px;
+ width: 180px;
+ height: 112px;
+ float: left;
+}
+
+.header {
+ border-bottom: 4px solid black;
+ padding-bottom: 24px;
+}
+
+.title-text {
+ padding-bottom: 6px;
+ margin-right: 1.8cm;
+ text-align: right;
+ margin-left: 210px;
+ font-weight: bold;
+ font-size: 21px;
+ line-height: 24px;
+}
+
+.regulation-text {
+ margin-left: 290px;
+ text-align: right;
+}
+
+.vin-wrapper {
+ padding: 10px 0 10px 0;
+}
+
+.vin-text {
+ font-size: 1.0em;
+ font-weight: bold;
+ letter-spacing: 1000px;
+ text-transform: uppercase;
+ padding: 0 5px 0 5px;
+}
+
+#sectionText {
+ padding-bottom: 24px;
+}
+
+.standard-text {
+ padding-top: 4px;
+ padding-bottom: 4px;
+ margin-right: 2cm;
+}
+
+/* pdf Page styling */
+@page {
+ size: A4 portrait;
+ margin: 3cm 1.5cm 50px 1cm;
+ @bottom-left {
+ content: element(footer-left);
+ }
+ @bottom-right {
+ content: element(footer-right);
+ }
+ @top-left {
+ content: element(running-header);
+ }
+}
+@page :first {
+ margin: 1cm 1.5cm 50px 1cm;
+ @top-left {
+ content: normal;
+ }
+}
+
+.footer-left {
+ font-size: 1.25em;
+ position: running(footer-left);
+}
+
+.footer-right {
+ text-align: right;
+ position: running(footer-right);
+}
+
+/* the border is need to take up space so the text to the
+ right does not have the 2nd line move all the way back left */
+.header-left {
+ float: left;
+ border: 1px solid transparent;
+ width: 300px;
+ padding-top: 16px;
+ font-weight: bold;
+}
+
+.running-header {
+ position: running(running-header);
+ border-bottom: 4px solid gray;
+}
+
+.back-page {
+ page-break-before: always;
+}
+
+.blue-text {
+ color: blue;
+}
+
+.additional-comments-header {
+ margin-bottom: 20px;
+}
+
+.additional-comments-box {
+ border: 1px solid black;
+ padding: 20px;
+}
+
+.data-protection-box {
+ background: #d2d2d2;
+ padding: 5px;
+ margin-top: 10px;
+}
+
+.data-protection-text {
+ padding-bottom: 10px;
+}
+
+.bold-text {
+ font-weight: bold;
+}
+
+.table {
+ width: 100%;
+ margin-bottom: 1em;
+ table-layout: auto;
+ margin-top: 30px;
+ border-collapse: separate;
+ border-spacing: 5pt;
+ page-break-inside: avoid;
+}
+
+.table-row-cell {
+ border-style: solid;
+ border-width: 1px;
+ vertical-align: middle;
+ padding: 6px 0 6px 0;
+ margin: 6px 0 6px 0;
+}
+
+.table-row-left {
+ width: 25%;
+ border: none;
+}
+
+.table-row-right {
+ width: 75%;
+ border: 1px solid black;
+ padding-left: 5px;
+}
+
+.last-row-first-column {
+ width: 25%;
+ border: none;
+}
+
+.last-row-second-column {
+ width: 30%;
+ border: 1px solid black;
+ padding-left: 5px;
+}
+
+.last-row-third-column {
+ width: 15%;
+ border: none;
+ text-align: center;
+}
+
+.last-row-fourth-column {
+ width: 30%;
+ border: 1px solid black;
+ padding-left: 5px;
+}
diff --git a/src/main/resources/views/CommercialVehicles/Abandoned.hbs b/src/main/resources/views/CommercialVehicles/Abandoned.hbs
new file mode 100644
index 00000000..a7f4757c
--- /dev/null
+++ b/src/main/resources/views/CommercialVehicles/Abandoned.hbs
@@ -0,0 +1,129 @@
+
+
+
+ {{documentType}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{vehicleTypeText}}
+
+
+
+ {{#each data.registrationNumber}}
+
+ {{this}}
+
+ {{/each}}
+
+
+
+
+ having been submitted for an examination under Section {{sectionTextRef}} of the Road Traffic Act 1988, it is hereby notified that the examination did not proceed or could not be completed because of a failure to comply with those conditions of acceptance for examination recorded below.
+
+
+
+ Reason(s) for refusal to accept or complete examination:
+
+
+
+
+
+
+
+ {{#each data.reasonsForRefusal}}
+ - {{this}}
+ {{/each}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Signature: |
+
+
+ |
+
+
+ Print Name: |
+ {{data.issuersName}} |
+
+
+ Location: |
+ {{data.testStationName}} |
+
+
+ Location Number: |
+ {{data.testStationPNumber}} |
+ Date: |
+ {{data.dateOfTheTest}} |
+
+
+
+
+
Data Protection
+
+ We collect, use and store your personal data so that we can correctly issue your vehicle with a {{documentType}} failure notification.
+
+
+ We may share your personal data if we have a lawful reason. For example as part of a criminal investigation or to prevent fraud. Find out more at
+ www.gov.uk/dvsa/privacy.
+
+
+
+
+
+
diff --git a/src/test/java/htmlverification/framework/page_object/CertificatePageObject.java b/src/test/java/htmlverification/framework/page_object/CertificatePageObject.java
index 393a2b16..dcafba36 100644
--- a/src/test/java/htmlverification/framework/page_object/CertificatePageObject.java
+++ b/src/test/java/htmlverification/framework/page_object/CertificatePageObject.java
@@ -386,4 +386,80 @@ public String getAxle3FitmentCode() {
}
public String getAxle4FitmentCode() { return getElementById(AXLE4_FITMENT_CODE.getSelector()).text(); }
-}
+
+ public String getDocumentType() {
+ return getElementById(DOCUMENT_TYPE.getSelector()).text();
+ }
+
+ public String getRegulationText() {
+ return getElementById(REGULATION_TEXT.getSelector()).text();
+ }
+
+ public String getSpacedRegistrationNumber(Integer index) {
+ return getElementById(REGISTRATION_TEXT.getSelector()+index).text();
+ }
+
+ public String getFirstPageTitle() {
+ return getElementById(FIRST_PAGE_TITLE.getSelector()).text();
+ }
+
+ public String getFooterDocumentType() {
+ return getElementById(FOOTER_DOCUMENT_TYPE.getSelector()).text();
+ }
+
+ public String getFooterTestNumber() {
+ return getElementById(FOOTER_TEST_NUMBER.getSelector()).text();
+ }
+
+ public String getFooterDatePopulated() {
+ return getElementById(FOOTER_DATE_POPULATED.getSelector()).text();
+ }
+
+ public String getRunningHeaderLeft() {
+ return getElement("." + RUNNING_HEADER_LEFT.getSelector()).text();
+ }
+
+ public String getRunningHeaderRight() {
+ return getElement("." + RUNNING_HEADER.getSelector()).getElementsByTag("span").text();
+ }
+
+ public String getVehicleTestType() {
+ return getElementById(VEHICLE_TYPE_TEXT.getSelector()).text();
+ }
+
+ public String getSanctionText() {
+ return getElementById(SECTION_TEXT.getSelector()).text();
+ }
+
+ public String getReasonsForAbandonment(Integer index) {
+ return getElementById(REASONS_FOR_ABANDONMENT.getSelector()+index).text();
+ }
+
+ public String getAdditionalComments() {
+ return getElementById(ADDITIONAL_COMMENTS.getSelector()).text();
+ }
+
+ public String getDataProtectionWithDocumentType() {
+ return getElementById(DATA_PROTECTION_WITH_DOCUMENT_TYPE.getSelector()).text();
+ }
+
+ public String getSignature() {
+ return getElementById(SIGNATURE.getSelector()).attr("src");
+ }
+
+ public String getPrintName() {
+ return getElementById(PRINT_NAME.getSelector()).text();
+ }
+
+ public String getLocation() {
+ return getElementById(LOCATION.getSelector()).text();
+ }
+
+ public String getLocationNumber() {
+ return getElementById(LOCATION_NUMBER.getSelector()).text();
+ }
+
+ public String getDateOfTest() {
+ return getElementById(DATE_OF_THE_TEST.getSelector()).text();
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/htmlverification/framework/page_object/CertificatePageSelector.java b/src/test/java/htmlverification/framework/page_object/CertificatePageSelector.java
index 686f8052..b507086f 100644
--- a/src/test/java/htmlverification/framework/page_object/CertificatePageSelector.java
+++ b/src/test/java/htmlverification/framework/page_object/CertificatePageSelector.java
@@ -119,7 +119,28 @@ public enum CertificatePageSelector {
AXLE1_FITMENT_CODE("axle1_fitmentCode"),
AXLE2_FITMENT_CODE("axle2_fitmentCode"),
AXLE3_FITMENT_CODE("axle3_fitmentCode"),
- AXLE4_FITMENT_CODE("axle4_fitmentCode");
+ AXLE4_FITMENT_CODE("axle4_fitmentCode"),
+ DOCUMENT_TYPE("documentType"),
+ REGISTRATION_TEXT("reg_"),
+ REGULATION_TEXT("regulationText"),
+ FIRST_PAGE_TITLE("firstPageTitle"),
+ FOOTER_DOCUMENT_TYPE("footerDocumentType"),
+ FOOTER_TEST_NUMBER("footerTestNumber"),
+ FOOTER_DATE_POPULATED("footerDatePopulated"),
+ RUNNING_HEADER_LEFT("header-left"),
+ RUNNING_HEADER("running-header"),
+ VEHICLE_TYPE_TEXT("vehicleTypeText"),
+ RUNNING_HEADER_TEXT("runningHeaderText"),
+ REASONS_FOR_ABANDONMENT("reasonsForAbandonment_"),
+ ADDITIONAL_COMMENTS("additionalComments"),
+ DATA_PROTECTION_WITH_DOCUMENT_TYPE("dataProtectionWithDocumentType"),
+ SIGNATURE("signature"),
+ PRINT_NAME("printName"),
+ LOCATION("location"),
+ LOCATION_NUMBER("locationNumber"),
+ DATE_OF_THE_TEST("dateOfTheTest"),
+ SECTION_TEXT("sectionText");
+
private final String selector;
diff --git a/src/test/java/htmlverification/service/CvsCertificateTestDataProvider.java b/src/test/java/htmlverification/service/CvsCertificateTestDataProvider.java
index 2b574341..6e3e095d 100644
--- a/src/test/java/htmlverification/service/CvsCertificateTestDataProvider.java
+++ b/src/test/java/htmlverification/service/CvsCertificateTestDataProvider.java
@@ -1180,6 +1180,59 @@ public static MSVA30 getMSVA30() {
return msva30;
}
+ public static VTG12 getVTG12() {
+ VTG12 vtg12 = new VTG12();
+ vtg12.setDocumentName(CertificateTypes.VTG12.getCertificateType());
+ String[] reasonsForRefusal = { "Reason 1 exists VTG12","Reason 2 exists VTG12" };
+ String additionalComments = "additional comments VTG12";
+
+ AbandonedData abandonedData = new AbandonedData(
+ "poiuytrewq01230109567891",
+ reasonsForRefusal,
+ "01.02.2024",
+ "fake location",
+ "fake12312312",
+ "fake tester",
+ additionalComments);
+
+ Signature signature = new Signature();
+ signature
+ .setImageData("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==")
+ .setImageType("png");
+
+ vtg12.setSignature(signature);
+
+ vtg12.setData(abandonedData);
+ return vtg12;
+ }
+
+ public static VTP12 getVTP12() {
+ VTP12 vtp12 = new VTP12();
+ vtp12.setDocumentName(CertificateTypes.VTP12.getCertificateType());
+ String[] reasonsForRefusal = { "Reason 1 exists VTP12","Reason 2 exists VTP12" };
+ String additionalComments = "additional comments VTP12";
+
+ AbandonedData abandonedData = new AbandonedData(
+ "poiuytrewq01230109567891",
+ reasonsForRefusal,
+ "01.02.2024",
+ "fake location",
+ "fake12312312",
+ "fake tester",
+ additionalComments);
+
+ Signature signature = new Signature();
+ signature
+ .setImageData("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==")
+ .setImageType("png");
+
+ vtp12.setSignature(signature);
+
+ vtp12.setData(abandonedData);
+ return vtp12;
+ }
+
+
public static VTG30 getVtg30HavingInvalidXMLCharacter() {
VTG30 document = getVtg30();
diff --git a/src/test/java/htmlverification/tests/AbandonedTest.java b/src/test/java/htmlverification/tests/AbandonedTest.java
new file mode 100644
index 00000000..32b3b116
--- /dev/null
+++ b/src/test/java/htmlverification/tests/AbandonedTest.java
@@ -0,0 +1,130 @@
+package htmlverification.tests;
+
+import htmlverification.framework.page_object.CertificatePageObject;
+import org.junit.Test;
+import uk.gov.dvsa.model.cvs.AbandonedCertificate;
+import uk.gov.dvsa.service.HtmlGenerator;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbandonedTest {
+
+ protected String DYNAMIC_TITLE_SECTION;
+ protected String REGULATION_TEXT;
+ protected String VEHICLE_TYPE_TEXT_LINE;
+ protected String FORM_NUMBER;
+ protected String SECTION_REF_TEXT;
+
+
+ protected HtmlGenerator htmlGenerator;
+ protected AbandonedCertificate testCertificate;
+ protected CertificatePageObject certificatePageObject;
+
+ @Test
+ public void verifyValuesSetByConstructor() {
+ assertEquals(REGULATION_TEXT, testCertificate.getRegulationText());
+ assertEquals(VEHICLE_TYPE_TEXT_LINE, testCertificate.getVehicleTypeText());
+ assertEquals(DYNAMIC_TITLE_SECTION, testCertificate.getTitleTextIncludingRollingHeaders());
+ assertEquals(FORM_NUMBER, testCertificate.getFormNumber());
+ assertEquals(SECTION_REF_TEXT, testCertificate.getSectionTextRef());
+ }
+
+ @Test
+ public void verifyDocumentType() {
+ assertEquals(testCertificate.getDocumentType(), certificatePageObject.getDocumentType());
+ }
+
+ @Test
+ public void verifyFirstPageTitle() {
+ String firstPageTitle = certificatePageObject.getFirstPageTitle();
+ assertEquals("Notification of Failure to Comply with the Conditions of Acceptance of a " +
+ testCertificate.getTitleTextIncludingRollingHeaders() + " (" + testCertificate.getDocumentType() + ")", firstPageTitle);
+ }
+
+ @Test
+ public void verifyRegulationText() {
+ assertEquals(testCertificate.getRegulationText(), certificatePageObject.getRegulationText());
+ }
+
+ @Test
+ public void verifyFooterDocumentType() {
+ assertEquals(testCertificate.getDocumentType(), certificatePageObject.getFooterDocumentType());
+ }
+
+ @Test
+ public void verifyFooterTestNumber() {
+ assertEquals("(DVSA" + testCertificate.getFormNumber() + ")", certificatePageObject.getFooterTestNumber());
+ }
+
+ @Test
+ public void verifyVehicleTypeText() {
+ assertEquals(testCertificate.getVehicleTypeText(), certificatePageObject.getVehicleTestType());
+ }
+
+ @Test
+ public void verifyRegistrationNumber() {
+ String[] reg = testCertificate.getData().getRegistrationNumber();
+ for (int i = 0; i < reg.length; i++) {
+ assertEquals(reg[i], certificatePageObject.getSpacedRegistrationNumber(i));
+ }
+ }
+
+ @Test
+ public void verifySectionText() {
+ assertTrue(certificatePageObject.getSanctionText().contains(testCertificate.getSectionTextRef()));
+ }
+
+ @Test
+ public void verifyRunningHeaderLeft() {
+ assertEquals(testCertificate.getDocumentType(), certificatePageObject.getRunningHeaderLeft());
+ }
+
+ @Test
+ public void verifyRunningHeaderRight() {
+ assertEquals("Notification of Failure to Comply with the Conditions of Acceptance of a " +
+ testCertificate.getTitleTextIncludingRollingHeaders(), certificatePageObject.getRunningHeaderRight());
+ }
+
+ @Test
+ public void verifyReasonsForAbandonment() {
+ String[] reasonsForAbandonment = testCertificate.getData().getReasonsForRefusal();
+ for (int i = 0; i < reasonsForAbandonment.length; i++) {
+ assertEquals(reasonsForAbandonment[i], certificatePageObject.getReasonsForAbandonment(i));
+ }
+ }
+
+ @Test
+ public void verifyAdditionalComments() {
+ assertEquals(testCertificate.getData().getAdditionalComments(), certificatePageObject.getAdditionalComments());
+ }
+
+ @Test
+ public void verifyDataProtectionWithDocumentType() {
+ assertEquals("We collect, use and store your personal data so that we can correctly issue your vehicle with a " + testCertificate.getDocumentType() + " failure notification." , certificatePageObject.getDataProtectionWithDocumentType());
+ }
+
+ @Test
+ public void verifySignature() {
+ assertEquals(testCertificate.getSignature().getFormattedImageData(), certificatePageObject.getSignature());
+ }
+
+ @Test
+ public void verifyPrintName() {
+ assertEquals(testCertificate.getData().getIssuersName(), certificatePageObject.getPrintName());
+ }
+
+ @Test
+ public void verifyLocation() {
+ assertEquals(testCertificate.getData().getTestStationName(), certificatePageObject.getLocation());
+ }
+
+ @Test
+ public void verifyLocationNumber() {
+ assertEquals(testCertificate.getData().getTestStationPNumber(), certificatePageObject.getLocationNumber());
+ }
+
+ @Test
+ public void verifyDateOfTheTest() {
+ assertEquals(testCertificate.getData().getDateOfTheTest(), certificatePageObject.getDateOfTest());
+ }
+}
diff --git a/src/test/java/htmlverification/tests/VTG12Test.java b/src/test/java/htmlverification/tests/VTG12Test.java
new file mode 100644
index 00000000..ce7fee80
--- /dev/null
+++ b/src/test/java/htmlverification/tests/VTG12Test.java
@@ -0,0 +1,27 @@
+package htmlverification.tests;
+
+import com.github.jknack.handlebars.Handlebars;
+import htmlverification.framework.page_object.CertificatePageObject;
+import htmlverification.service.CvsCertificateTestDataProvider;
+import org.junit.Before;
+import uk.gov.dvsa.service.HtmlGenerator;
+import java.io.IOException;
+
+public class VTG12Test extends AbandonedTest {
+
+ public VTG12Test() {
+ super.DYNAMIC_TITLE_SECTION = "Goods Vehicle for Examination";
+ super.REGULATION_TEXT = "Regulations 7 and 8 of the Goods Vehicles (Plating and Testing) Regulations 1988 as Amended";
+ super.VEHICLE_TYPE_TEXT_LINE = "In respect of the goods vehicle with registration number / chassis serial number / trailer identification mark :";
+ super.FORM_NUMBER = "0440";
+ super.SECTION_REF_TEXT = "49 and 51";
+ this.htmlGenerator = new HtmlGenerator(new Handlebars());
+ }
+
+ @Before
+ public void setup() throws IOException {
+ testCertificate = CvsCertificateTestDataProvider.getVTG12();
+ String certHtml = htmlGenerator.generate(testCertificate).get(0);
+ super.certificatePageObject = new CertificatePageObject(certHtml);
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/htmlverification/tests/VTP12Test.java b/src/test/java/htmlverification/tests/VTP12Test.java
new file mode 100644
index 00000000..b8eb9c91
--- /dev/null
+++ b/src/test/java/htmlverification/tests/VTP12Test.java
@@ -0,0 +1,27 @@
+package htmlverification.tests;
+
+import com.github.jknack.handlebars.Handlebars;
+import htmlverification.framework.page_object.CertificatePageObject;
+import htmlverification.service.CvsCertificateTestDataProvider;
+import org.junit.Before;
+import uk.gov.dvsa.service.HtmlGenerator;
+import java.io.IOException;
+
+public class VTP12Test extends AbandonedTest {
+
+ public VTP12Test() {
+ super.DYNAMIC_TITLE_SECTION = "Public Service Vehicle for Examination";
+ super.REGULATION_TEXT = "Regulation 13 of the Motor Vehicles (Tests) Regulations 1981 as amended";
+ super.VEHICLE_TYPE_TEXT_LINE = "In respect of the public service vehicle with registration number / chassis serial number :";
+ super.FORM_NUMBER = "0453";
+ super.SECTION_REF_TEXT = "45";
+ this.htmlGenerator = new HtmlGenerator(new Handlebars());
+ }
+
+ @Before
+ public void setup() throws IOException {
+ testCertificate = CvsCertificateTestDataProvider.getVTP12();
+ String certHtml = htmlGenerator.generate(testCertificate).get(0);
+ super.certificatePageObject = new CertificatePageObject(certHtml);
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/pdfverification/tests/AbandonedTests.java b/src/test/java/pdfverification/tests/AbandonedTests.java
new file mode 100644
index 00000000..28fb42c9
--- /dev/null
+++ b/src/test/java/pdfverification/tests/AbandonedTests.java
@@ -0,0 +1,125 @@
+package pdfverification.tests;
+
+import com.github.jknack.handlebars.Handlebars;
+import com.itextpdf.text.pdf.PdfReader;
+import org.junit.Before;
+import org.junit.Test;
+import org.xhtmlrenderer.pdf.ITextRenderer;
+import pdfverification.service.PDFParser;
+import uk.gov.dvsa.model.cvs.AbandonedCertificate;
+import uk.gov.dvsa.service.HtmlGenerator;
+import uk.gov.dvsa.service.PDFGenerationService;
+import java.io.IOException;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbandonedTests {
+ protected HtmlGenerator htmlGenerator;
+ protected PDFGenerationService pdfGenerationService;
+ protected AbandonedCertificate testCertificate;
+ protected PDFParser pdfParser;
+ protected PdfReader pdfReader;
+ protected byte[] pdfData;
+
+ protected static String DYNAMIC_TITLE_SECTION;
+ protected static String REGULATION_LINE1;
+ protected static String REGULATION_LINE2;
+ protected static String VEHICLE_TYPE_TEXT_LINE1;
+ protected static String VEHICLE_TYPE_TEXT_LINE2;
+ protected static String VIN;
+ protected static String REASONS_FOR_REFUSAL_LINE1;
+ protected static String REASONS_FOR_REFUSAL_LINE2;
+ protected static String ROLLING_FOOTER_LEFT;
+ protected static String ADDITIONAL_COMMENTS;
+ protected static String ROLLING_HEADER_LEFT;
+ protected static String ROLLING_HEADER_RIGHT;
+ protected static String PRINT_NAME;
+ protected static String LOCATION;
+ protected static String LOCATION_NUMBER;
+ protected static String DATE_OF_THE_TEST;
+ protected static String SECTION_TEXT;
+
+ public AbandonedTests() {
+ this.htmlGenerator = new HtmlGenerator(new Handlebars());
+ this.pdfParser = new PDFParser();
+ this.pdfGenerationService = new PDFGenerationService(new ITextRenderer());
+ }
+
+ @Before
+ public void setup() throws Exception {
+ pdfData = pdfGenerationService.generate(htmlGenerator.generate(testCertificate));
+ pdfReader = pdfParser.readPdf(pdfData);
+ }
+
+ @Test
+ public void verifyTitle() throws IOException {
+ assertTrue(pdfParser.getRawText(pdfReader, 1).contains(DYNAMIC_TITLE_SECTION));
+ }
+
+ @Test
+ public void verifyRegulationText() throws IOException {
+ assertTrue(pdfParser.getRawText(pdfReader, 1).contains(REGULATION_LINE1));
+ assertTrue(pdfParser.getRawText(pdfReader, 1).contains(REGULATION_LINE2));
+ }
+
+ @Test
+ public void verifyVehicleTypeText() throws IOException {
+ assertTrue(pdfParser.getRawText(pdfReader, 1).contains(VEHICLE_TYPE_TEXT_LINE1));
+ assertTrue(pdfParser.getRawText(pdfReader, 1).contains(VEHICLE_TYPE_TEXT_LINE2));
+ }
+
+ @Test
+ public void verifyVINText() throws IOException {
+ assertTrue(pdfParser.getRawText(pdfReader, 1).contains(VIN));
+ }
+
+ @Test
+ public void verifySectionText() throws IOException {
+ assertTrue(pdfParser.getRawText(pdfReader, 1).contains(SECTION_TEXT));
+ }
+
+ @Test
+ public void verifyReasonsForRefusal() throws IOException {
+ assertTrue(pdfParser.getRawText(pdfReader, 1).contains(REASONS_FOR_REFUSAL_LINE1));
+ assertTrue(pdfParser.getRawText(pdfReader, 1).contains(REASONS_FOR_REFUSAL_LINE2));
+ }
+
+ @Test
+ public void verifyRollingFooterLeftText() throws IOException {
+ assertTrue(pdfParser.getRawText(pdfReader, 1).contains(ROLLING_FOOTER_LEFT));
+ }
+
+ @Test
+ public void verifyAdditionalComments() throws IOException {
+ assertTrue(pdfParser.getRawText(pdfReader, 2).contains(ADDITIONAL_COMMENTS));
+ }
+
+ @Test
+ public void verifyRollingHeaderLeftText() throws IOException {
+ assertTrue(pdfParser.getRawText(pdfReader, 2).contains(ROLLING_HEADER_LEFT));
+ }
+
+ @Test
+ public void verifyRollingHeaderRightText() throws IOException {
+ assertTrue(pdfParser.getRawText(pdfReader, 2).contains(ROLLING_HEADER_RIGHT));
+ }
+
+ @Test
+ public void verifyPrintName() throws IOException {
+ assertTrue(pdfParser.getRawText(pdfReader, 2).contains(PRINT_NAME));
+ }
+
+ @Test
+ public void verifyLocation() throws IOException {
+ assertTrue(pdfParser.getRawText(pdfReader, 2).contains(LOCATION));
+ }
+
+ @Test
+ public void verifyLocationNumber() throws IOException {
+ assertTrue(pdfParser.getRawText(pdfReader, 2).contains(LOCATION_NUMBER));
+ }
+
+ @Test
+ public void verifyDate() throws IOException {
+ assertTrue(pdfParser.getRawText(pdfReader, 2).contains(DATE_OF_THE_TEST));
+ }
+}
diff --git a/src/test/java/pdfverification/tests/VTG12Tests.java b/src/test/java/pdfverification/tests/VTG12Tests.java
new file mode 100644
index 00000000..f1a0f398
--- /dev/null
+++ b/src/test/java/pdfverification/tests/VTG12Tests.java
@@ -0,0 +1,36 @@
+package pdfverification.tests;
+
+import com.github.jknack.handlebars.Handlebars;
+import htmlverification.service.CvsCertificateTestDataProvider;
+import org.xhtmlrenderer.pdf.ITextRenderer;
+import pdfverification.service.PDFParser;
+import uk.gov.dvsa.service.HtmlGenerator;
+import uk.gov.dvsa.service.PDFGenerationService;
+
+public class VTG12Tests extends AbandonedTests{
+
+ public VTG12Tests() {
+ super.testCertificate = CvsCertificateTestDataProvider.getVTG12();
+ super.htmlGenerator = new HtmlGenerator(new Handlebars());
+ super.pdfGenerationService = new PDFGenerationService(new ITextRenderer());
+ super.pdfParser = new PDFParser();
+
+ super.DYNAMIC_TITLE_SECTION = "Examination (VTG12)";
+ super.REGULATION_LINE1 = "Regulations 7 and 8 of the Goods Vehicles (Plating";
+ super.REGULATION_LINE2 = "and Testing) Regulations 1988 as Amended";
+ super.VEHICLE_TYPE_TEXT_LINE1 = "In respect of the goods vehicle with registration number / chassis serial number / trailer";
+ super.VEHICLE_TYPE_TEXT_LINE2 = "identification mark :";
+ super.VIN = "P O I U Y T R E W Q 0 1 2 3 0 1 0 9 5 6 7 8 9 1";
+ super.REASONS_FOR_REFUSAL_LINE1 = "Reason 1 exists VTG12";
+ super.REASONS_FOR_REFUSAL_LINE2 = "Reason 2 exists VTG12";
+ super.ROLLING_FOOTER_LEFT = "VTG12 (DVSA0440)";
+ super.ADDITIONAL_COMMENTS = "additional comments VTG12";
+ super.ROLLING_HEADER_LEFT = "VTG12";
+ super.ROLLING_HEADER_RIGHT = "Acceptance of a Goods Vehicle for Examination";
+ super.PRINT_NAME = "fake tester";
+ super.LOCATION = "fake12312312";
+ super.LOCATION_NUMBER = "fake12312312";
+ super.DATE_OF_THE_TEST = "01.02.2024";
+ super.SECTION_TEXT = "having been submitted for an examination under Section 49 and 51 of the Road Traffic Act 1988, it";
+ }
+}
diff --git a/src/test/java/pdfverification/tests/VTP12Tests.java b/src/test/java/pdfverification/tests/VTP12Tests.java
new file mode 100644
index 00000000..6527334a
--- /dev/null
+++ b/src/test/java/pdfverification/tests/VTP12Tests.java
@@ -0,0 +1,36 @@
+package pdfverification.tests;
+
+import com.github.jknack.handlebars.Handlebars;
+import htmlverification.service.CvsCertificateTestDataProvider;
+import org.xhtmlrenderer.pdf.ITextRenderer;
+import pdfverification.service.PDFParser;
+import uk.gov.dvsa.service.HtmlGenerator;
+import uk.gov.dvsa.service.PDFGenerationService;
+
+public class VTP12Tests extends AbandonedTests {
+
+ public VTP12Tests() {
+ this.testCertificate = CvsCertificateTestDataProvider.getVTP12();
+ this.htmlGenerator = new HtmlGenerator(new Handlebars());
+ this.pdfGenerationService = new PDFGenerationService(new ITextRenderer());
+ this.pdfParser = new PDFParser();
+
+ super.DYNAMIC_TITLE_SECTION = "Examination (VTP12)";
+ super.REGULATION_LINE1 = "Regulation 13 of the Motor Vehicles (Tests) ";
+ super.REGULATION_LINE2 = "Regulations 1981 as amended";
+ super.VEHICLE_TYPE_TEXT_LINE1 = "In respect of the public service vehicle with registration number / chassis serial number :";
+ super.VEHICLE_TYPE_TEXT_LINE2 = "";
+ super.VIN = "P O I U Y T R E W Q 0 1 2 3 0 1 0 9 5 6 7 8 9 1";
+ super.REASONS_FOR_REFUSAL_LINE1 = "Reason 1 exists VTP12";
+ super.REASONS_FOR_REFUSAL_LINE2 = "Reason 1 exists VTP12";
+ super.ROLLING_FOOTER_LEFT = "VTP12 (DVSA0453)";
+ super.ADDITIONAL_COMMENTS = "additional comments VTP12";
+ super.ROLLING_HEADER_LEFT = "VTP12";
+ super.ROLLING_HEADER_RIGHT = "Acceptance of a Public Service Vehicle for Examination";
+ super.PRINT_NAME = "fake tester";
+ super.LOCATION = "fake12312312";
+ super.LOCATION_NUMBER = "fake12312312";
+ super.DATE_OF_THE_TEST = "01.02.2024";
+ super.SECTION_TEXT = "having been submitted for an examination under Section 45 of the Road Traffic Act 1988, it is";
+ }
+}