Skip to content

Commit

Permalink
[PRDP-171] fixed config file read and updated unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
giomella committed Oct 17, 2023
1 parent 3ab22a0 commit 1627b1a
Show file tree
Hide file tree
Showing 3 changed files with 6,720 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class BizEventToPdfMapper {
}

static {
try (InputStream data = BizEventToPdfMapper.class.getResourceAsStream("psp_config_file.json")) {
try (InputStream data = BizEventToPdfMapper.class.getClassLoader().getResourceAsStream("psp_config_file.json")) {
if (data == null) {
throw new IOException("PSP config file not found");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void generateReceiptsPayerNullWithSuccess() throws Exception {
.when(receiptBlobClientMock).savePdfToBlobStorage(any(), anyString());

AtomicReference<PdfGeneration> pdfGeneration = new AtomicReference<>();
withEnvironmentVariables().set("BRAND_LOGO_MAP", "{\"MASTER\":\"assets/mastercard.png\"}\n").set("PSP_INFO_MAP","{\"60000000001\":{\"logo\":\"assets/nexi_logo.png\"}}\n").execute(() ->
withEnvironmentVariables().set("BRAND_LOGO_MAP", "{\"MASTER\":\"assets/mastercard.png\"}\n").execute(() ->
pdfGeneration.set(sut.generateReceipts(receiptOnly, bizEventOnly,Path.of("/tmp") ))
);

Expand Down Expand Up @@ -121,7 +121,7 @@ void generateReceiptsSameDebtorPayerWithSuccess() throws Exception {
.when(receiptBlobClientMock).savePdfToBlobStorage(any(), anyString());

AtomicReference<PdfGeneration> pdfGeneration = new AtomicReference<>();
withEnvironmentVariables().set("BRAND_LOGO_MAP", "{\"MASTER\":\"assets/mastercard.png\"}\n").set("PSP_INFO_MAP","{\"60000000001\":{\"logo\":\"assets/nexi_logo.png\"}}\n").execute(() ->
withEnvironmentVariables().set("BRAND_LOGO_MAP", "{\"MASTER\":\"assets/mastercard.png\"}\n").execute(() ->
pdfGeneration.set(sut.generateReceipts(receiptOnly, bizEventOnly,Path.of("/tmp")))
);

Expand Down Expand Up @@ -151,7 +151,7 @@ void generateReceiptsDifferentDebtorPayerWithSuccess() throws Exception {
.when(receiptBlobClientMock).savePdfToBlobStorage(any(), anyString());

AtomicReference<PdfGeneration> pdfGeneration = new AtomicReference<>();
withEnvironmentVariables().set("BRAND_LOGO_MAP", "{\"MASTER\":\"assets/mastercard.png\"}\n").set("PSP_INFO_MAP","{\"60000000001\":{\"logo\":\"assets/nexi_logo.png\"}}\n").execute(() ->
withEnvironmentVariables().set("BRAND_LOGO_MAP", "{\"MASTER\":\"assets/mastercard.png\"}\n").execute(() ->
pdfGeneration.set(sut.generateReceipts(receiptOnly, bizEventOnly,Path.of("/tmp")))
);

Expand Down Expand Up @@ -223,7 +223,7 @@ void generateReceiptsDifferentDebtorPayerAndPayerReceiptAlreadyCreatedWithSucces
.when(receiptBlobClientMock).savePdfToBlobStorage(any(), anyString());

AtomicReference<PdfGeneration> pdfGeneration = new AtomicReference<>();
withEnvironmentVariables().set("BRAND_LOGO_MAP", "{\"MASTER\":\"assets/mastercard.png\"}\n").set("PSP_INFO_MAP","{\"60000000001\":{\"logo\":\"assets/nexi_logo.png\"}}\n").execute(() ->
withEnvironmentVariables().set("BRAND_LOGO_MAP", "{\"MASTER\":\"assets/mastercard.png\"}\n").execute(() ->
pdfGeneration.set(sut.generateReceipts(receiptOnly, bizEventOnly,Path.of("/tmp")))
);

Expand Down Expand Up @@ -253,7 +253,7 @@ void generateReceiptsPayerNullFailPDFEngineCallReturn500() throws Exception {
.when(pdfEngineClientMock).generatePDF(any(), any());

AtomicReference<PdfGeneration> pdfGeneration = new AtomicReference<>();
withEnvironmentVariables().set("BRAND_LOGO_MAP", "{\"MASTER\":\"assets/mastercard.png\"}\n").set("PSP_INFO_MAP","{\"60000000001\":{\"logo\":\"assets/nexi_logo.png\"}}\n").execute(() ->
withEnvironmentVariables().set("BRAND_LOGO_MAP", "{\"MASTER\":\"assets/mastercard.png\"}\n").execute(() ->
pdfGeneration.set(sut.generateReceipts(receiptOnly, bizEventOnly,Path.of("/tmp")))
);

Expand Down Expand Up @@ -281,7 +281,7 @@ void generateReceiptsPayerNullFailSaveToBlobStorageThrowsException() throws Exce


AtomicReference<PdfGeneration> pdfGeneration = new AtomicReference<>();
withEnvironmentVariables().set("BRAND_LOGO_MAP", "{\"MASTER\":\"assets/mastercard.png\"}\n").set("PSP_INFO_MAP","{\"60000000001\":{\"logo\":\"assets/nexi_logo.png\"}}\n").execute(() ->
withEnvironmentVariables().set("BRAND_LOGO_MAP", "{\"MASTER\":\"assets/mastercard.png\"}\n").execute(() ->
pdfGeneration.set(sut.generateReceipts(receiptOnly, bizEventOnly,Path.of("/tmp")))
);

Expand Down Expand Up @@ -309,7 +309,7 @@ void generateReceiptsPayerNullFailSaveToBlobStorageReturn500() throws Exception
.when(receiptBlobClientMock).savePdfToBlobStorage(any(), anyString());

AtomicReference<PdfGeneration> pdfGeneration = new AtomicReference<>();
withEnvironmentVariables().set("BRAND_LOGO_MAP", "{\"MASTER\":\"assets/mastercard.png\"}\n").set("PSP_INFO_MAP","{\"60000000001\":{\"logo\":\"assets/nexi_logo.png\"}}\n").execute(() ->
withEnvironmentVariables().set("BRAND_LOGO_MAP", "{\"MASTER\":\"assets/mastercard.png\"}\n").execute(() ->
pdfGeneration.set(sut.generateReceipts(receiptOnly, bizEventOnly,Path.of("/tmp")))
);

Expand Down
Loading

0 comments on commit 1627b1a

Please sign in to comment.