From 02c37c9ebae41338cb02c3071081bf6cfa984706 Mon Sep 17 00:00:00 2001 From: xuelianhan007 Date: Wed, 20 Nov 2024 17:49:33 +0800 Subject: [PATCH] fix unit test --- .../kraken/operator/ResponseMappingTest.java | 3 +- .../expected-11-quote.eline.add.sync.json | 41 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 kraken-app/kraken-app-hub/src/test/resources/expected/expected-11-quote.eline.add.sync.json diff --git a/kraken-app/kraken-app-hub/src/test/java/com/consoleconnect/kraken/operator/ResponseMappingTest.java b/kraken-app/kraken-app-hub/src/test/java/com/consoleconnect/kraken/operator/ResponseMappingTest.java index 1050c129..91ea24a8 100644 --- a/kraken-app/kraken-app-hub/src/test/java/com/consoleconnect/kraken/operator/ResponseMappingTest.java +++ b/kraken-app/kraken-app-hub/src/test/java/com/consoleconnect/kraken/operator/ResponseMappingTest.java @@ -93,11 +93,12 @@ void testResponseMapper() { "/mock/api-targets-mappers/api-target-mapper.quote.uni.read.sync.yaml"); validate(expected10, input10); + String expected11 = readCompactedFile("expected/expected-11-quote.eline.add.sync.json"); String input11 = getTarget( "/mock/api-targets/api-target.quote.eline.add.sync.yaml", "/mock/api-targets-mappers/api-target-mapper.quote.eline.add.sync.yaml"); - validate(expected9, input11); + validate(expected11, input11); String input12 = getTarget( diff --git a/kraken-app/kraken-app-hub/src/test/resources/expected/expected-11-quote.eline.add.sync.json b/kraken-app/kraken-app-hub/src/test/resources/expected/expected-11-quote.eline.add.sync.json new file mode 100644 index 00000000..4820e802 --- /dev/null +++ b/kraken-app/kraken-app-hub/src/test/resources/expected/expected-11-quote.eline.add.sync.json @@ -0,0 +1,41 @@ +{ + "id": "${entity.id}", + "buyerRequestedQuoteLevel": "${mefRequestBody.buyerRequestedQuoteLevel}", + "relatedContactInformation": "${T(com.consoleconnect.kraken.operator.gateway.func.SpelFunc).appendSellerInformation('sellerContactInformation',env.seller.name,env.seller.emailAddress,env.seller.number,mefRequestBody[relatedContactInformation]?:'')}", + "quoteItem": [ + { + "requestedQuoteItemTerm": "${mefRequestBody.quoteItem[0].requestedQuoteItemTerm}", + "product": "${mefRequestBody.quoteItem[0].product}", + "action": "add", + "id": "${mefRequestBody.quoteItem[0].id}", + "state": "(((mefResponseBody.quoteItem[0].quoteItemPrice[0].price.dutyFreeAmount.value=='')or(T(java.lang.Double).parseDouble(mefResponseBody.quoteItem[0].quoteItemPrice[0].price.dutyFreeAmount.value)<0)?'unableToProvide':'approved.orderable'))", + "quoteItemTerm": "${T(java.util.Arrays).asList(mefRequestBody.quoteItem[0].requestedQuoteItemTerm)}", + "quoteItemPrice": [ + { + "unitOfMeasure": "Gb", + "price": { + "dutyFreeAmount": { + "unit": "USD", + "value": "${responseBody.results[0].price}" + }, + "taxRate": "16", + "taxIncludedAmount": { + "unit": "USD", + "value": "100" + } + }, + "name": "name-here", + "priceType": "recurring", + "description": "", + "recurringChargePeriod": "${responseBody.results[0].entity.duration.unit}" + } + ] + } + ], + "quoteDate": "${T(com.consoleconnect.kraken.operator.core.toolkit.DateTime).nowInUTCFormatted()}", + "externalId": "${mefRequestBody[externalId]?:''}", + "instantSyncQuote": "${mefRequestBody[instantSyncQuote]?:''}", + "requestedQuoteCompletionDate": "${mefRequestBody[requestedQuoteCompletionDate]?:''}", + "quoteLevel": "${mefRequestBody.buyerRequestedQuoteLevel}", + "state": "(((mefResponseBody.quoteItem[0].quoteItemPrice[0].price.dutyFreeAmount.value=='')or(T(java.lang.Double).parseDouble(mefResponseBody.quoteItem[0].quoteItemPrice[0].price.dutyFreeAmount.value)<0)?'unableToProvide':'approved.orderable'))" +} \ No newline at end of file