From 3ed79978e1daee26278696dd4884fefe137a1c27 Mon Sep 17 00:00:00 2001 From: Craig Broady <79261988+cb-cs@users.noreply.github.com> Date: Mon, 22 Jan 2024 15:14:44 +0000 Subject: [PATCH] CB2-10316: Generate Welsh Certificate (#97) * feat(vta-1618): duplicated appropriate templates ready for welsh conversion (#87) feat(vta-1618): added failWelsh template feat(vta-1618): added passNoSeatbeltFieldsWelsh template feat(vta-1618): added passWelsh template feat(vta-1618): added VTG30Welsh template * VTA-1574: Generate Welsh Certificate HGV Pass (#88) * feat(vta-1574): added models and updated logic to use vtg5 bilingual * feat(vta-1574): updated naming convention so it makes more sense * feat(vta-1574): added html verification test for vtg5 * feat(vta-1574): added tests for VTG5W * feat(vta-1574): added tests for hgv pass bilingual * feat(vta-1574): updated unit tests * feat(vta-1574): refactored naming convention for statics * feat(vta-1574): added welsh crest logo to passNoSeatbelts hbs * feat(vta-1574): refactored unit tests, added welsh mileage translation * feat(vta-1574): applied welsh miles logic to odometer history * feat(vta-1574): refactored static * VTA-1575: Generate Welsh certificate Trailer - Pass (#90) * feat(vta-1575): welsh certificate for trailer pass * feat(vta-1575): corrected data model on welsh trailer cert * feat(vta-1575): identification number not registration number * feat(vta-1575): regid or heading welsh * feat(vta-1575): corrected regid or heading in bilingual model * VTA-1576: Generate Welsh Certificate PSV Pass (#92) * feat(vta-1576): added new models, updated enums and configs * feat(vta-1576): corrected typo * feat(vta-1576): added new tests * feat(vta-1576): corrected formatting * feat(cb2-9560): rebased against develop and removed loggers * feat(cb2-9560): added logger for debug * feat(cb2-9560): removed loggers used for debug * CB2-9558: updated no data available, km and mi translations (#94) * feat(cb2-9558): updated no data available, km and mi translations * feat(cb2-9558): corrected typo on statics * feat(cb2-9558): updated translation as per feedback --------- Co-authored-by: Melanie Coslett <50204104+m-coslett@users.noreply.github.com> --- .../gov/dvsa/enums/CertificateTemplates.java | 3 + .../uk/gov/dvsa/enums/CertificateTypes.java | 6 + .../uk/gov/dvsa/enums/DocumentsConfig.java | 12 + .../dvsa/model/cvs/CvsHgvPassBilingual.java | 28 ++ .../dvsa/model/cvs/CvsPsvPassBilingual.java | 28 ++ .../dvsa/model/cvs/CvsTrlPassBilingual.java | 28 ++ .../java/uk/gov/dvsa/model/cvs/VTG5A.java | 2 - .../java/uk/gov/dvsa/model/cvs/VTG5AW.java | 27 ++ .../java/uk/gov/dvsa/model/cvs/VTG5W.java | 28 ++ .../java/uk/gov/dvsa/model/cvs/VTP20W.java | 28 ++ .../CvsMotCertificateDataWelsh.java | 87 ++++ .../view/cvs/CvsOdometerReadingFormatter.java | 26 +- .../views/CommercialVehicles/VTG30Welsh.hbs | 381 +++++++++++++++ .../views/CommercialVehicles/failWelsh.hbs | 360 +++++++++++++++ .../passNoSeatbeltFieldsWelsh.hbs | 433 ++++++++++++++++++ .../views/CommercialVehicles/passWelsh.hbs | 423 +++++++++++++++++ .../component/DefectSummaryComponent.java | 10 + .../CvsCertificateTestDataProvider.java | 268 ++++++++++- .../tests/CvsHgvPassBilingualTest.java | 179 ++++++++ .../tests/CvsPsvPassBilingualTest.java | 166 +++++++ .../tests/CvsTrlPassBilingualTest.java | 155 +++++++ .../htmlverification/tests/VTG5AWTest.java | 113 +++++ .../java/htmlverification/tests/VTG5Test.java | 126 +++++ .../htmlverification/tests/VTG5WTest.java | 135 ++++++ .../htmlverification/tests/VTP20Test.java | 2 +- .../htmlverification/tests/VTP20WTest.java | 158 +++++++ .../cvs/CvsOdometerReadingFormatterTest.java | 2 +- 27 files changed, 3200 insertions(+), 14 deletions(-) create mode 100644 src/main/java/uk/gov/dvsa/model/cvs/CvsHgvPassBilingual.java create mode 100644 src/main/java/uk/gov/dvsa/model/cvs/CvsPsvPassBilingual.java create mode 100644 src/main/java/uk/gov/dvsa/model/cvs/CvsTrlPassBilingual.java create mode 100644 src/main/java/uk/gov/dvsa/model/cvs/VTG5AW.java create mode 100644 src/main/java/uk/gov/dvsa/model/cvs/VTG5W.java create mode 100644 src/main/java/uk/gov/dvsa/model/cvs/VTP20W.java create mode 100644 src/main/java/uk/gov/dvsa/model/cvs/certificateData/CvsMotCertificateDataWelsh.java create mode 100644 src/main/resources/views/CommercialVehicles/VTG30Welsh.hbs create mode 100644 src/main/resources/views/CommercialVehicles/failWelsh.hbs create mode 100644 src/main/resources/views/CommercialVehicles/passNoSeatbeltFieldsWelsh.hbs create mode 100644 src/main/resources/views/CommercialVehicles/passWelsh.hbs create mode 100644 src/test/java/htmlverification/tests/CvsHgvPassBilingualTest.java create mode 100644 src/test/java/htmlverification/tests/CvsPsvPassBilingualTest.java create mode 100644 src/test/java/htmlverification/tests/CvsTrlPassBilingualTest.java create mode 100644 src/test/java/htmlverification/tests/VTG5AWTest.java create mode 100644 src/test/java/htmlverification/tests/VTG5Test.java create mode 100644 src/test/java/htmlverification/tests/VTG5WTest.java create mode 100644 src/test/java/htmlverification/tests/VTP20WTest.java diff --git a/src/main/java/uk/gov/dvsa/enums/CertificateTemplates.java b/src/main/java/uk/gov/dvsa/enums/CertificateTemplates.java index a71480d4..c30246a6 100644 --- a/src/main/java/uk/gov/dvsa/enums/CertificateTemplates.java +++ b/src/main/java/uk/gov/dvsa/enums/CertificateTemplates.java @@ -20,10 +20,13 @@ public enum CertificateTemplates { VT29("MOT/VT29"), VTP20("CommercialVehicles/pass"), + VTP20W("CommercialVehicles/passWelsh"), VTP30("CommercialVehicles/fail"), VTG5("CommercialVehicles/passNoSeatbeltFields"), + VTG5W("CommercialVehicles/passNoSeatbeltFieldsWelsh"), VTG5A("CommercialVehicles/passNoSeatbeltFields"), + VTG5AW("CommercialVehicles/passNoSeatbeltFieldsWelsh"), VTG30("CommercialVehicles/VTG30"), ADR_PASS("CommercialVehicles/ADR_PASS"), diff --git a/src/main/java/uk/gov/dvsa/enums/CertificateTypes.java b/src/main/java/uk/gov/dvsa/enums/CertificateTypes.java index f4cf394f..6d9df1eb 100644 --- a/src/main/java/uk/gov/dvsa/enums/CertificateTypes.java +++ b/src/main/java/uk/gov/dvsa/enums/CertificateTypes.java @@ -24,11 +24,17 @@ public enum CertificateTypes { VT29("MOT/VT29"), CVS_PASS("CVS/VTP20"), + CVS_PASS_WELSH("CVS/VTP20W"), + CVS_PASS_BILINGUAL("CVS/VTP20_BILINGUAL"), CVS_FAIL("CVS/VTP30"), CVS_PSV_PRS("CVS/PSV_PRS"), CVS_HGV_PASS("CVS/VTG5"), + CVS_HGV_PASS_WELSH("CVS/VTG5W"), + CVS_HGV_PASS_BILINGUAL("CVS/VTG5_BILINGUAL"), CVS_TRL_PASS("CVS/VTG5A"), + CVS_TRL_PASS_WELSH("CVS/VTG5AW"), + CVS_TRL_PASS_BILINGUAL("CVS/VTG5A_BILINGUAL"), CVS_HGV_TRL_FAIL("CVS/VTG30"), CVS_HGV_PRS("CVS/HGV_PRS"), CVS_TRL_PRS("CVS/TRL_PRS"), diff --git a/src/main/java/uk/gov/dvsa/enums/DocumentsConfig.java b/src/main/java/uk/gov/dvsa/enums/DocumentsConfig.java index 4b1f585b..f158355d 100644 --- a/src/main/java/uk/gov/dvsa/enums/DocumentsConfig.java +++ b/src/main/java/uk/gov/dvsa/enums/DocumentsConfig.java @@ -46,13 +46,19 @@ public enum DocumentsConfig { new String[]{CertificateTemplates.VTP20.getCertificateTemplateName(), CertificateTemplates.VTP30.getCertificateTemplateName()}), VTP20(CertificateTypes.CVS_PASS.getCertificateType(), uk.gov.dvsa.model.cvs.VTP20.class, new String[]{CertificateTemplates.VTP20.getCertificateTemplateName()}), + VTP20W(CertificateTypes.CVS_PASS_WELSH.getCertificateType(), uk.gov.dvsa.model.cvs.VTP20W.class, + new String[]{CertificateTemplates.VTP20W.getCertificateTemplateName()}), VTP30(CertificateTypes.CVS_FAIL.getCertificateType(), uk.gov.dvsa.model.cvs.VTP30.class, new String[]{CertificateTemplates.VTP30.getCertificateTemplateName()}), VTG5A(CertificateTypes.CVS_TRL_PASS.getCertificateType(), uk.gov.dvsa.model.cvs.VTG5A.class, new String[]{CertificateTemplates.VTG5A.getCertificateTemplateName()}), + VTG5AW(CertificateTypes.CVS_TRL_PASS_WELSH.getCertificateType(), uk.gov.dvsa.model.cvs.VTG5AW.class, + new String[]{CertificateTemplates.VTG5AW.getCertificateTemplateName()}), VTG5(CertificateTypes.CVS_HGV_PASS.getCertificateType(), uk.gov.dvsa.model.cvs.VTG5.class, new String[]{CertificateTemplates.VTG5.getCertificateTemplateName()}), + VTG5W(CertificateTypes.CVS_HGV_PASS_WELSH.getCertificateType(), uk.gov.dvsa.model.cvs.VTG5W.class, + new String[]{CertificateTemplates.VTG5W.getCertificateTemplateName()}), VTG30(CertificateTypes.CVS_HGV_TRL_FAIL.getCertificateType(), uk.gov.dvsa.model.cvs.VTG30.class, new String[]{CertificateTemplates.VTG30.getCertificateTemplateName()}), ADR_PASS(CertificateTypes.ADR_PASS.getCertificateType(), AdrPassCertificate.class, @@ -68,6 +74,12 @@ public enum DocumentsConfig { new String[]{CertificateTemplates.RWT_DATA.getCertificateTemplateName()}), CVS_HGV_PRS(CertificateTypes.CVS_HGV_PRS.getCertificateType(), uk.gov.dvsa.model.cvs.CvsHgvPRS.class, new String[]{CertificateTemplates.VTG5.getCertificateTemplateName(), CertificateTemplates.VTG30.getCertificateTemplateName()}), + CVS_PASS_BILINGUAL(CertificateTypes.CVS_PASS_BILINGUAL.getCertificateType(), uk.gov.dvsa.model.cvs.CvsPsvPassBilingual.class, + new String[]{CertificateTemplates.VTP20.getCertificateTemplateName(), CertificateTemplates.VTP20W.getCertificateTemplateName()}), + CVS_HGV_PASS_BILINGUAL(CertificateTypes.CVS_HGV_PASS_BILINGUAL.getCertificateType(), uk.gov.dvsa.model.cvs.CvsHgvPassBilingual.class, + new String[]{CertificateTemplates.VTG5.getCertificateTemplateName(), CertificateTemplates.VTG5W.getCertificateTemplateName()}), + CVS_TRL_PASS_BILINGUAL(CertificateTypes.CVS_TRL_PASS_BILINGUAL.getCertificateType(), uk.gov.dvsa.model.cvs.CvsTrlPassBilingual.class, + new String[]{CertificateTemplates.VTG5A.getCertificateTemplateName(), CertificateTemplates.VTG5AW.getCertificateTemplateName()}), CVS_TRL_PRS(CertificateTypes.CVS_TRL_PRS.getCertificateType(), uk.gov.dvsa.model.cvs.CvsTrlPRS.class, new String[]{CertificateTemplates.VTG5A.getCertificateTemplateName(), CertificateTemplates.VTG30.getCertificateTemplateName()}), diff --git a/src/main/java/uk/gov/dvsa/model/cvs/CvsHgvPassBilingual.java b/src/main/java/uk/gov/dvsa/model/cvs/CvsHgvPassBilingual.java new file mode 100644 index 00000000..63f34d26 --- /dev/null +++ b/src/main/java/uk/gov/dvsa/model/cvs/CvsHgvPassBilingual.java @@ -0,0 +1,28 @@ +package uk.gov.dvsa.model.cvs; + +public class CvsHgvPassBilingual extends VTG5W { + + public String getTestType() { + return "HGV"; + } + + public String getPresentedDocumentNamePass() { + return "VTG5"; + } + + public String getPresentedDocumentNamePassWelsh() { + return "VTG5W"; + } + + public String getVersionNumberPass() { + return "1.0"; + } + + public String getVersionNumberPassWelsh() { + return "1.0"; + } + + public String getRegOrIdHeading() { + return "Registration number"; + } +} diff --git a/src/main/java/uk/gov/dvsa/model/cvs/CvsPsvPassBilingual.java b/src/main/java/uk/gov/dvsa/model/cvs/CvsPsvPassBilingual.java new file mode 100644 index 00000000..58aea532 --- /dev/null +++ b/src/main/java/uk/gov/dvsa/model/cvs/CvsPsvPassBilingual.java @@ -0,0 +1,28 @@ +package uk.gov.dvsa.model.cvs; + +public class CvsPsvPassBilingual extends VTP20W { + + public String getTestType() { + return "PSV"; + } + + public String getPresentedDocumentNamePass() { + return "VTP20"; + } + + public String getPresentedDocumentNamePassWelsh() { + return "VTP20W"; + } + + public String getVersionNumberPass() { + return "1.0"; + } + + public String getVersionNumberPassWelsh() { + return "1.0"; + } + + public String getRegOrIdHeading() { + return "Registration number"; + } +} diff --git a/src/main/java/uk/gov/dvsa/model/cvs/CvsTrlPassBilingual.java b/src/main/java/uk/gov/dvsa/model/cvs/CvsTrlPassBilingual.java new file mode 100644 index 00000000..b34a8379 --- /dev/null +++ b/src/main/java/uk/gov/dvsa/model/cvs/CvsTrlPassBilingual.java @@ -0,0 +1,28 @@ +package uk.gov.dvsa.model.cvs; + +public class CvsTrlPassBilingual extends VTG5AW { + + public String getTestType() { + return "Trailer"; + } + + public String getPresentedDocumentNamePass() { + return "VTG5A"; + } + + public String getPresentedDocumentNamePassWelsh() { + return "VTG5AW"; + } + + public String getVersionNumberPass() { + return "1.0"; + } + + public String getVersionNumberPassWelsh() { + return "1.0"; + } + + public String getRegOrIdHeading() { + return "Identification number"; + } +} diff --git a/src/main/java/uk/gov/dvsa/model/cvs/VTG5A.java b/src/main/java/uk/gov/dvsa/model/cvs/VTG5A.java index 62545843..25282fd5 100644 --- a/src/main/java/uk/gov/dvsa/model/cvs/VTG5A.java +++ b/src/main/java/uk/gov/dvsa/model/cvs/VTG5A.java @@ -23,6 +23,4 @@ public String getVersionNumberPass() { } public String getRegOrIdHeading() { return "Identification number"; } - - } diff --git a/src/main/java/uk/gov/dvsa/model/cvs/VTG5AW.java b/src/main/java/uk/gov/dvsa/model/cvs/VTG5AW.java new file mode 100644 index 00000000..25088c60 --- /dev/null +++ b/src/main/java/uk/gov/dvsa/model/cvs/VTG5AW.java @@ -0,0 +1,27 @@ +package uk.gov.dvsa.model.cvs; + +import uk.gov.dvsa.model.Document; +import uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateData; +import uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateDataWelsh; + +public class VTG5AW extends CvsMotCertificate { + + public Document setData(CvsMotCertificateDataWelsh data) { + this.data = data; + return this; + } + + public String getTestType() { + return "Trailer"; + } + + public String getPresentedDocumentNamePass() { + return "VTG5AW"; + } + + public String getVersionNumberPass() { + return "1.0"; + } + + public String getRegOrIdHeadingWelsh() { return "Rhif adnabod"; } +} diff --git a/src/main/java/uk/gov/dvsa/model/cvs/VTG5W.java b/src/main/java/uk/gov/dvsa/model/cvs/VTG5W.java new file mode 100644 index 00000000..0af1b1e4 --- /dev/null +++ b/src/main/java/uk/gov/dvsa/model/cvs/VTG5W.java @@ -0,0 +1,28 @@ +package uk.gov.dvsa.model.cvs; + +import uk.gov.dvsa.model.Document; +import uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateDataWelsh; + +public class VTG5W extends CvsMotCertificate { + + public Document setData(CvsMotCertificateDataWelsh data) { + this.data = data; + return this; + } + + public String getTestType() { + return "HGV"; + } + + public String getPresentedDocumentNamePass() { + return "VTG5W"; + } + + public String getVersionNumberPass() { + return "1.0"; + } + + public String getRegOrIdHeadingWelsh() { + return "Rhif cofrestru"; + } +} diff --git a/src/main/java/uk/gov/dvsa/model/cvs/VTP20W.java b/src/main/java/uk/gov/dvsa/model/cvs/VTP20W.java new file mode 100644 index 00000000..801e07d0 --- /dev/null +++ b/src/main/java/uk/gov/dvsa/model/cvs/VTP20W.java @@ -0,0 +1,28 @@ +package uk.gov.dvsa.model.cvs; + +import uk.gov.dvsa.model.Document; +import uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateDataWelsh; + +public class VTP20W extends CvsMotCertificate { + + public Document setData(CvsMotCertificateDataWelsh data) { + this.data = data; + return this; + } + + public String getTestType() { + return "PSV"; + } + + public String getPresentedDocumentNamePass() { + return "VTP20W"; + } + + public String getVersionNumberPass() { + return "1.0"; + } + + public String getRegOrIdHeadingWelsh() { + return "Rhif cofrestru"; + } +} diff --git a/src/main/java/uk/gov/dvsa/model/cvs/certificateData/CvsMotCertificateDataWelsh.java b/src/main/java/uk/gov/dvsa/model/cvs/certificateData/CvsMotCertificateDataWelsh.java new file mode 100644 index 00000000..248cb6f6 --- /dev/null +++ b/src/main/java/uk/gov/dvsa/model/cvs/certificateData/CvsMotCertificateDataWelsh.java @@ -0,0 +1,87 @@ +package uk.gov.dvsa.model.cvs.certificateData; + +import com.fasterxml.jackson.annotation.JsonProperty; +import uk.gov.dvsa.model.mot.certificateData.FormattedOdometerReading; +import uk.gov.dvsa.model.mot.results.DefectsList; +import uk.gov.dvsa.model.mot.results.Summary; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public class CvsMotCertificateDataWelsh extends CvsMotCertificateData { + + public static final String EU_NUMBER_FOR_DEFECTS = "6"; + public static final String ADVISORIES_HEADER_WELSH = "Monitro a thrwsio os oes angen (cynghorol)"; + public static final String MINOR_DEFECTS_HEADER_WELSH = "Atgyweiriwch cyn gynted â phosibl (ddiffygion bach)"; + public static final String PASS_SUMMARY_HEADER_WELSH = "Llwyddo"; + public static final String PASS_WITH_DEFECTS_HEADER_WELSH = "Llwyddo gyda diffygion"; + public static final String TESTING_ORGANISATION_WELSH = "ASIANTAETH SAFONAU GYRWYR A CHERBYDAU"; + + @JsonProperty("AdvisoryDefectsWelsh") + private List advisoryDefectsWelsh; + + @JsonProperty("MinorDefectsWelsh") + private List minorDefectsWelsh; + + public Summary getSummaryWelsh() { + return new Summary(buildSummaryTitleWelsh()); + } + + private String buildSummaryTitleWelsh() { + if (!hasMinorDefects(minorDefectsWelsh)) { + return PASS_SUMMARY_HEADER_WELSH; + } else { + return PASS_WITH_DEFECTS_HEADER_WELSH; + } + } + + public List getAdvisoryDefectsWelsh() { + return advisoryDefectsWelsh; + } + + public CvsMotCertificateDataWelsh setAdvisoryDefectsWelsh(List advisoryDefectsWelsh) { + this.advisoryDefectsWelsh = advisoryDefectsWelsh; + return this; + } + + public List getMinorDefectsWelsh() { + return minorDefectsWelsh; + } + + public CvsMotCertificateDataWelsh setMinorDefectsWelsh(List minorDefectsWelsh) { + this.minorDefectsWelsh = minorDefectsWelsh; + return this; + } + + public DefectsList getAdvisoryWelsh() { + return new DefectsList(ADVISORIES_HEADER_WELSH, this.advisoryDefectsWelsh); + } + + public DefectsList getMinorWelsh() { + return new DefectsList(MINOR_DEFECTS_HEADER_WELSH, this.minorDefectsWelsh, EU_NUMBER_FOR_DEFECTS); + } + + public String getTestingOrganisationWelsh() { + return TESTING_ORGANISATION_WELSH; + } + + public String getFormattedCurrentOdometerWelsh() { + return ODOMETER_FORMATTER.formatWelshValue(getCurrentOdometer()); + } + + public List getMileageHistoryWelsh() { + if (null != getOdometerHistoryList()) { + return getOdometerHistoryList().stream() + .map( + entry -> new FormattedOdometerReading( + ODOMETER_FORMATTER.formatWelshValue(entry), + entry.getDate() + ) + ) + .collect(Collectors.toList()); + } else { + return Collections.emptyList(); + } + } +} diff --git a/src/main/java/uk/gov/dvsa/view/cvs/CvsOdometerReadingFormatter.java b/src/main/java/uk/gov/dvsa/view/cvs/CvsOdometerReadingFormatter.java index 9ebe74e7..d37caf8e 100644 --- a/src/main/java/uk/gov/dvsa/view/cvs/CvsOdometerReadingFormatter.java +++ b/src/main/java/uk/gov/dvsa/view/cvs/CvsOdometerReadingFormatter.java @@ -2,15 +2,16 @@ import org.apache.commons.lang3.StringUtils; import uk.gov.dvsa.model.cvs.certificateData.CvsOdometerReading; -import uk.gov.dvsa.model.mot.certificateData.OdometerReading; import java.util.Optional; public class CvsOdometerReadingFormatter { public static final String MILES = "miles"; - + public static final String MILES_WELSH = "milltiroedd"; private static final String MILES_UNIT = "mi"; + public static final String KILOMETERS = "kilometres"; + public static final String KILOMETERS_WELSH = "cilometrau"; private static final String KILOMETERS_UNIT = "km"; private static final String THOUSANDS_PATTERN = "\\B(?=(?:.{3})+$)"; private static final String THOUSANDS_SEPARATOR = ","; @@ -30,12 +31,29 @@ public String formatValue(CvsOdometerReading odometer) { .orElse(""); } + public String formatWelshValue(CvsOdometerReading odometer) { + if (odometer == null) { + return ""; + } + + if (isRemark(odometer)) { + return odometer.getValue(); + } + + return formatNumberValue(odometer.getValue()) + + Optional.ofNullable(odometer.getUnit()) + .map(unit -> " " + formatUnit(unit, true)) + .orElse(""); + } + private String formatUnit(String unit, Boolean unitWelsh) { switch (unit) { + case MILES: case MILES_UNIT: - return MILES; + return unitWelsh.equals(Boolean.TRUE) ? MILES_WELSH : MILES; + case KILOMETERS: case KILOMETERS_UNIT: - return "km"; + return unitWelsh.equals(Boolean.TRUE) ? KILOMETERS_WELSH : KILOMETERS; default: return unit; } diff --git a/src/main/resources/views/CommercialVehicles/VTG30Welsh.hbs b/src/main/resources/views/CommercialVehicles/VTG30Welsh.hbs new file mode 100644 index 00000000..9d3acfce --- /dev/null +++ b/src/main/resources/views/CommercialVehicles/VTG30Welsh.hbs @@ -0,0 +1,381 @@ + + + + Gwrthod tystysgrif prawf MOT + + + +{{~> views/component/watermarkComponent watermark=watermark}} + + + + + + +
+
+ +
+
+

+ {{#if reissue}} +

{{reissue.reason}}

+ {{/if}} + Gwrthod tystysgrif prawf MOT +

+ +
+

+ + + (1) + + + + + Rhif adnabod cerbyd + + +

+ + {{failData.rawVin}} + +
+ + +
+
+ +
+

+ + + (2a) + + + + + {{regOrIdHeading}} + + +

+ + {{failData.rawVrm}} + +
+ +
+
+ +
+

+ + + (2b) + + + + + Gwlad o cofrestriad + + +

+ + {{failData.countryOfRegistrationCodeFormatted}} + +
+ +
+ {{#if failData.isTrailer}} +
+ +
+

+ + + (2c) + + + + + Rhif Cofrestru + + +

+ + {{failData.trn}} + +
+ +
+ {{/if}} +
+ + +
+

+ + Math a model + +

+ + {{failData.make}}, {{failData.model}} + +
+ +
+
+ +
+
+ +
+
+ +
+

+ + + (5) + + + + + Categori cerbyd + + +

+ + {{failData.vehicleEuClassification}} + +
+ +
+ {{#if failData.formattedCurrentOdometer}} +
+ +
+

+ + + (4) + + + + + Odomedr + + +

+ + {{failData.formattedCurrentOdometer}} + +
+ +
+ {{/if}} +
+ +
+ + +
+
+ {{#if failData.summary.present}} + {{~> views/CommercialVehicles/reasonsForRejection failData.summary}} + {{/if}} + {{#if failData.dangerous.present}} + {{~> views/CommercialVehicles/reasonsForRejection failData.dangerous}} + {{/if}} + {{#if failData.major.present}} + {{~> views/CommercialVehicles/reasonsForRejection failData.major}} + {{/if}} + {{#if failData.minor.present}} + {{~> views/CommercialVehicles/reasonsForRejection failData.minor}} + {{/if}} + {{#if failData.advisory.present}} + {{~> views/CommercialVehicles/reasonsForRejection failData.advisory}} + {{/if}} + {{#if failData.prs.present}} + {{~> views/CommercialVehicles/reasonsForRejection failData.prs}} + {{/if}} +
+
+ + +
+
+ +
+

+ + + (3b) + + + + + Dyddiad y prawf + + +

+ + {{failData.dateOfTheTest}} + +
+ +
+

+ + + (3a) + + + + + Lleoliad y prawf + + +

+ + {{failData.locationOfTheTest}} + +
+ + +
+

+ + + (9) + + + + + Sefydliad ac arolygydd y prawf + + +

+ + {{failData.testingOrganisation}} +
+ {{failData.issuersName}} +
+
+ + +
+

+ + Rhif prawf + +

+ + {{failData.testNumber}} + +
+ + {{#if reissue}} +
+

+ {{reissue.reason}} certificate issued by {{reissue.issuer}} on {{reissue.date}} +

+
+ {{/if}} + +
+

+ Ar gyfer ail brawf, rhaid i chi drwsio'r diffygion a threfnu i fynd â'r cerbyd i gyfleuster profi awdurdodedig o fewn 14 diwrnod gwaith i ddyddiad y prawf hwn, a thalu'r taliad priodol. +

+
+ + +
+

+ Mae rhagor o wybodaeth ar gael ar wefan www.gov.uk/annual-test-for-lorries-buses-and-trailers. +

+

+ Os nad yw unrhyw un o’r manylion yn gywir, cysylltwch â DVSA drwy e-bost ar
test.errors@dvsa.gov.uk neu drwy ffôn ar 0300 1239000. +

+

+ Dysgwch am hanes MOT y cerbyd ar wefan www.gov.uk/check-mot-history +

+
+
+
+ +
+
+ + + diff --git a/src/main/resources/views/CommercialVehicles/failWelsh.hbs b/src/main/resources/views/CommercialVehicles/failWelsh.hbs new file mode 100644 index 00000000..0893285a --- /dev/null +++ b/src/main/resources/views/CommercialVehicles/failWelsh.hbs @@ -0,0 +1,360 @@ + + + + Gwrthod tystysgrif prawf MOT + + + +{{~> views/component/watermarkComponent watermark=watermark}} + + + + + + +
+
+ +
+
+

+ {{#if reissue}} +

{{reissue.reason}}

+ {{/if}} + Gwrthod tystysgrif prawf MOT +

+ +
+

+ + + (1) + + + + + Rhif adnabod cerbyd + + +

+ + {{failData.rawVin}} + +
+ + +
+
+ +
+

+ + + (2a) + + + + + {{regOrIdHeading}} + + +

+ + {{failData.rawVrm}} + +
+ +
+
+ +
+

+ + + (2b) + + + + + Gwlad cofrestru + + +

+ + {{failData.countryOfRegistrationCodeFormatted}} + +
+ +
+
+ + +
+

+ + Math a model + +

+ + {{failData.make}}, {{failData.model}} + +
+ +
+
+ +
+
+ +
+
+ +
+

+ + + (5) + + + + + Categori cerbyd + + +

+ + {{failData.vehicleEuClassification}} + +
+ +
+ {{#if failData.formattedCurrentOdometer}} +
+ +
+

+ + + (4) + + + + + Odomedr + + +

+ + {{failData.formattedCurrentOdometer}} + +
+ +
+ {{/if}} +
+ +
+ + +
+
+ {{#if failData.summary.present}} + {{~> views/CommercialVehicles/reasonsForRejection failData.summary}} + {{/if}} + {{#if failData.dangerous.present}} + {{~> views/CommercialVehicles/reasonsForRejection failData.dangerous}} + {{/if}} + {{#if failData.major.present}} + {{~> views/CommercialVehicles/reasonsForRejection failData.major}} + {{/if}} + {{#if failData.minor.present}} + {{~> views/CommercialVehicles/reasonsForRejection failData.minor}} + {{/if}} + {{#if failData.advisory.present}} + {{~> views/CommercialVehicles/reasonsForRejection failData.advisory}} + {{/if}} + {{#if failData.prs.present}} + {{~> views/CommercialVehicles/reasonsForRejection failData.prs}} + {{/if}} +
+
+ + +
+
+ +
+

+ + + (3b) + + + + + Dyddiad y prawf + + +

+ + {{failData.dateOfTheTest}} + +
+ +
+

+ + + (3a) + + + + + Lleoliad y prawf + + +

+ + {{failData.locationOfTheTest}} + +
+ + +
+

+ + + (9) + + + + + Sefydliad ac arolygydd y prawf + + +

+ + {{failData.testingOrganisation}} +
+ {{failData.issuersName}} +
+
+ + +
+

+ + Rhif prawf + +

+ + {{failData.testNumber}} + +
+ + {{#if reissue}} +
+

+ {{reissue.reason}} certificate issued by {{reissue.issuer}} on {{reissue.date}} +

+
+ {{/if}} + +
+

+ Ar gyfer ail brawf, rhaid i chi drwsio'r diffygion a threfnu i fynd â'r cerbyd i gyfleuster profi awdurdodedig o fewn 14 diwrnod gwaith i ddyddiad y prawf hwn, a thalu'r taliad priodol. +

+
+ + +
+

+ Mae rhagor o wybodaeth ar gael ar wefan www.gov.uk/annual-test-for-lorries-buses-and-trailers. +

+

+ Os nad yw unrhyw un o’r manylion yn gywir, cysylltwch â DVSA drwy e-bost ar
test.errors@dvsa.gov.uk neu drwy ffôn ar 0300 1239000. +

+

+ Derbynnwch nodyn atgoffa MOT blynyddol am ddim trwy danysgrifio +
ar wefan www.gov.uk/mot-reminder + neu drwy ffôn ar 0300 1239000. +

+
+
+
+ +
+
+ + + diff --git a/src/main/resources/views/CommercialVehicles/passNoSeatbeltFieldsWelsh.hbs b/src/main/resources/views/CommercialVehicles/passNoSeatbeltFieldsWelsh.hbs new file mode 100644 index 00000000..744f573c --- /dev/null +++ b/src/main/resources/views/CommercialVehicles/passNoSeatbeltFieldsWelsh.hbs @@ -0,0 +1,433 @@ + + + + Tystysgrif prawf MOT ({{testType}}) + + + +{{~> views/component/watermarkComponent watermark=watermark}} + + + + + + +
+
+ +
+
+

+ {{#if reissue}} +

{{reissue.reason}}

+ {{/if}} + Tystysgrif prawf MOT ({{testType}}) +

+ +
+

+ + + (1) + + + + + Rhif adnabod cerbyd + + +

+ + {{data.rawVin}} + +
+ + +
+
+ +
+

+ + + (2a) + + + + + {{regOrIdHeadingWelsh}} + + +

+ + {{data.rawVrm}} + +
+ +
+
+ +
+

+ + + (2b) + + + + + Gwlad cofrestru + + +

+ + {{data.countryOfRegistrationCodeFormatted}} + +
+ +
+ {{#if data.isTrailer}} +
+ +
+

+ + + (2c) + + + + + Rhif cofrestru + + +

+ + {{data.trn}} + +
+ +
+ {{/if}} +
+ + +
+

+ + Math a model + +

+ + {{data.make}}, {{data.model}} + +
+ +
+
+ +
+
+ +
+
+ +
+

+ + + (5) + + + + + Categori cerbyd + + +

+ + {{data.vehicleEuClassification}} + +
+ +
+ {{#if data.formattedCurrentOdometerWelsh}} +
+ +
+

+ + + (4) + + + + + Odomedr + + +

+ + {{data.formattedCurrentOdometerWelsh}} + +
+ +
+ {{/if}} +
+ +
+

+ + Hanes odomedr + +

+
+ + {{#if data.odometerHistoryList}} +
    + {{#each data.mileageHistoryWelsh}} +
  • +
    + + {{this.value}} + +
    +
    + + {{this.date}} + +
    +
  • + {{/each}} +
+ {{else}} + + Dim data ar gael + + {{/if}} + +
+
+ +
+
+ +
+ + +
+
+ {{~> views/CommercialVehicles/reasonsForRejection data.summaryWelsh}} + {{#if data.minorWelsh.present}} + {{~> views/CommercialVehicles/reasonsForRejection data.minorWelsh}} + {{/if}} + {{#if data.advisory.present}} + {{~> views/CommercialVehicles/reasonsForRejection data.advisoryWelsh}} + {{/if}} +
+
+ + +
+
+ +
+
+ +
+

+ + + (3b) + + + + + Dyddiad y prawf + + +

+ + {{data.dateOfTheTest}} + +
+ +
+
+ +
+

+ + + (8) + + + + + Dyddiad dod i ben + + +

+ + {{data.expiryDate}} + +
+ +
+
+ +

+ Er mwyn cadw pen-blwydd y dyddiad dod i ben, y cynharaf y gallwch chi gyflwyno'ch cerbyd ar gyfer prawf + yw {{data.earliestDateOfTheNextTest}}. +

+ +
+

+ + + (3a) + + + + + Lleoliad y prawf + + +

+ + {{data.locationOfTheTest}} + +
+ + +
+

+ + + (9) + + + + + Sefydliad ac arolygydd y prawf + + +

+ + {{data.testingOrganisationWelsh}} +
+ {{data.issuersName}} +
+
+ + +
+

+ + Rhif prawf + +

+ + {{data.testNumber}} + +
+ {{#if reissue}} +
+

+ {{reissue.reason}} certificate issued by {{reissue.issuer}} on {{reissue.date}} +

+
+ {{/if}} + +
+

+ Gwiriwch fod y ddogfen hon yn ddilys drwy fynd i wefan www.gov.uk/check-mot-history +

+

+ Os nad yw unrhyw fanylion yn gywir, cysylltwch â DVSA drwy e-bost ar
test.errors@dvsa.gov.uk neu drwy ffonio 0300 1239000. +

+

+ Derbynnwch nodyn atgoffa MOT blynyddol am ddim trwy danysgrifio +
ar wefan www.gov.uk/mot-reminder + neu drwy ffôn ar 0300 1239000. +

+
+
+
+ +
+
+ + + diff --git a/src/main/resources/views/CommercialVehicles/passWelsh.hbs b/src/main/resources/views/CommercialVehicles/passWelsh.hbs new file mode 100644 index 00000000..cf2f3e63 --- /dev/null +++ b/src/main/resources/views/CommercialVehicles/passWelsh.hbs @@ -0,0 +1,423 @@ + + + + Tystysgrif prawf MOT ({{testType}}) + + + +{{~> views/component/watermarkComponent watermark=watermark}} + + + + + + +
+
+ +
+
+

+ {{#if reissue}} +

{{reissue.reason}}

+ {{/if}} + Tystysgrif prawf MOT ({{testType}}) +

+ +
+

+ + + (1) + + + + + Rhif adnabod cerbyd + + +

+ + {{data.rawVin}} + +
+ + +
+
+ +
+

+ + + (2a) + + + + + {{regOrIdHeadingWelsh}} + + +

+ + {{data.rawVrm}} + +
+ +
+
+ +
+

+ + + (2b) + + + + + Gwlad cofrestru + + +

+ + {{data.countryOfRegistrationCodeFormatted}} + +
+ +
+
+ + +
+

+ + Math a model + +

+ + {{data.make}}, {{data.model}} + +
+ +
+
+ +
+
+ +
+
+ +
+

+ + + (5) + + + + + Categori cerbyd + + +

+ + {{data.vehicleEuClassification}} + +
+ +
+ {{#if data.formattedCurrentOdometerWelsh}} +
+ +
+

+ + + (4) + + + + + Odomedr + + +

+ + {{data.formattedCurrentOdometerWelsh}} + +
+ +
+ {{/if}} +
+ +
+

+ + Hanes odomedr + +

+
+ + {{#if data.odometerHistoryList}} +
    + {{#each data.mileageHistoryWelsh}} +
  • +
    + + {{this.value}} + +
    +
    + + {{this.date}} + +
    +
  • + {{/each}} +
+ {{else}} + + Dim data ar gael + + {{/if}} + +
+
+ +
+
+ +
+ + +
+
+ {{~> views/CommercialVehicles/reasonsForRejection data.summaryWelsh}} + {{#if data.minor.present}} + {{~> views/CommercialVehicles/reasonsForRejection data.minorWelsh}} + {{/if}} + {{#if data.advisory.present}} + {{~> views/CommercialVehicles/reasonsForRejection data.advisoryWelsh}} + {{/if}} +
+
+ + +
+
+ +
+
+ +
+

+ + + (3b) + + + + + Dyddiad y prawf + + +

+ + {{data.dateOfTheTest}} + +
+ +
+
+ +
+

+ + + (8) + + + + + Dyddiad dod i ben + + +

+ + {{data.expiryDate}} + +
+ +
+
+ +

+ Er mwyn cadw pen-blwydd y dyddiad dod i ben, y cynharaf y gallwch chi gyflwyno'ch cerbyd ar gyfer prawf yw {{data.earliestDateOfTheNextTest}}. +

+ +
+

+ + + (3a) + + + + + Lleoliad y prawf + + +

+ + {{data.locationOfTheTest}} + +
+ + +
+

+ + + (9) + + + + + Sefydliad ac arolygydd y prawf + + +

+ + {{data.testingOrganisationWelsh}} +
+ {{data.issuersName}} +
+
+ + +
+

+ + Rhif prawf + +

+ + {{data.testNumber}} + +
+ +
+
+
+
Gosodiad gwregys diogelwch wedi gwirio yn ystod y prawf hwn?
+
Dyddiad gwirio gosod blaenorol
+
Nifer y gwregysau diogelwch a osodwyd
+
+
+
{{data.seatBeltTested}}
+
{{data.seatBeltPreviousCheckDate}}
+
{{data.seatBeltNumber}}
+
+
+
+ {{#if reissue}} +
+

+ {{reissue.reason}} certificate issued by {{reissue.issuer}} on {{reissue.date}} +

+
+ {{/if}} +
+

+ Gwiriwch fod y ddogfen hon yn ddilys drwy fynd i wefan www.gov.uk/check-mot-history +

+

+ Os nad yw unrhyw fanylion yn gywir, cysylltwch â DVSA drwy e-bost ar
test.errors@dvsa.gov.uk neu drwy ffonio 0300 1239000. +

+

+ Derbynnwch nodyn atgoffa MOT blynyddol am ddim trwy danysgrifio +
ar wefan www.gov.uk/mot-reminder + neu drwy ffôn ar 0300 1239000. +

+
+
+
+ +
+
+ + + diff --git a/src/test/java/htmlverification/framework/component/DefectSummaryComponent.java b/src/test/java/htmlverification/framework/component/DefectSummaryComponent.java index 317e2a08..86900271 100644 --- a/src/test/java/htmlverification/framework/component/DefectSummaryComponent.java +++ b/src/test/java/htmlverification/framework/component/DefectSummaryComponent.java @@ -12,7 +12,9 @@ public class DefectSummaryComponent { public static final String ADVISORIES_HEADER_TEXT = "Monitor and repair if necessary (advisories)"; public static final String DANGEROUS_DEFECTS_HEADER_TEXT = "Do not drive until repaired (dangerous defects)"; public static final String ADVISORIES_HEADER_TEXT_WELSH = "Monitro a thrwsio os oes angen (cynghorol)"; + public static final String ADVISORIES_HEADER_TEXT_WELSH_CVS = "Monitro a thrwsio os oes angen (cynghorol)"; public static final String MINOR_DEFECTS_HEADER_TEXT_WELSH = "Rhaid trwsio cyn gynted â phosibl (mân ddiffygion)"; + public static final String MINOR_DEFECTS_HEADER_TEST_WELSH_CVS = "Atgyweiriwch cyn gynted â phosibl (ddiffygion bach)"; public static final String MAJOR_DEFECTS_HEADER_TEXT_WELSH = "Rhaid trwsio ar unwaith (diffygion pennaf)"; public static final String DANGEROUS_DEFECTS_HEADER_PARTIAL_TEXT_WELSH = "Peidiwch â gyrru nes iddo gael ei drwsio (diffygion peryglus)"; @@ -57,6 +59,14 @@ public Elements getAdvisoriesWelsh() { return getResultItemEntries(ADVISORIES_HEADER_TEXT_WELSH); } + public Elements getMinorDefectsWelshCVS() { + return getResultItemEntries(MINOR_DEFECTS_HEADER_TEST_WELSH_CVS); + } + + public Elements getAdvisoriesWelshCVS() { + return getResultItemEntries(ADVISORIES_HEADER_TEXT_WELSH_CVS); + } + public Elements getByTitle(String title) { return getResultItemEntries(title); } diff --git a/src/test/java/htmlverification/service/CvsCertificateTestDataProvider.java b/src/test/java/htmlverification/service/CvsCertificateTestDataProvider.java index a88b0395..85f15767 100644 --- a/src/test/java/htmlverification/service/CvsCertificateTestDataProvider.java +++ b/src/test/java/htmlverification/service/CvsCertificateTestDataProvider.java @@ -1,11 +1,7 @@ package htmlverification.service; import htmlverification.framework.component.DefectSummaryComponent; -import uk.gov.dvsa.model.cvs.VTG30; -import uk.gov.dvsa.model.cvs.VTP20; -import uk.gov.dvsa.model.cvs.VTP30; -import uk.gov.dvsa.model.cvs.VTG5; -import uk.gov.dvsa.model.cvs.VTG5A; +import uk.gov.dvsa.model.cvs.*; import uk.gov.dvsa.model.cvs.certificateData.*; import uk.gov.dvsa.enums.CertificateTypes; @@ -50,6 +46,15 @@ public static VTP20 getReplacementVtp20() { return document; } + public static VTP20W getVtp20wWithNoOdometerHistory() { + VTP20W document = getVtp20W(); + + CvsMotCertificateData data = document.getData(); + data.setOdometerHistoryList(null); + + return document; + } + public static VTP20 getVtp20() { VTP20 vtp20 = new VTP20(); vtp20.setDocumentName(CertificateTypes.CVS_PASS.getCertificateType()); @@ -99,6 +104,56 @@ public static VTP20 getVtp20() { return vtp20; } + public static VTP20W getVtp20W() { + VTP20W vtp20W = new VTP20W(); + vtp20W.setDocumentName(CertificateTypes.CVS_PASS_WELSH.getCertificateType()); + CvsMotCertificateDataWelsh vtp20WData = new CvsMotCertificateDataWelsh(); + vtp20WData + .setMinorDefectsWelsh(generateRFRs(MINOR_RFR_TEXT, 1)) + .setAdvisoryDefectsWelsh(generateRFRs(ADVISORY_RFR_TEXT, 1)) + .setMinorDefectsHeader(DefectSummaryComponent.MINOR_DEFECTS_HEADER_TEST_WELSH_CVS) + .setAdvisoryDefectsHeader(DefectSummaryComponent.ADVISORIES_HEADER_TEXT_WELSH_CVS) + .setMinorDefects(generateRFRs(MINOR_RFR_TEXT, 1)) + .setAdvisoryDefects(generateRFRs(ADVISORY_RFR_TEXT, 1)) + + .setSeatBeltNumber("10") + .setSeatBeltPreviousCheckDate("12.11.2018") + .setSeatBeltTested("Yes") + + .setCountryOfRegistrationCode("GB") + .setRawVin(VIN) + .setDateOfTheTest("12.11.2018") + .setExpiryDate("12.10.2018") + .setTestStationPNumber("P12345") + .setTestStationName("TEST STATION NAME") + .setMake("Aston Martin") + .setModel("DB11") + .setVehicleEuClassification("M1") + .setRawVrm("KA1SAPH") + .setCurrentOdometer( + new CvsOdometerReading("22341", "mi", "01.02.2019") + ) + .setOdometerHistoryList(Arrays.asList( + new CvsOdometerReading("120", "mi", "01.02.2016"), + new CvsOdometerReading("330", "mi", "30.01.2017") + )) + .setIssuersName("R.DREWNO") + .setTestStationName("POPULAR GARAGES") + .setTestNumber("1806 8140 0628") + .setEarliestDateOfTheNextTest("13.10.2018"); + + vtp20W.setData(vtp20WData); + + Signature signature = new Signature(); + signature + .setImageData("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==") + .setImageType("png"); + + vtp20W.setSignature(signature); + + return vtp20W; + } + private static Reissue generateReissuer() { Reissue reissue = new Reissue(); reissue.setIssuer("Joe"); @@ -243,7 +298,6 @@ public static VTG5A getVtg5a() { .setMake("Aston Martin") .setModel("DB11") .setIssuersName("R.DREWNO") - .setTestStationName("POPULAR GARAGES") .setTestNumber("1806 8140 0628") .setEarliestDateOfTheNextTest("13.10.2018") .setTrn("ABC1234") @@ -262,6 +316,208 @@ public static VTG5A getVtg5a() { return vtg5a; } + public static VTG5W getVTG5W() { + VTG5W vtg5W = new VTG5W(); + vtg5W.setDocumentName(CertificateTypes.CVS_HGV_PASS_WELSH.getCertificateType()); + CvsMotCertificateDataWelsh vtg5WData = new CvsMotCertificateDataWelsh(); + vtg5WData + .setMinorDefectsWelsh(generateRFRs(MINOR_RFR_TEXT, 1)) + .setAdvisoryDefectsWelsh(generateRFRs(ADVISORY_RFR_TEXT, 1)) + .setMinorDefectsHeader(DefectSummaryComponent.MINOR_DEFECTS_HEADER_TEST_WELSH_CVS) + .setAdvisoryDefectsHeader(DefectSummaryComponent.ADVISORIES_HEADER_TEXT_WELSH_CVS) + .setMinorDefects(generateRFRs(MINOR_RFR_TEXT, 1)) + .setAdvisoryDefects(generateRFRs(ADVISORY_RFR_TEXT, 1)) + + .setCountryOfRegistrationCode("GB") + .setRawVin(VIN) + .setDateOfTheTest("22.08.2023") + .setExpiryDate("31.08.2024") + .setTestStationPNumber("P12345") + .setTestStationName("TEST STATION NAME") + .setMake("MERCEDES") + .setModel("Z WAGON") + .setVehicleEuClassification("M1") + .setRawVrm("KA15APH") + .setCurrentOdometer( + new CvsOdometerReading("20000", "mi", "22.08.2023") + ) + .setOdometerHistoryList(Arrays.asList( + new CvsOdometerReading("12000", "mi", "13.08.2022"), + new CvsOdometerReading("7000", "mi", "02.08.2021") + ) + ) + .setIssuersName("TESTER NAME") + .setTestStationName("TEST STATION NAME") + .setTestNumber("X01X00001") + .setEarliestDateOfTheNextTest("01.07.2024"); + + vtg5W.setData(vtg5WData); + + Signature signature = new Signature(); + signature + .setImageData("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==") + .setImageType("png"); + + vtg5W.setSignature(signature); + vtg5W.setReissue(generateReissuer()); + + return vtg5W; + } + + public static VTG5AW getVTG5AW() { + VTG5AW vtg5AW = new VTG5AW(); + vtg5AW.setDocumentName(CertificateTypes.CVS_TRL_PASS_WELSH.getCertificateType()); + CvsMotCertificateDataWelsh vtg5AWData = new CvsMotCertificateDataWelsh(); + vtg5AWData + .setMinorDefectsWelsh(generateRFRs(MINOR_RFR_TEXT, 1)) + .setAdvisoryDefectsWelsh(generateRFRs(ADVISORY_RFR_TEXT, 1)) + .setMinorDefectsHeader(DefectSummaryComponent.MINOR_DEFECTS_HEADER_TEST_WELSH_CVS) + .setAdvisoryDefectsHeader(DefectSummaryComponent.ADVISORIES_HEADER_TEXT_WELSH_CVS) + .setMinorDefects(generateRFRs(MINOR_RFR_TEXT, 1)) + .setAdvisoryDefects(generateRFRs(ADVISORY_RFR_TEXT, 1)) + + .setCountryOfRegistrationCode("GB") + .setRawVin(VIN) + .setDateOfTheTest("12.11.2018") + .setExpiryDate("12.10.2018") + .setTestStationPNumber("P12345") + .setTestStationName("TEST STATION NAME") + .setMake("Aston Martin") + .setModel("DB11") + .setIssuersName("R.DREWNO") + .setTestStationName("POPULAR GARAGES") + .setTestNumber("1806 8140 0628") + .setEarliestDateOfTheNextTest("13.10.2018") + .setTrn("ABC1234") + .setIsTrailer(true); + + vtg5AW.setData(vtg5AWData); + + Signature signature = new Signature(); + signature + .setImageData("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==") + .setImageType("png"); + + vtg5AW.setSignature(signature); + vtg5AW.setReissue(generateReissuer()); + + return vtg5AW; + } + + public static CvsHgvPassBilingual getCvsHgvPassBilingual() { + CvsHgvPassBilingual hgvPassBilingual = new CvsHgvPassBilingual(); + hgvPassBilingual.setDocumentName(CertificateTypes.CVS_HGV_PASS_BILINGUAL.getCertificateType()); + + CvsMotCertificateDataWelsh bilingualData = new CvsMotCertificateDataWelsh(); + bilingualData + .setMinorDefectsWelsh(generateRFRs(MINOR_RFR_TEXT, 1)) + .setAdvisoryDefectsWelsh(generateRFRs(ADVISORY_RFR_TEXT, 1)) + .setMinorDefectsHeader(DefectSummaryComponent.MINOR_DEFECTS_HEADER_TEST_WELSH_CVS) + .setAdvisoryDefectsHeader(DefectSummaryComponent.ADVISORIES_HEADER_TEXT_WELSH_CVS) + .setMinorDefects(generateRFRs(MINOR_RFR_TEXT, 1)) + .setAdvisoryDefects(generateRFRs(ADVISORY_RFR_TEXT, 1)) + + .setCountryOfRegistrationCode("GB") + .setRawVin(VIN) + .setDateOfTheTest("22.08.2023") + .setExpiryDate("31.08.2024") + .setTestStationPNumber("P12345") + .setTestStationName("TEST STATION NAME") + .setMake("MERCEDES") + .setModel("Z WAGON") + .setVehicleEuClassification("M1") + .setRawVrm("KA15APH") + .setCurrentOdometer( + new CvsOdometerReading("20000", "km", "22.08.2023") + ) + .setOdometerHistoryList(Arrays.asList( + new CvsOdometerReading("12000", "km", "13.08.2022"), + new CvsOdometerReading("7000", "km", "02.08.2021") + ) + ) + .setIssuersName("TESTER NAME") + .setTestStationName("TEST STATION NAME") + .setTestNumber("X01X00001") + .setEarliestDateOfTheNextTest("01.07.2024"); + + hgvPassBilingual.setData(bilingualData); + return hgvPassBilingual; + } + + public static CvsPsvPassBilingual getCvsPsvPassBilingual() { + CvsPsvPassBilingual psvPassBilingual = new CvsPsvPassBilingual(); + psvPassBilingual.setDocumentName(CertificateTypes.CVS_PASS_BILINGUAL.getCertificateType()); + + CvsMotCertificateDataWelsh bilingualData = new CvsMotCertificateDataWelsh(); + bilingualData + .setMinorDefectsWelsh(generateRFRs(MINOR_RFR_TEXT, 1)) + .setAdvisoryDefectsWelsh(generateRFRs(ADVISORY_RFR_TEXT, 1)) + .setMinorDefectsHeader(DefectSummaryComponent.MINOR_DEFECTS_HEADER_TEST_WELSH_CVS) + .setAdvisoryDefectsHeader(DefectSummaryComponent.ADVISORIES_HEADER_TEXT_WELSH_CVS) + .setMinorDefects(generateRFRs(MINOR_RFR_TEXT, 1)) + .setAdvisoryDefects(generateRFRs(ADVISORY_RFR_TEXT, 1)) + + .setSeatBeltNumber("10") + .setSeatBeltPreviousCheckDate("12.11.2018") + .setSeatBeltTested("Yes") + + .setCountryOfRegistrationCode("GB") + .setRawVin(VIN) + .setDateOfTheTest("12.11.2018") + .setExpiryDate("12.10.2018") + .setTestStationPNumber("P12345") + .setTestStationName("TEST STATION NAME") + .setMake("Aston Martin") + .setModel("DB11") + .setVehicleEuClassification("M1") + .setRawVrm("KA1SAPH") + .setCurrentOdometer( + new CvsOdometerReading("22341", "mi", "01.02.2019") + ) + .setOdometerHistoryList(Arrays.asList( + new CvsOdometerReading("120", "km", "01.02.2016"), + new CvsOdometerReading("330", "km", "30.01.2017") + )) + .setIssuersName("R.DREWNO") + .setTestStationName("POPULAR GARAGES") + .setTestNumber("1806 8140 0628") + .setEarliestDateOfTheNextTest("13.10.2018"); + + psvPassBilingual.setData(bilingualData); + return psvPassBilingual; + } + + public static CvsTrlPassBilingual getCvsTrlPassBilingual() { + CvsTrlPassBilingual trlPassBilingual = new CvsTrlPassBilingual(); + trlPassBilingual.setDocumentName(CertificateTypes.CVS_TRL_PASS_BILINGUAL.getCertificateType()); + + CvsMotCertificateDataWelsh bilingualData = new CvsMotCertificateDataWelsh(); + bilingualData + .setMinorDefectsWelsh(generateRFRs(MINOR_RFR_TEXT, 1)) + .setAdvisoryDefectsWelsh(generateRFRs(ADVISORY_RFR_TEXT, 1)) + .setMinorDefectsHeader(DefectSummaryComponent.MINOR_DEFECTS_HEADER_TEST_WELSH_CVS) + .setAdvisoryDefectsHeader(DefectSummaryComponent.ADVISORIES_HEADER_TEXT_WELSH_CVS) + .setMinorDefects(generateRFRs(MINOR_RFR_TEXT, 1)) + .setAdvisoryDefects(generateRFRs(ADVISORY_RFR_TEXT, 1)) + + .setCountryOfRegistrationCode("GB") + .setRawVin(VIN) + .setDateOfTheTest("12.11.2018") + .setExpiryDate("12.10.2018") + .setTestStationPNumber("P12345") + .setTestStationName("TEST STATION NAME") + .setMake("Aston Martin") + .setModel("DB11") + .setIssuersName("R.DREWNO") + .setTestStationName("POPULAR GARAGES") + .setTestNumber("1806 8140 0628") + .setEarliestDateOfTheNextTest("13.10.2018") + .setTrn("ABC1234") + .setIsTrailer(true); + + trlPassBilingual.setData(bilingualData); + return trlPassBilingual; + } public static VTG5 getVtg5HavingInvalidXMLCharacter() { VTG5 document = getVtg5(); diff --git a/src/test/java/htmlverification/tests/CvsHgvPassBilingualTest.java b/src/test/java/htmlverification/tests/CvsHgvPassBilingualTest.java new file mode 100644 index 00000000..9d94d6ea --- /dev/null +++ b/src/test/java/htmlverification/tests/CvsHgvPassBilingualTest.java @@ -0,0 +1,179 @@ +package htmlverification.tests; + +import com.github.jknack.handlebars.Handlebars; +import htmlverification.framework.page_object.CertificatePageObject; +import htmlverification.service.CvsCertificateTestDataProvider; +import org.junit.Before; +import org.junit.Test; +import uk.gov.dvsa.model.cvs.CvsHgvPassBilingual; +import uk.gov.dvsa.service.HtmlGenerator; + +import java.io.IOException; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateData.PASS_WITH_DEFECTS_HEADER; +import static uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateDataWelsh.PASS_WITH_DEFECTS_HEADER_WELSH; +import static uk.gov.dvsa.model.mot.results.Summary.EU_NUMBER_SUMMARY_HEADER; + +public class CvsHgvPassBilingualTest { + + protected HtmlGenerator htmlGenerator; + protected CvsHgvPassBilingual testCertificate; + protected CertificatePageObject certificatePageObjectVTG5; + protected CertificatePageObject certificatePageObjectVTG5W; + + public CvsHgvPassBilingualTest() { + this.htmlGenerator = new HtmlGenerator(new Handlebars()); + } + + @Before + public void setup() throws IOException { + testCertificate = CvsCertificateTestDataProvider.getCvsHgvPassBilingual(); + + String certHtmlVTG5 = htmlGenerator.generate(testCertificate).get(0); + String certHtmlVTV5W = htmlGenerator.generate(testCertificate).get(1); + + certificatePageObjectVTG5 = new CertificatePageObject(certHtmlVTG5); + certificatePageObjectVTG5W = new CertificatePageObject(certHtmlVTV5W); + } + + @Test + public void verifyResultSummaries() { + String resultName = certificatePageObjectVTG5.getDefectSummaryComponent().getResultNameItem().text(); + String resultNameWelsh = certificatePageObjectVTG5W.getDefectSummaryComponent().getResultNameItem().text(); + + assertEquals( + String.format("%s%s%s %s", "(", EU_NUMBER_SUMMARY_HEADER, ")", PASS_WITH_DEFECTS_HEADER), + resultName + ); + assertEquals( + String.format("%s%s%s %s", "(", EU_NUMBER_SUMMARY_HEADER, ")", PASS_WITH_DEFECTS_HEADER_WELSH), + resultNameWelsh + ); + } + + @Test + public void verifyVin() { + String vin = certificatePageObjectVTG5.getVin(); + String vin2 = certificatePageObjectVTG5W.getVin(); + + assertEquals(testCertificate.getData().getRawVin(), vin); + assertEquals(testCertificate.getData().getRawVin(), vin2); + } + + @Test + public void verifyCountryOfRegistration() { + String country = certificatePageObjectVTG5.getCountryOfRegistration(); + String country2 = certificatePageObjectVTG5W.getCountryOfRegistration(); + + assertEquals(testCertificate.getData().getCountryOfRegistrationCode(), country); + assertEquals(testCertificate.getData().getCountryOfRegistrationCode(), country2); + } + + @Test + public void verifyMakeAndModel() { + String makeAndModel = certificatePageObjectVTG5.getMakeAndModel(); + String makeAndModel2 = certificatePageObjectVTG5W.getMakeAndModel(); + + assertEquals( + String.format("%s%s %s", testCertificate.getData().getMake(), ",", testCertificate.getData().getModel()), + makeAndModel + ); + assertEquals( + String.format("%s%s %s", testCertificate.getData().getMake(), ",", testCertificate.getData().getModel()), + makeAndModel2 + ); + } + + @Test + public void verifyVehicleCategory() { + String vehicleCategory = certificatePageObjectVTG5.getVehicleCategory(); + String vehicleCategory2 = certificatePageObjectVTG5W.getVehicleCategory(); + + assertEquals(testCertificate.getData().getVehicleEuClassification(), vehicleCategory); + assertEquals(testCertificate.getData().getVehicleEuClassification(), vehicleCategory2); + } + + @Test + public void verifyMileage() { + String mileage = certificatePageObjectVTG5.getMileage(); + String mileage2 = certificatePageObjectVTG5W.getMileage(); + + assertEquals(testCertificate.getData().getFormattedCurrentOdometer(), mileage); + assertEquals("20,000 cilometrau", mileage2); + } + + @Test + public void verifyAdvisories() { + List advisories = certificatePageObjectVTG5.getDefectSummaryComponent().getAdvisories().eachText(); + + assertEquals(1, advisories.size()); + } + + @Test + public void verifyMinorDefects() { + List minorDefects = certificatePageObjectVTG5.getDefectSummaryComponent().getMinorDefects().eachText(); + + assertEquals(1, minorDefects.size()); + } + + @Test + public void verifyAdvisoriesWelsh() { + List advisories = certificatePageObjectVTG5W.getDefectSummaryComponent().getAdvisoriesWelshCVS().eachText(); + + assertEquals(1, advisories.size()); + } + + @Test + public void verifyMinorDefectsWelsh() { + List minorDefects = certificatePageObjectVTG5W.getDefectSummaryComponent().getMinorDefectsWelshCVS().eachText(); + + assertEquals(1, minorDefects.size()); + } + + @Test + public void verifyDateOfTheTest() { + String dateOfTheTest = certificatePageObjectVTG5.getDateOfTheTest(); + String dateOfTheTest2 = certificatePageObjectVTG5W.getDateOfTheTest(); + + assertEquals("22.08.2023", dateOfTheTest); + assertEquals("22.08.2023", dateOfTheTest2); + } + + @Test + public void verifyLocationOfTheTest() { + String location = certificatePageObjectVTG5.getLocationOfTheTest(); + String location2 = certificatePageObjectVTG5W.getLocationOfTheTest(); + + assertEquals("P12345, TEST STATION NAME", location); + assertEquals("P12345, TEST STATION NAME", location2); + } + + @Test + public void verifyTestingOrganisationAndInspectorsName() { + String text = certificatePageObjectVTG5.getTestingOrganisationAndInspectorsName(); + String text2 = certificatePageObjectVTG5W.getTestingOrganisationAndInspectorsName(); + + assertEquals("DRIVER AND VEHICLE STANDARDS AGENCY TESTER NAME", text); + assertEquals("ASIANTAETH SAFONAU GYRWYR A CHERBYDAU TESTER NAME", text2); + } + + @Test + public void verifyMotTestNumber() { + String testNumber = certificatePageObjectVTG5.getTestNumber(); + String testNumber2 = certificatePageObjectVTG5W.getTestNumber(); + + assertEquals("X01X00001", testNumber); + assertEquals("X01X00001", testNumber2); + } + + @Test + public void verifyExpiryDateOnPassIsPresent() { + String expiryDate = certificatePageObjectVTG5.getExpiryDate(); + String expiryDate2 = certificatePageObjectVTG5W.getExpiryDate(); + + assertEquals("31.08.2024", expiryDate); + assertEquals("31.08.2024", expiryDate2); + } +} diff --git a/src/test/java/htmlverification/tests/CvsPsvPassBilingualTest.java b/src/test/java/htmlverification/tests/CvsPsvPassBilingualTest.java new file mode 100644 index 00000000..743a4a95 --- /dev/null +++ b/src/test/java/htmlverification/tests/CvsPsvPassBilingualTest.java @@ -0,0 +1,166 @@ +package htmlverification.tests; + +import com.github.jknack.handlebars.Handlebars; +import htmlverification.framework.page_object.CertificatePageObject; +import htmlverification.service.CvsCertificateTestDataProvider; +import org.junit.Before; +import org.junit.Test; +import uk.gov.dvsa.model.cvs.CvsPsvPassBilingual; +import uk.gov.dvsa.service.HtmlGenerator; + +import static org.junit.Assert.assertEquals; +import static uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateData.PASS_WITH_DEFECTS_HEADER; +import static uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateDataWelsh.PASS_WITH_DEFECTS_HEADER_WELSH; +import static uk.gov.dvsa.model.mot.results.Summary.EU_NUMBER_SUMMARY_HEADER; + +import java.io.IOException; +import java.util.List; + +public class CvsPsvPassBilingualTest { + + protected HtmlGenerator htmlGenerator; + protected CvsPsvPassBilingual testCertificate; + protected CertificatePageObject certificatePageObjectVTP20; + protected CertificatePageObject certificatePageObjectVTP20W; + + public CvsPsvPassBilingualTest() { + this.htmlGenerator = new HtmlGenerator(new Handlebars()); + } + + @Before + public void setup() throws IOException { + testCertificate = CvsCertificateTestDataProvider.getCvsPsvPassBilingual(); + + String certHtmlVTP20 = htmlGenerator.generate(testCertificate).get(0); + String certHtmlVTP20W = htmlGenerator.generate(testCertificate).get(1); + + certificatePageObjectVTP20 = new CertificatePageObject(certHtmlVTP20); + certificatePageObjectVTP20W = new CertificatePageObject(certHtmlVTP20W); + } + + @Test + public void verifyResultSummaries() { + String resultName = certificatePageObjectVTP20.getDefectSummaryComponent().getResultNameItem().text(); + String resultNameWelsh = certificatePageObjectVTP20W.getDefectSummaryComponent().getResultNameItem().text(); + + assertEquals( + String.format("%s%s%s %s", "(", EU_NUMBER_SUMMARY_HEADER, ")", PASS_WITH_DEFECTS_HEADER), + resultName + ); + assertEquals( + String.format("%s%s%s %s", "(", EU_NUMBER_SUMMARY_HEADER, ")", PASS_WITH_DEFECTS_HEADER_WELSH), + resultNameWelsh + ); + } + + @Test + public void verifyCountryOfRegistration() { + String country = certificatePageObjectVTP20.getCountryOfRegistration(); + String country2 = certificatePageObjectVTP20W.getCountryOfRegistration(); + + assertEquals(testCertificate.getData().getCountryOfRegistrationCode(), country); + assertEquals(testCertificate.getData().getCountryOfRegistrationCode(), country2); + } + + @Test + public void verifyMakeAndModel() { + String makeAndModel = certificatePageObjectVTP20.getMakeAndModel(); + String makeAndModel2 = certificatePageObjectVTP20W.getMakeAndModel(); + + assertEquals( + String.format("%s%s %s", testCertificate.getData().getMake(), ",", testCertificate.getData().getModel()), + makeAndModel + ); + assertEquals( + String.format("%s%s %s", testCertificate.getData().getMake(), ",", testCertificate.getData().getModel()), + makeAndModel2 + ); + } + + @Test + public void verifyVehicleCategory() { + String vehicleCategory = certificatePageObjectVTP20.getVehicleCategory(); + String vehicleCategory2 = certificatePageObjectVTP20W.getVehicleCategory(); + + assertEquals(testCertificate.getData().getVehicleEuClassification(), vehicleCategory); + assertEquals(testCertificate.getData().getVehicleEuClassification(), vehicleCategory2); + } + + @Test + public void verifyMileage() { + String mileage = certificatePageObjectVTP20.getMileage(); + String mileage2 = certificatePageObjectVTP20W.getMileage(); + + assertEquals(testCertificate.getData().getFormattedCurrentOdometer(), mileage); +// assertEquals(testCertificate.getData().getFormattedCurrentOdometer(), mileage2); + } + + @Test + public void verifyAdvisoryDefects() { + List advisoryDefects = certificatePageObjectVTP20.getDefectSummaryComponent().getAdvisories().eachText(); + assertEquals(1, advisoryDefects.size()); + } + + @Test + public void verifyMinorDefects() { + List minorDefects = certificatePageObjectVTP20.getDefectSummaryComponent().getMinorDefects().eachText(); + assertEquals(1, minorDefects.size()); + } + + @Test + public void verifyAdvisoryDefectsWelsh() { + List advisoryDefects = certificatePageObjectVTP20W.getDefectSummaryComponent().getAdvisoriesWelshCVS().eachText(); + assertEquals(1, advisoryDefects.size()); + } + + @Test + public void verifyMinorDefectsWelsh() { + List minorDefects = certificatePageObjectVTP20W.getDefectSummaryComponent().getMinorDefectsWelshCVS().eachText(); + assertEquals(1, minorDefects.size()); + } + + @Test + public void verifyDateOfTheTest() { + String dateOfTheTest = certificatePageObjectVTP20.getDateOfTheTest(); + String dateOfTheTest2 = certificatePageObjectVTP20W.getDateOfTheTest(); + + assertEquals("12.11.2018", dateOfTheTest); + assertEquals("12.11.2018", dateOfTheTest2); + } + + @Test + public void verifyLocationOfTheTest() { + String location = certificatePageObjectVTP20.getLocationOfTheTest(); + String location2 = certificatePageObjectVTP20W.getLocationOfTheTest(); + + assertEquals("P12345, POPULAR GARAGES", location); + assertEquals("P12345, POPULAR GARAGES", location2); + } + + @Test + public void verifyTestingOrganisationAndInspectorsName() { + String text = certificatePageObjectVTP20.getTestingOrganisationAndInspectorsName(); + String text2 = certificatePageObjectVTP20W.getTestingOrganisationAndInspectorsName(); + + assertEquals("DRIVER AND VEHICLE STANDARDS AGENCY R.DREWNO", text); + assertEquals("ASIANTAETH SAFONAU GYRWYR A CHERBYDAU R.DREWNO", text2); + } + + @Test + public void verifyMotTestNumber() { + String testNumber = certificatePageObjectVTP20.getTestNumber(); + String testNumber2 = certificatePageObjectVTP20W.getTestNumber(); + + assertEquals("1806 8140 0628", testNumber); + assertEquals("1806 8140 0628", testNumber2); + } + + @Test + public void verifyExpiryDateOnPassIsPresent() { + String expiryDate = certificatePageObjectVTP20.getExpiryDate(); + String expiryDate2 = certificatePageObjectVTP20W.getExpiryDate(); + + assertEquals("12.10.2018", expiryDate); + assertEquals("12.10.2018", expiryDate2); + } +} diff --git a/src/test/java/htmlverification/tests/CvsTrlPassBilingualTest.java b/src/test/java/htmlverification/tests/CvsTrlPassBilingualTest.java new file mode 100644 index 00000000..56a4f2ea --- /dev/null +++ b/src/test/java/htmlverification/tests/CvsTrlPassBilingualTest.java @@ -0,0 +1,155 @@ +package htmlverification.tests; + +import com.github.jknack.handlebars.Handlebars; +import htmlverification.framework.page_object.CertificatePageObject; +import htmlverification.service.CvsCertificateTestDataProvider; +import org.junit.Before; +import org.junit.Test; +import uk.gov.dvsa.model.cvs.CvsTrlPassBilingual; +import uk.gov.dvsa.service.HtmlGenerator; + +import static org.junit.Assert.assertEquals; +import static uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateData.PASS_WITH_DEFECTS_HEADER; +import static uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateDataWelsh.PASS_WITH_DEFECTS_HEADER_WELSH; +import static uk.gov.dvsa.model.mot.results.Summary.EU_NUMBER_SUMMARY_HEADER; + +import java.io.IOException; +import java.util.List; + +public class CvsTrlPassBilingualTest { + + protected HtmlGenerator htmlGenerator; + protected CvsTrlPassBilingual testCertificate; + protected CertificatePageObject certificatePageObjectVTG5A; + protected CertificatePageObject certificatePageObjectVTG5AW; + + public CvsTrlPassBilingualTest() { + this.htmlGenerator = new HtmlGenerator(new Handlebars()); + } + + @Before + public void setup() throws IOException { + testCertificate = CvsCertificateTestDataProvider.getCvsTrlPassBilingual(); + + String certHtmlVTG5A = htmlGenerator.generate(testCertificate).get(0); + String certHtmlVTG5AW = htmlGenerator.generate(testCertificate).get(1); + + certificatePageObjectVTG5A = new CertificatePageObject(certHtmlVTG5A); + certificatePageObjectVTG5AW = new CertificatePageObject(certHtmlVTG5AW); + } + + @Test + public void verifyResultSummaries() { + String resultName = certificatePageObjectVTG5A.getDefectSummaryComponent().getResultNameItem().text(); + String resultNameWelsh = certificatePageObjectVTG5AW.getDefectSummaryComponent().getResultNameItem().text(); + + assertEquals( + String.format("%s%s%s %s", "(", EU_NUMBER_SUMMARY_HEADER, ")", PASS_WITH_DEFECTS_HEADER), + resultName); + assertEquals( + String.format("%s%s%s %s", "(", EU_NUMBER_SUMMARY_HEADER, ")", PASS_WITH_DEFECTS_HEADER_WELSH), + resultNameWelsh); + } + + @Test + public void verifyCountryOfRegistration() { + String country = certificatePageObjectVTG5A.getCountryOfRegistration(); + String country2 = certificatePageObjectVTG5AW.getCountryOfRegistration(); + + assertEquals(testCertificate.getData().getCountryOfRegistrationCode(), country); + assertEquals(testCertificate.getData().getCountryOfRegistrationCode(), country2); + } + + @Test + public void verifyMakeAndModel() { + String makeAndModel = certificatePageObjectVTG5A.getMakeAndModel(); + String makeAndModel2 = certificatePageObjectVTG5AW.getMakeAndModel(); + + assertEquals( + String.format("%s%s %s", testCertificate.getData().getMake(), ",", testCertificate.getData().getModel()), + makeAndModel + ); + assertEquals( + String.format("%s%s %s", testCertificate.getData().getMake(), ",", testCertificate.getData().getModel()), + makeAndModel2 + ); + } + +// @Test +// public void verifyVehicleCategory() { +// String vehicleCategory = certificatePageObjectVTG5A.getVehicleCategory(); +// String vehicleCategory2 = certificatePageObjectVTG5AW.getVehicleCategory(); +// +// assertEquals(testCertificate.getData().getVehicleEuClassification(), vehicleCategory); +// assertEquals(testCertificate.getData().getVehicleEuClassification(), vehicleCategory2); +// } + + @Test + public void verifyAdvisoryDefects() { + List advisoryDefects = certificatePageObjectVTG5A.getDefectSummaryComponent().getAdvisories().eachText(); + assertEquals(1, advisoryDefects.size()); + } + + @Test + public void verifyMinorDefects() { + List minorDefects = certificatePageObjectVTG5A.getDefectSummaryComponent().getMinorDefects().eachText(); + assertEquals(1, minorDefects.size()); + } + + @Test + public void verifyAdvisoryDefectsWelsh() { + List advisoryDefects = certificatePageObjectVTG5AW.getDefectSummaryComponent().getAdvisoriesWelshCVS().eachText(); + assertEquals(1, advisoryDefects.size()); + } + + @Test + public void verifyMinorDefectsWelsh() { + List minorDefects = certificatePageObjectVTG5AW.getDefectSummaryComponent().getMinorDefectsWelshCVS().eachText(); + assertEquals(1, minorDefects.size()); + } + + @Test + public void verifyDateOfTheTest() { + String dateOfTheTest = certificatePageObjectVTG5A.getDateOfTheTest(); + String dateOfTheTest2 = certificatePageObjectVTG5AW.getDateOfTheTest(); + + assertEquals("12.11.2018", dateOfTheTest); + assertEquals("12.11.2018", dateOfTheTest2); + } + + @Test + public void verifyLocationOfTheTest() { + String location = certificatePageObjectVTG5A.getLocationOfTheTest(); + String location2 = certificatePageObjectVTG5AW.getLocationOfTheTest(); + + assertEquals("P12345, POPULAR GARAGES", location); + assertEquals("P12345, POPULAR GARAGES", location2); + } + + @Test + public void verifyTestingOrganisationAndInspectorsName() { + String text = certificatePageObjectVTG5A.getTestingOrganisationAndInspectorsName(); + String text2 = certificatePageObjectVTG5AW.getTestingOrganisationAndInspectorsName(); + + assertEquals("DRIVER AND VEHICLE STANDARDS AGENCY R.DREWNO", text); + assertEquals("ASIANTAETH SAFONAU GYRWYR A CHERBYDAU R.DREWNO", text2); + } + + @Test + public void verifyMotTestNumber() { + String testNumber = certificatePageObjectVTG5A.getTestNumber(); + String testNumber2 = certificatePageObjectVTG5AW.getTestNumber(); + + assertEquals("1806 8140 0628", testNumber); + assertEquals("1806 8140 0628", testNumber2); + } + + @Test + public void verifyExpiryDateOnPassIsPresent() { + String expiryDate = certificatePageObjectVTG5A.getExpiryDate(); + String expiryDate2 = certificatePageObjectVTG5AW.getExpiryDate(); + + assertEquals("12.10.2018", expiryDate); + assertEquals("12.10.2018", expiryDate2); + } +} diff --git a/src/test/java/htmlverification/tests/VTG5AWTest.java b/src/test/java/htmlverification/tests/VTG5AWTest.java new file mode 100644 index 00000000..95172f5b --- /dev/null +++ b/src/test/java/htmlverification/tests/VTG5AWTest.java @@ -0,0 +1,113 @@ +package htmlverification.tests; + +import com.github.jknack.handlebars.Handlebars; +import htmlverification.framework.page_object.CertificatePageObject; +import htmlverification.service.CvsCertificateTestDataProvider; +import org.junit.Before; +import org.junit.Test; +import uk.gov.dvsa.model.cvs.VTG5AW; +import uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateDataWelsh; +import uk.gov.dvsa.service.HtmlGenerator; + +import java.io.IOException; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateDataWelsh.TESTING_ORGANISATION_WELSH; +import static uk.gov.dvsa.model.mot.results.Summary.EU_NUMBER_SUMMARY_HEADER; + +public class VTG5AWTest { + + protected HtmlGenerator htmlGenerator; + protected VTG5AW vtg5AW; + protected CertificatePageObject certificatePageObject; + + public VTG5AWTest() { + this.htmlGenerator = new HtmlGenerator(new Handlebars()); + } + + @Before + public void setup() throws IOException { + vtg5AW = CvsCertificateTestDataProvider.getVTG5AW(); + String certHtml = htmlGenerator.generate(vtg5AW).get(0); + certificatePageObject = new CertificatePageObject(certHtml); + } + + @Test + public void verifyResultsSummary() { + String resultName = certificatePageObject.getDefectSummaryComponent().getResultNameItem().text(); + assertEquals( + String.format("%s%s%s %s", "(", EU_NUMBER_SUMMARY_HEADER, ")", CvsMotCertificateDataWelsh.PASS_WITH_DEFECTS_HEADER_WELSH), + resultName + ); + } + + @Test + public void verifyVin() { + String vin = certificatePageObject.getVin(); + assertEquals(vtg5AW.getData().getRawVin(), vin); + } + + @Test + public void verifyCountryOfRegistration() { + String countryOfRegistration = certificatePageObject.getCountryOfRegistration(); + assertEquals(vtg5AW.getData().getCountryOfRegistrationCode(), countryOfRegistration); + } + + @Test + public void verifyAdvisoryDefects() { + List advisoryDefects = certificatePageObject.getDefectSummaryComponent().getAdvisoriesWelshCVS().eachText(); + assertEquals(1, advisoryDefects.size()); + } + + @Test + public void verifyMinorDefects() { + List minorDefects = certificatePageObject.getDefectSummaryComponent().getMinorDefectsWelshCVS().eachText(); + assertEquals(1, minorDefects.size()); + } + + @Test + public void verifyDateOfTheTest() { + String dateOfTheTest = certificatePageObject.getDateOfTheTest(); + assertEquals(vtg5AW.getData().getDateOfTheTest(), dateOfTheTest); + } + + @Test + public void verifyExpiryDate() { + String expiryDate = certificatePageObject.getExpiryDate(); + assertEquals(vtg5AW.getData().getExpiryDate(), expiryDate); + } + + @Test + public void verifyLocationOfTheTest() { + String locationOfTheTest = certificatePageObject.getLocationOfTheTest(); + assertEquals(vtg5AW.getData().getLocationOfTheTest(), locationOfTheTest); + } + + @Test + public void verifyTestingOrganisationAndInspectorsName() { + String orgAndName = certificatePageObject.getTestingOrganisationAndInspectorsName(); + assertEquals( + String.format("%s %s", + TESTING_ORGANISATION_WELSH, + vtg5AW.getData().getIssuersName()), + orgAndName + ); + } + @Test + public void verifyTestNumber() { + String testNumber = certificatePageObject.getTestNumber(); + assertEquals(vtg5AW.getData().getTestNumber(), testNumber); + } + @Test + public void verifyEarliestDateOfTheNextTest() { + String earliestDateOfNextTest = certificatePageObject.getEarliestDateOfTheNextTest(); + assertEquals(vtg5AW.getData().getEarliestDateOfTheNextTest(), earliestDateOfNextTest); + } + + @Test + public void verifyTrailerNumber() { + String trlNo = certificatePageObject.getTrn(); + assertEquals(vtg5AW.getData().getTrn(), trlNo); + } +} diff --git a/src/test/java/htmlverification/tests/VTG5Test.java b/src/test/java/htmlverification/tests/VTG5Test.java new file mode 100644 index 00000000..f759518d --- /dev/null +++ b/src/test/java/htmlverification/tests/VTG5Test.java @@ -0,0 +1,126 @@ +package htmlverification.tests; + +import com.github.jknack.handlebars.Handlebars; +import htmlverification.framework.page_object.CertificatePageObject; +import htmlverification.service.CvsCertificateTestDataProvider; +import org.junit.Before; +import org.junit.Test; +import uk.gov.dvsa.model.cvs.VTG5; +import uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateDataWelsh; +import uk.gov.dvsa.service.HtmlGenerator; + +import java.io.IOException; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static uk.gov.dvsa.model.mot.results.Summary.EU_NUMBER_SUMMARY_HEADER; + +public class VTG5Test { + + protected HtmlGenerator htmlGenerator; + protected VTG5 vtg5; + protected CertificatePageObject certificatePageObject; + + public VTG5Test() { + this.htmlGenerator = new HtmlGenerator(new Handlebars()); + } + + @Before + public void setup() throws IOException { + vtg5 = CvsCertificateTestDataProvider.getVtg5(); + String certHtml = htmlGenerator.generate(vtg5).get(0); + certificatePageObject = new CertificatePageObject(certHtml); + } + + @Test + public void verifyResultsSummary() { + String resultName = certificatePageObject.getDefectSummaryComponent().getResultNameItem().text(); + assertEquals( + String.format("%s%s%s %s", "(", EU_NUMBER_SUMMARY_HEADER, ")", CvsMotCertificateDataWelsh.PASS_WITH_DEFECTS_HEADER), + resultName + ); + } + + @Test + public void verifyVin() { + String vin = certificatePageObject.getVin(); + assertEquals(vtg5.getData().getRawVin(), vin); + } + + @Test + public void verifyRegistrationNumber() { + String vrm = certificatePageObject.getRegistrationNumber(); + assertEquals(vtg5.getData().getRawVrm(), vrm); + } + + @Test + public void verifyCountryOfRegistration() { + String countryOfRegistration = certificatePageObject.getCountryOfRegistration(); + assertEquals(vtg5.getData().getCountryOfRegistrationCode(), countryOfRegistration); + } + + @Test + public void verifyVehicleEuClassification() { + String vehicleEuClassification = certificatePageObject.getVehicleCategory(); + assertEquals(vtg5.getData().getVehicleEuClassification(), vehicleEuClassification); + } + + @Test + public void verifyMileage() { + String value = certificatePageObject.getMileage(); + assertEquals(vtg5.getData().getFormattedCurrentOdometer(), value); + } + + @Test + public void verifyOdometerHistoryCount() { + List list = List.of(certificatePageObject.getMileageHistoryComponent().getEntries().toArray()); + assertEquals(2, list.size()); + } + + @Test + public void verifyAdvisories() { + List advisoryDefects = certificatePageObject.getDefectSummaryComponent().getAdvisories().eachText(); + assertEquals(vtg5.getData().getAdvisoryDefects().size(), advisoryDefects.size()); + } + + @Test + public void verifyMinorDefect() { + List minorDefects = certificatePageObject.getDefectSummaryComponent().getMinorDefects().eachText(); + assertEquals(vtg5.getData().getMinorDefects().size(), minorDefects.size()); + } + + @Test + public void verifyDateOfTheTest() { + String dateOfTheTest = certificatePageObject.getDateOfTheTest(); + assertEquals(vtg5.getData().getDateOfTheTest(), dateOfTheTest); + } + + @Test + public void verifyExpiryDate() { + String expiryDate = certificatePageObject.getExpiryDate(); + assertEquals(vtg5.getData().getExpiryDate(), expiryDate); + } + + @Test + public void verifyLocationOfTheTest() { + String locationOfTheTest = certificatePageObject.getLocationOfTheTest(); + assertEquals(vtg5.getData().getLocationOfTheTest(), locationOfTheTest); + } + + @Test + public void verifyTestingOrganisationAndInspectorsName() { + String orgAndName = certificatePageObject.getTestingOrganisationAndInspectorsName(); + assertEquals( + String.format("%s %s", + vtg5.getData().getTestingOrganisation(), + vtg5.getData().getIssuersName()), + orgAndName + ); + } + + @Test + public void verifyMotTestNumber() { + String testNumber = certificatePageObject.getTestNumber(); + assertEquals(vtg5.getData().getTestNumber(), testNumber); + } +} diff --git a/src/test/java/htmlverification/tests/VTG5WTest.java b/src/test/java/htmlverification/tests/VTG5WTest.java new file mode 100644 index 00000000..abc4dbb0 --- /dev/null +++ b/src/test/java/htmlverification/tests/VTG5WTest.java @@ -0,0 +1,135 @@ +package htmlverification.tests; + +import com.github.jknack.handlebars.Handlebars; +import htmlverification.framework.page_object.CertificatePageObject; +import htmlverification.service.CvsCertificateTestDataProvider; +import org.junit.Before; +import org.junit.Test; +import uk.gov.dvsa.model.cvs.VTG5W; +import uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateDataWelsh; +import uk.gov.dvsa.service.HtmlGenerator; + +import java.io.IOException; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateDataWelsh.TESTING_ORGANISATION_WELSH; +import static uk.gov.dvsa.model.mot.results.Summary.EU_NUMBER_SUMMARY_HEADER; +import static uk.gov.dvsa.view.cvs.CvsOdometerReadingFormatter.MILES_WELSH; + +public class VTG5WTest { + + protected HtmlGenerator htmlGenerator; + protected VTG5W vtg5W; + protected CertificatePageObject certificatePageObject; + + public VTG5WTest() { + this.htmlGenerator = new HtmlGenerator(new Handlebars()); + } + + @Before + public void setup() throws IOException { + vtg5W = CvsCertificateTestDataProvider.getVTG5W(); + String certHtml = htmlGenerator.generate(vtg5W).get(0); + certificatePageObject = new CertificatePageObject(certHtml); + } + + @Test + public void verifyResultsSummary() { + String resultName = certificatePageObject.getDefectSummaryComponent().getResultNameItem().text(); + assertEquals( + String.format("%s%s%s %s", "(", EU_NUMBER_SUMMARY_HEADER, ")", CvsMotCertificateDataWelsh.PASS_WITH_DEFECTS_HEADER_WELSH), + resultName + ); + } + + @Test + public void verifyVin() { + String vin = certificatePageObject.getVin(); + assertEquals(vtg5W.getData().getRawVin(), vin); + } + + @Test + public void verifyRegistrationNumber() { + String vrm = certificatePageObject.getRegistrationNumber(); + assertEquals(vtg5W.getData().getRawVrm(), vrm); + } + + @Test + public void verifyCountryOfRegistration() { + String countryOfRegistration = certificatePageObject.getCountryOfRegistration(); + assertEquals(vtg5W.getData().getCountryOfRegistrationCode(), countryOfRegistration); + } + + @Test + public void verifyVehicleEuClassification() { + String vehicleEuClassification = certificatePageObject.getVehicleCategory(); + assertEquals(vtg5W.getData().getVehicleEuClassification(), vehicleEuClassification); + } + + @Test + public void verifyMileage() { + String value = certificatePageObject.getMileage(); + assertEquals("20,000 " + MILES_WELSH, value); + } + + @Test + public void verifyOdomoterHistory() { + String actual = certificatePageObject.getElement("#mileage-history").text(); + String expected = "12,000 milltiroedd 13.08.2022 7,000 milltiroedd 02.08.2021"; + assertEquals(expected, actual); + } + + @Test + public void verifyOdometerHistoryCount() { + List list = List.of(certificatePageObject.getMileageHistoryComponent().getEntries().toArray()); + assertEquals(2, list.size()); + } + + @Test + public void verifyAdvisories() { + List advisoryDefects = certificatePageObject.getDefectSummaryComponent().getAdvisoriesWelshCVS().eachText(); + assertEquals(1, advisoryDefects.size()); + } + + @Test + public void verifyMinorDefects() { + List minorDefects = certificatePageObject.getDefectSummaryComponent().getMinorDefectsWelshCVS().eachText(); + assertEquals(1, minorDefects.size()); + } + + @Test + public void verifyDateOfTheTest() { + String dateOfTheTest = certificatePageObject.getDateOfTheTest(); + assertEquals(vtg5W.getData().getDateOfTheTest(), dateOfTheTest); + } + + @Test + public void verifyExpiryDate() { + String expiryDate = certificatePageObject.getExpiryDate(); + assertEquals(vtg5W.getData().getExpiryDate(), expiryDate); + } + + @Test + public void verifyLocationOfTheTest() { + String locationOfTheTest = certificatePageObject.getLocationOfTheTest(); + assertEquals(vtg5W.getData().getLocationOfTheTest(), locationOfTheTest); + } + + @Test + public void verifyTestingOrganisationAndInspectorsName() { + String orgAndName = certificatePageObject.getTestingOrganisationAndInspectorsName(); + assertEquals( + String.format("%s %s", + TESTING_ORGANISATION_WELSH, + vtg5W.getData().getIssuersName()), + orgAndName + ); + } + + @Test + public void verifyMotTestNumber() { + String testNumber = certificatePageObject.getTestNumber(); + assertEquals(vtg5W.getData().getTestNumber(), testNumber); + } +} diff --git a/src/test/java/htmlverification/tests/VTP20Test.java b/src/test/java/htmlverification/tests/VTP20Test.java index 369895e1..05921402 100644 --- a/src/test/java/htmlverification/tests/VTP20Test.java +++ b/src/test/java/htmlverification/tests/VTP20Test.java @@ -176,7 +176,7 @@ public void verifyCurrentOdomoter() { @Test public void verifyOdomoterHistory() { String actual = certificatePageObject.getElement("#mileage-history").text(); - String expected = "120 km 01.02.2016 330 km 30.01.2017"; + String expected = "120 kilometres 01.02.2016 330 kilometres 30.01.2017"; assertEquals(expected, actual); } diff --git a/src/test/java/htmlverification/tests/VTP20WTest.java b/src/test/java/htmlverification/tests/VTP20WTest.java new file mode 100644 index 00000000..93f20e46 --- /dev/null +++ b/src/test/java/htmlverification/tests/VTP20WTest.java @@ -0,0 +1,158 @@ +package htmlverification.tests; + +import com.github.jknack.handlebars.Handlebars; +import htmlverification.framework.page_object.CertificatePageObject; +import htmlverification.service.CvsCertificateTestDataProvider; +import org.junit.Before; +import org.junit.Test; +import uk.gov.dvsa.model.cvs.VTP20W; +import uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateDataWelsh; +import uk.gov.dvsa.service.HtmlGenerator; + +import static org.junit.Assert.assertEquals; +import static uk.gov.dvsa.model.mot.results.Summary.EU_NUMBER_SUMMARY_HEADER; + +import java.io.IOException; +import java.util.List; + +public class VTP20WTest { + + protected HtmlGenerator htmlGenerator; + protected VTP20W vtp20W; + protected CertificatePageObject certificatePageObject; + + public VTP20WTest() { + this.htmlGenerator = new HtmlGenerator(new Handlebars()); + } + + @Before + public void setup() throws IOException { + vtp20W = CvsCertificateTestDataProvider.getVtp20W(); + String certHtml = htmlGenerator.generate(vtp20W).get(0); + certificatePageObject = new CertificatePageObject(certHtml); + } + + @Test + public void verifyResultSummary() { + String resultName = certificatePageObject.getDefectSummaryComponent().getResultNameItem().text(); + assertEquals( + String.format("(%s) %s", EU_NUMBER_SUMMARY_HEADER, CvsMotCertificateDataWelsh.PASS_WITH_DEFECTS_HEADER_WELSH), + resultName + ); + } + + @Test + public void verifyVin() { + String vin = certificatePageObject.getVin(); + assertEquals(vtp20W.getData().getRawVin(), vin); + } + + @Test + public void verifyCountryOfRegistration() { + String country = certificatePageObject.getCountryOfRegistration(); + assertEquals(vtp20W.getData().getCountryOfRegistrationCode(), country); + } + + @Test + public void verifyMakeAndModel() { + String makeAndModel = certificatePageObject.getMakeAndModel(); + assertEquals( + String.format("%s, %s", vtp20W.getData().getMake(), vtp20W.getData().getModel()), + makeAndModel + ); + } + + @Test + public void verifyVehicleCategory() { + String vehicleCategory = certificatePageObject.getVehicleCategory(); + assertEquals(vtp20W.getData().getVehicleEuClassification(), vehicleCategory); + } + + @Test + public void verifyAdvisories() { + List advisoryDefects = certificatePageObject.getDefectSummaryComponent().getAdvisoriesWelshCVS().eachText(); + assertEquals(1, advisoryDefects.size()); + } + + @Test + public void verifyMinorDefects() { + List minorDefects = certificatePageObject.getDefectSummaryComponent().getMinorDefectsWelshCVS().eachText(); + assertEquals(1, minorDefects.size()); + } + + @Test + public void verifyDateOfTheTest() { + String dateOfTheTest = certificatePageObject.getDateOfTheTest(); + assertEquals("12.11.2018", dateOfTheTest); + } + + @Test + public void verifyExpiryDate() { + String expiryDate = certificatePageObject.getExpiryDate(); + assertEquals("12.10.2018", expiryDate); + } + + @Test + public void verifyLocationOfTheTest() { + String location = certificatePageObject.getLocationOfTheTest(); + assertEquals("P12345, POPULAR GARAGES", location); + } + + @Test + public void verifyTestingOrganisationAndInspectorsName() { + String text = certificatePageObject.getTestingOrganisationAndInspectorsName(); + assertEquals("ASIANTAETH SAFONAU GYRWYR A CHERBYDAU R.DREWNO", text); + } + + @Test + public void verifyMotTestNumber() { + String testNumber = certificatePageObject.getTestNumber(); + assertEquals("1806 8140 0628", testNumber); + } + + @Test + public void verifySignature() { + String signatureElement = certificatePageObject.getSignatureImageSrc(); + String expected = vtp20W.getSignature().getFormattedImageData(); + + assertEquals(expected, signatureElement); + } + + @Test + public void verifyTitle() { + String titleText = certificatePageObject.getElement(".header__title").text(); + String expected = "Tystysgrif prawf MOT (" + vtp20W.getTestType() + ")"; + assertEquals(expected, titleText); + } + + @Test + public void verifyCurrentOdomoter() { + String actual = certificatePageObject.getElement("#mileage").text(); + String expected = "22,341 milltiroedd"; + assertEquals(expected, actual); + } + + @Test + public void verifyOdomoterHistory() { + String actual = certificatePageObject.getElement("#mileage-history").text(); + String expected = "120 milltiroedd 01.02.2016 330 milltiroedd 30.01.2017"; + assertEquals(expected, actual); + } + + @Test + public void verifyOdometerHistoryCount() { + List list = List.of(certificatePageObject.getMileageHistoryComponent().getEntries().toArray()); + assertEquals(2, list.size()); + } + + @Test + public void verifyOdometerHistoryMessageWhenNoHistoryExists() { + vtp20W = CvsCertificateTestDataProvider.getVtp20wWithNoOdometerHistory(); + String certHtml = htmlGenerator.generate(vtp20W).get(0); + certificatePageObject = new CertificatePageObject(certHtml); + + String actual = certificatePageObject.getElement("#no_data_message").text(); + String expected = "Dim data ar gael"; + assertEquals(expected, actual); + } +} diff --git a/src/test/java/uk/gov/dvsa/view/cvs/CvsOdometerReadingFormatterTest.java b/src/test/java/uk/gov/dvsa/view/cvs/CvsOdometerReadingFormatterTest.java index ef884aae..c17b9d3c 100644 --- a/src/test/java/uk/gov/dvsa/view/cvs/CvsOdometerReadingFormatterTest.java +++ b/src/test/java/uk/gov/dvsa/view/cvs/CvsOdometerReadingFormatterTest.java @@ -26,7 +26,7 @@ public class CvsOdometerReadingFormatterTest { { "format in kilometers", new CvsOdometerReading("15012", "km", "01.12.2017"), - "15,012 km" + "15,012 kilometres" }, { "format without unit",