diff --git a/src/main/java/ch/admin/bag/covidcertificate/service/document/CovidPdfCertificateGenerationService.java b/src/main/java/ch/admin/bag/covidcertificate/service/document/CovidPdfCertificateGenerationService.java index 28ee95b4..6359040b 100644 --- a/src/main/java/ch/admin/bag/covidcertificate/service/document/CovidPdfCertificateGenerationService.java +++ b/src/main/java/ch/admin/bag/covidcertificate/service/document/CovidPdfCertificateGenerationService.java @@ -54,6 +54,8 @@ public class CovidPdfCertificateGenerationService { private final Font font8English; + private final Font font7English; + private final Font fontHeaderRed; private final Font fontHeaderBlack; @@ -90,6 +92,7 @@ public CovidPdfCertificateGenerationService(ConfigurableEnvironment env) throws fontRowBold = new Font(baseFontBold, 10, Font.NORMAL, BaseColor.BLACK); fontEnglish = new Font(baseFontItalic, 9, Font.NORMAL, BaseColor.BLACK); font8English = new Font(baseFontItalic, 8, Font.NORMAL, BaseColor.BLACK); + font7English = new Font(baseFontItalic, 7, Font.NORMAL, BaseColor.BLACK); fontHeaderRed = new Font(baseFont, 26, Font.NORMAL, new BaseColor(220, 0, 24)); fontHeaderBlack = new Font(baseFontItalic, 16, Font.NORMAL, BaseColor.BLACK); @@ -186,7 +189,7 @@ private PdfPTable headerTable(Locale locale) { cell.setPaddingLeft(-5); cell.setPaddingTop(30); cell.setBorder(Rectangle.NO_BORDER); - cell.setFixedHeight(90); + cell.setFixedHeight(70); cell.setRowspan(2); cell.setVerticalAlignment(Rectangle.TOP); table.addCell(cell); @@ -215,7 +218,7 @@ private PdfPTable mainTable(Locale locale, AbstractCertificatePdf data, Image qr cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setBorder(Rectangle.NO_BORDER); cell.setRowspan(30); - cell.setFixedHeight(430); + cell.setFixedHeight(390); table.addCell(cell); if (data instanceof VaccinationCertificatePdf) { @@ -271,7 +274,7 @@ private PdfPTable addLeftColumn(Locale locale, Image qrCode, AbstractCertificate cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); - cell.setPaddingTop(32); + cell.setPaddingTop(22); cell.setPaddingLeft(22); table.addCell(cell); @@ -280,12 +283,12 @@ private PdfPTable addLeftColumn(Locale locale, Image qrCode, AbstractCertificate cell2.setBorder(Rectangle.NO_BORDER); cell2.setColspan(2); cell2.setPaddingLeft(PADDING_LEFT); - cell2.setPaddingTop(15); + cell2.setPaddingTop(5); table.addCell(cell2); addQrLabelCell(table, locale, LocalDateTime.now()); - addIssuerRow(table, locale, "personalData.title", 20, true, PADDING_LEFT); + addIssuerRow(table, locale, "personalData.title", 10, true, PADDING_LEFT); addRow(table, locale, "personalData.name.label", data.getFamilyName() + " " + data.getGivenName(), PADDING_LEFT); addRow(table, locale, "personalData.date.label", data.getDateOfBirth().format(LOCAL_DATE_FORMAT), PADDING_LEFT); @@ -367,18 +370,25 @@ private void addIssuerRow(PdfPTable table, Locale locale, String key, int paddin private void addQrLabelCell(PdfPTable table, Locale locale, LocalDateTime dateTime) { String date = dateTime.format(LOCAL_DATE_FORMAT); String time = dateTime.format(DateTimeFormatter.ofPattern("HH:mm")); - PdfPCell titleCell = new PdfPCell(new Phrase(messageSource.getMessage("qrCode.label", new String[]{date, time}, locale), font8Row)); - titleCell.setBorder(Rectangle.NO_BORDER); - titleCell.setColspan(2); - titleCell.setPaddingLeft(PADDING_LEFT); - table.addCell(titleCell); - - PdfPCell issuerCell = new PdfPCell(new Phrase(messageSource.getMessage("qrCode.label", new String[]{date, time}, Locale.ENGLISH), font8English)); - issuerCell.setBorder(Rectangle.NO_BORDER); - issuerCell.setPaddingTop(0); - issuerCell.setColspan(2); - issuerCell.setPaddingLeft(PADDING_LEFT); - table.addCell(issuerCell); + PdfPCell first = new PdfPCell(new Phrase(messageSource.getMessage("qrCode.label", new String[]{date, time}, locale), font8Row)); + first.setBorder(Rectangle.NO_BORDER); + first.setColspan(2); + first.setPaddingLeft(PADDING_LEFT); + table.addCell(first); + + PdfPCell second = new PdfPCell(new Phrase(messageSource.getMessage("qrCode.label", new String[]{date, time}, Locale.ENGLISH), font8English)); + second.setBorder(Rectangle.NO_BORDER); + second.setPaddingTop(0); + second.setColspan(2); + second.setPaddingLeft(PADDING_LEFT); + table.addCell(second); + + PdfPCell third = new PdfPCell(new Phrase(messageSource.getMessage("qrCode.date.label", null, Locale.ENGLISH), font8English)); + third.setBorder(Rectangle.NO_BORDER); + third.setPaddingTop(0); + third.setColspan(2); + third.setPaddingLeft(PADDING_LEFT); + table.addCell(third); } @@ -399,7 +409,7 @@ private Chunk getLogo(String name, int scale) { private PdfPTable issuerTable(Locale locale) { PdfPTable table = new PdfPTable(1); table.setWidthPercentage(100); - table.setSpacingBefore((float) 10); + table.setSpacingBefore((float) 5); addIssuerRow(table, locale); addIssuerRow(table, locale, "issuer.issuer", 5, true, PADDING_LEFT); @@ -409,19 +419,22 @@ private PdfPTable issuerTable(Locale locale) { private PdfPTable infoTable(Locale locale) { PdfPTable table = new PdfPTable(1); - table.setWidthPercentage(95); + table.setWidthPercentage(94.5f); table.setHorizontalAlignment(Element.ALIGN_RIGHT); - table.setSpacingBefore((float) 20); + table.setSpacingBefore((float) 15); PdfPCell cell = new PdfPCell(); - addInfoCell(cell, messageSource.getMessage("info.info1", null, locale), fontRow, 0); - addInfoCell(cell, messageSource.getMessage("info.info1", null, Locale.ENGLISH), fontEnglish, 0); - addInfoCell(cell, messageSource.getMessage("info.info2", null, locale), fontRow, 10); - addInfoCell(cell, messageSource.getMessage("info.info2", null, Locale.ENGLISH), fontEnglish, 0); + addInfoCell(cell, messageSource.getMessage("info.info1", null, locale), font8Row, 0); + addInfoCell(cell, messageSource.getMessage("info.info2", null, locale), font8Row, 0); + addInfoCell(cell, messageSource.getMessage("info.info3", null, locale), font8Row, 0); + addInfoCell(cell, messageSource.getMessage("info.info1", null, Locale.ENGLISH), font7English, 10); + addInfoCell(cell, messageSource.getMessage("info.info2", null, Locale.ENGLISH), font7English, 0); + addInfoCell(cell, messageSource.getMessage("info.info3", null, Locale.ENGLISH), font7English, 0); cell.setBackgroundColor(new BaseColor(252, 231, 232)); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingBottom(10); + cell.setFixedHeight(150); table.addCell(cell); return table; @@ -431,6 +444,8 @@ private void addInfoCell(PdfPCell cell, String text, Font font, float spacingBef Paragraph paragraph = new Paragraph(new Phrase(text, font)); paragraph.setAlignment(Element.ALIGN_CENTER); paragraph.setSpacingBefore(spacingBefore); + paragraph.setIndentationRight(5); + paragraph.setIndentationLeft(5); cell.addElement(paragraph); } diff --git a/src/main/resources/templates/messages/document-messages_de.properties b/src/main/resources/templates/messages/document-messages_de.properties index 7680d685..d1c6a40e 100644 --- a/src/main/resources/templates/messages/document-messages_de.properties +++ b/src/main/resources/templates/messages/document-messages_de.properties @@ -1,9 +1,10 @@ #de document.title=Covid-Zertifikat -footer.app=Nutzen sie das Covid-Zertifikat in Papierform oder mittels App +footer.app=Nutzen Sie das Covid-Zertifikat in Papierform oder mittels App footer.infoline=Infoline Coronavirus - Tel. +41 58 463 00 00 -info.info1=Das COVID-Zertifikat ist nur gegen Vorlage eines Ausweisdokuments gültig. -info.info2=Bewahren Sie dieses Papier sorgfältig auf, auch wenn Sie das Zertifikat in der App gespeichert haben. +info.info1=Das Covid-Zertifikat ist nur gegen Vorlage eines Ausweisdokuments gültig. +info.info2=Dieses Zertifikat ist kein Reisedokument. Die wissenschaftlichen Erkenntnisse über Covid-19-Impfungen und -Tests sowie über die Genesung von einer Covid-19- Infektion entwickeln sich ständig weiter, auch im Hinblick auf neue besorgniserregende Virusvarianten. Bitte informieren Sie sich vor der Reise über die am Zielort geltenden Gesundheitsmassnahmen und damit verbundenen Beschränkungen. +info.info3=Bewahren Sie dieses Papier sorgfältig auf, auch wenn Sie das Zertifikat in der App gespeichert haben. issuer.issuer=Bundesamt für Gesundheit BAG issuer.title=Das Covid-Zertifikat wurde herausgegeben durch personalData.date.label=Geburtsdatum @@ -32,4 +33,5 @@ vaccination.manufacturer.label=Hersteller vaccination.product.label=Produkt vaccination.title=Impfung vaccination.type.label=Art des Impfstoffs -test.result.value=Nicht erkannt +test.result.value=Nicht erkannt (Negativ) +qrCode.date.label=Date format used: dd.mm.yyyy diff --git a/src/main/resources/templates/messages/document-messages_en.properties b/src/main/resources/templates/messages/document-messages_en.properties index fa84872c..777ed33e 100644 --- a/src/main/resources/templates/messages/document-messages_en.properties +++ b/src/main/resources/templates/messages/document-messages_en.properties @@ -3,7 +3,8 @@ document.title=COVID certificate footer.app=Use the COVID certificate in paper form or in the app footer.infoline=Infoline Coronavirus - Tel. +41 58 463 00 00 info.info1=The COVID certificate is only valid on presentation of an identity document. -info.info2=Keep this document safe, even if you have saved the certificate in the app. +info.info2=This certificate is not a travel document. The scientific evidence on COVID-19 vaccination, testing and recovery continues to evolve, also in view of new variants of concern of the virus. Before travelling, please check the applicable public health measures and related restrictions applied at the point of destination. +info.info3=Keep this document safe, even if you have saved the certificate in the app. issuer.issuer=Federal Office of Public Health FOPH issuer.title=The COVID certificate was issued by personalData.date.label=Date of birth @@ -32,4 +33,5 @@ vaccination.manufacturer.label=Manufacturer vaccination.product.label=Product vaccination.title=Vaccination vaccination.type.label=Vaccine type -test.result.value=Not detected +test.result.value=Not detected (Negative) +qrCode.date.label=Date format used: dd.mm.yyyy diff --git a/src/main/resources/templates/messages/document-messages_fr.properties b/src/main/resources/templates/messages/document-messages_fr.properties index 064e5195..5050b739 100644 --- a/src/main/resources/templates/messages/document-messages_fr.properties +++ b/src/main/resources/templates/messages/document-messages_fr.properties @@ -3,7 +3,8 @@ document.title=Certificat COVID footer.app=Utilisez le certificat COVID en papier ou dans l'application footer.infoline=Infoline Coronavirus - Tél. +41 58 463 00 00 info.info1=Le certificat COVID est valable uniquement sur présentation d'une pièce d'identité. -info.info2=Conservez soigneusement ce document, même si vous avez enregistré le certificat dans l'application. +info.info2=Le présent certificat n'est pas un document de voyage. Les preuves scientifiques relatives à la vaccination, aux tests et au rétablissement liés à la COVID-19 continuent d'évoluer, notamment en ce qui concerne de nouveaux variants préoccupants du virus. Avant de voyager, veuillez vérifier les mesures de santé publique applicables et les restrictions connexes applicables sur le lieu de destination. +info.info3=Conservez soigneusement ce document, même si vous avez enregistré le certificat dans l'application. issuer.issuer=Office fédéral de la santé publique OFSP issuer.title=Le certificat COVID a été délivré par personalData.date.label=Date de naissance @@ -25,11 +26,12 @@ test.title=Test test.type.label=Type vaccination.country.label=Pays de vaccination vaccination.date.label=Date de vaccination -vaccination.disease=Covid-19 +vaccination.disease=COVID-19 vaccination.disease.label=Maladie ou agent pathogène vaccination.dosis.label=Dose vaccination.manufacturer.label=Fabricant vaccination.product.label=Produit vaccination.title=Vaccination vaccination.type.label=Type de vaccin -test.result.value=Non détecté +test.result.value=Non détecté (Négatif) +qrCode.date.label=Date format used: dd.mm.yyyy diff --git a/src/main/resources/templates/messages/document-messages_it.properties b/src/main/resources/templates/messages/document-messages_it.properties index 3d20e608..6ab27257 100644 --- a/src/main/resources/templates/messages/document-messages_it.properties +++ b/src/main/resources/templates/messages/document-messages_it.properties @@ -2,8 +2,9 @@ document.title=Certificato COVID footer.app=Utilizzate il certificato COVID in forma cartacea o tramite l'app footer.infoline=Infoline coronavirus - tel. +41 58 463 00 00 -info.info1=Il certificato COVID è valido solo su presentazione un documento di legittimazione. -info.info2=Conservate con cura questo documento anche se avete salvato il certificato nell'app. +info.info1=Il certificato COVID è valido solo con la presentazione di un documento di legittimazione. +info.info2=La presente attestazione non costituisce un documento di viaggio. Si acquisiscono sempre più conoscenze scientifiche sulla vaccinazione COVID-19, sulla guarigione dalla COVID-19 e sui test COVID-19, anche sulle nuove varianti problematiche del virus. Prima di mettersi in viaggio, si informi sulle misure sanitarie e sulle relative restrizioni applicate nel luogo di destinazione. +info.info3=Conservate con cura questo documento anche se avete salvato il certificato nell'app. issuer.issuer=Ufficio federale della sanità pubblica UFSP issuer.title=Il certificato COVID è stato emesso da personalData.date.label=Data di nascita @@ -32,4 +33,5 @@ vaccination.manufacturer.label=Fabbricante vaccination.product.label=Prodotto vaccination.title=Vaccinazione vaccination.type.label=Tipo di vaccino -test.result.value=Non rilevato +test.result.value=Non rilevato (Negativo) +qrCode.date.label=Date format used: dd.mm.yyyy diff --git a/src/main/resources/templates/messages/document-messages_rm.properties b/src/main/resources/templates/messages/document-messages_rm.properties index 1ca679cc..9b5eff89 100644 --- a/src/main/resources/templates/messages/document-messages_rm.properties +++ b/src/main/resources/templates/messages/document-messages_rm.properties @@ -1,9 +1,10 @@ -#rm +#rm document.title=Certificat COVID footer.app=Utilisai il certificat COVID en furma da palpiri u en l'app footer.infoline=Infoline coronavirus - tel. +41 58 463 00 00 info.info1=Il certificat COVID è valaivel mo cun ina carta d'identitad u cun in passaport. -info.info2=Tegnai en salv quest palpiri cun quità, er sche Vus avais arcunà il certificat en l'app. +info.info2=Quest attest n'è betg in document da viadi. Las enconuschientschas scientificas davart la vaccinaziun cunter COVID-19, davart la guariziun da COVID-19 e davart ils tests da COVID-19 sa sviluppan cuntinuadamain, er areguard las novas variantas privlusas dal virus. As infurmai per plaschair – avant d'As metter en viadi – davart las mesiras da sanadad e davart las restricziuns che valan en il lieu da destinaziun. +info.info3=Tegnai en salv quest palpiri cun quità, er sche Vus avais arcunà il certificat en l'app. issuer.issuer=Uffizi federal da sanadad publica UFSP issuer.title=Il certificat COVID è vegnì emess da personalData.date.label=Data da naschientscha @@ -16,7 +17,7 @@ recovery.title=Guariziun recovery.validFrom=Valaivel a partir dals recovery.validUntil=Valaivel fin ils test.conducted.label=Test fatg da -test.country.label=Pajais da la vaccinaziun +test.country.label=Pajais dal test test.date.label=Data ed ura da l'emprova test.manufacturer.label=Producent test.name.label=Num @@ -32,4 +33,5 @@ vaccination.manufacturer.label=Producent vaccination.product.label=Product vaccination.title=Vaccinaziun vaccination.type.label=Tip dal vaccin -test.result.value=Betg identifitgà +test.result.value=Betg identifitgà (Negativ) +qrCode.date.label=Date format used: dd.mm.yyyy diff --git a/src/test/java/ch/admin/bag/covidcertificate/TestModelProvider.java b/src/test/java/ch/admin/bag/covidcertificate/TestModelProvider.java index e0ba5e0b..69bb8526 100644 --- a/src/test/java/ch/admin/bag/covidcertificate/TestModelProvider.java +++ b/src/test/java/ch/admin/bag/covidcertificate/TestModelProvider.java @@ -9,30 +9,28 @@ public class TestModelProvider { - public static VaccinationCertificateCreateDto getVaccinationCertificateCreateDto(String medicalProductCode) { + public static VaccinationCertificateCreateDto getVaccinationCertificateCreateDto(String medicalProductCode, String language) { return new VaccinationCertificateCreateDto( getCovidCertificatePersonDto(), List.of(getVaccinationCertificateDataDto(medicalProductCode)), - "de" + language ); } - public static TestCertificateCreateDto getTestCertificateCreateDto( - String typeCode, - String manufacturerCode + public static TestCertificateCreateDto getTestCertificateCreateDto(String typeCode, String manufacturerCode, String language ) { return new TestCertificateCreateDto( getCovidCertificatePersonDto(), List.of(getTestCertificateDataDto(typeCode, manufacturerCode)), - "de" + language ); } - public static RecoveryCertificateCreateDto getRecoveryCertificateCreateDto() { + public static RecoveryCertificateCreateDto getRecoveryCertificateCreateDto(String language) { return new RecoveryCertificateCreateDto( getCovidCertificatePersonDto(), List.of(getRecoveryCertificateDataDto()), - "de" + language ); } diff --git a/src/test/java/ch/admin/bag/covidcertificate/api/TestCertificateQrCodeMapperTest.java b/src/test/java/ch/admin/bag/covidcertificate/api/TestCertificateQrCodeMapperTest.java index 0b5c6e9c..5f1d95a3 100644 --- a/src/test/java/ch/admin/bag/covidcertificate/api/TestCertificateQrCodeMapperTest.java +++ b/src/test/java/ch/admin/bag/covidcertificate/api/TestCertificateQrCodeMapperTest.java @@ -61,7 +61,7 @@ public void mapsTestManufacturer() { @Test public void mapsSampleDateTime() { ZonedDateTime sampleDateTime = ZonedDateTime.of(LocalDateTime.of(2021, Month.APRIL, 4, 16, 25, 12), SWISS_TIMEZONE); - TestCertificateQrCode actual = TestCertificateQrCodeMapper.toTestCertificateQrCode(getTestCertificateCreateDto("", ""), testValueSet); + TestCertificateQrCode actual = TestCertificateQrCodeMapper.toTestCertificateQrCode(getTestCertificateCreateDto("", "", "de"), testValueSet); assertEquals(sampleDateTime, actual.getTestInfo().get(0).getSampleDateTime()); } @@ -94,4 +94,4 @@ public void mapsIdentifier() { TestCertificateQrCode actual = TestCertificateQrCodeMapper.toTestCertificateQrCode(incoming, testValueSet); assertNotNull(actual.getTestInfo().get(0).getIdentifier()); } -} \ No newline at end of file +} diff --git a/src/test/java/ch/admin/bag/covidcertificate/service/document/CovidPdfCertificateGenerationServiceTest.java b/src/test/java/ch/admin/bag/covidcertificate/service/document/CovidPdfCertificateGenerationServiceTest.java index 7f825ff9..245f38dc 100644 --- a/src/test/java/ch/admin/bag/covidcertificate/service/document/CovidPdfCertificateGenerationServiceTest.java +++ b/src/test/java/ch/admin/bag/covidcertificate/service/document/CovidPdfCertificateGenerationServiceTest.java @@ -18,8 +18,8 @@ import java.io.FileOutputStream; import java.io.OutputStream; -import java.nio.file.Files; -import java.nio.file.Path; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import static ch.admin.bag.covidcertificate.TestModelProvider.*; import static org.mockito.Mockito.mock; @@ -33,6 +33,8 @@ class CovidPdfCertificateGenerationServiceTest { @Mock private ConfigurableEnvironment environment; + private final String countryEn = "Switzerland"; + @BeforeEach void setup() throws Exception { when(environment.getActiveProfiles()).thenReturn(new String[]{"unittest"}); @@ -40,54 +42,69 @@ void setup() throws Exception { } - @Test - void generateDocument_vaccine() throws Exception { - VaccinationCertificateCreateDto createDto = getVaccinationCertificateCreateDto("1119349007"); + private void generateDocument_vaccine(String language) throws Exception { + VaccinationCertificateCreateDto createDto = getVaccinationCertificateCreateDto("1119349007", language); VaccinationValueSet vaccinationValueSet = new VaccinationValueSet(); ReflectionTestUtils.setField(vaccinationValueSet, "prophylaxis", "SARS-CoV-2 mRNA vaccine"); ReflectionTestUtils.setField(vaccinationValueSet, "medicinalProduct", "COVID-19 Vaccine Moderna"); ReflectionTestUtils.setField(vaccinationValueSet, "authHolder", "Moderna Switzerland GmbH, Basel"); String country = "Schweiz"; - String countryEn = "Switzerland"; VaccinationCertificateQrCode qrCodeData = VaccinationCertificateQrCodeMapper.toVaccinationCertificateQrCode(createDto, vaccinationValueSet); VaccinationCertificatePdf pdfData = VaccinationCertificatePdfMapper.toVaccinationCertificatePdf(createDto, vaccinationValueSet, qrCodeData, country, countryEn); - doTest(pdfData); + doTest(pdfData, "vaccine", language); } - @Test - void generateDocument_test() throws Exception { - TestCertificateCreateDto createDto = getTestCertificateCreateDto("test", "test"); + private void generateDocument_test(String language) throws Exception { + TestCertificateCreateDto createDto = getTestCertificateCreateDto("test", "test", language); TestValueSet testValueSet = new TestValueSet(); ReflectionTestUtils.setField(testValueSet, "name", "Name 1"); ReflectionTestUtils.setField(testValueSet, "type", "Rapid immunoassay"); ReflectionTestUtils.setField(testValueSet, "manufacturer", "XXXXX, Basel"); String country = "Schweiz"; - String countryEn = "Switzerland"; TestCertificateQrCode qrCodeData = TestCertificateQrCodeMapper.toTestCertificateQrCode(createDto, testValueSet); TestCertificatePdf pdfData = TestCertificatePdfMapper.toTestCertificatePdf(createDto, testValueSet, qrCodeData, country, countryEn); - doTest(pdfData); + doTest(pdfData, "test", language); } - @Test - void generateDocument_recovery() throws Exception { - RecoveryCertificateCreateDto createDto = getRecoveryCertificateCreateDto(); + private void generateDocument_recovery(String language) throws Exception { + RecoveryCertificateCreateDto createDto = getRecoveryCertificateCreateDto(language); String country = "Schweiz"; - String countryEn = "Switzerland"; + RecoveryCertificateQrCode qrCodeData = RecoveryCertificateQrCodeMapper.toRecoveryCertificateQrCode(createDto); RecoveryCertificatePdf pdfData = RecoveryCertificatePdfMapper.toRecoveryCertificatePdf(createDto, qrCodeData, country, countryEn); + doTest(pdfData, "recovery", language); - doTest(pdfData); + } + + + @Test + void generateAllDocuments() throws Exception { + generateDocument_recovery("de"); + generateDocument_recovery("fr"); + generateDocument_recovery("it"); + generateDocument_recovery("rm"); + + generateDocument_vaccine("de"); + generateDocument_vaccine("fr"); + generateDocument_vaccine("it"); + generateDocument_vaccine("rm"); + + generateDocument_test("de"); + generateDocument_test("fr"); + generateDocument_test("it"); + generateDocument_test("rm"); } - void doTest(AbstractCertificatePdf pdfData) throws Exception { + + void doTest(AbstractCertificatePdf pdfData, String filename, String language) throws Exception { Barcode barcode = mock(Barcode.class); when(barcode.getPayload()).thenReturn("HC1:NCFOXNYTSFDHJI8-.O0:A%1W RI%.BI06%BF1WG21QKP85NPV*JVH5QWKIW18WA%NE/P3F/8X*G3M9FQH+4JZW4V/AY73CIBVQFSA36238FNB939PJ*KN%DJ3239L7BRNHKBWINEV40AT0C7LS4AZKZ73423ZQT-EJEG3LS4JXITAFK1HG%8SC91Z8YA7-TIP+PQE1W9L $N3-Q-*OGF2F%M RFUS2CPA-DG:A3AGJLC1788M7DD-I/2DBAJDAJCNB-439Y4.$SINOPK3.T4RZ4E%5MK9QM9DB9E%5:I9YHQ1FDIV4RB4VIOTNPS46UDBQEAJJKHHGQA8EL4QN9J9E6LF6JC1A5N11+N1X*8O13E20ZO8%3"); @@ -98,20 +115,9 @@ void doTest(AbstractCertificatePdf pdfData) throws Exception { boolean storeDocument = false; if (storeDocument) { - - try { - Files.delete(Path.of("/home/dev/Downloads/document.pdf")); - } catch (Exception e) { - - } - - OutputStream out = new FileOutputStream("/home/dev/Downloads/document.pdf"); + OutputStream out = new FileOutputStream("/home/dev/Downloads/certificate-" + filename + "-" + language + "-" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd_hhmmss")) + ".pdf"); out.write(document); out.close(); } - - } - - }