From 4413c82396ece018366507e25188baab98bd9bae Mon Sep 17 00:00:00 2001 From: Diego Date: Thu, 17 Oct 2024 16:38:27 +0200 Subject: [PATCH] add unit test for params being empty --- .../java/com/fidesmo/fdsm/ServiceDeliverySession.java | 2 +- .../src/test/java/com/fidesmo/fdsm/TranslationsTest.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/com/fidesmo/fdsm/ServiceDeliverySession.java b/library/src/main/java/com/fidesmo/fdsm/ServiceDeliverySession.java index dd36bb4..18e259e 100644 --- a/library/src/main/java/com/fidesmo/fdsm/ServiceDeliverySession.java +++ b/library/src/main/java/com/fidesmo/fdsm/ServiceDeliverySession.java @@ -170,7 +170,7 @@ public DeliveryResult deliver(BIBO bibo, String appId, String serviceId) throws JsonNode delivery = client.rpc(client.getURI(FidesmoApiClient.SERVICE_DELIVER_URL), deliveryRequest); String sessionId = delivery.get("sessionId").asText(); - + logger.info("Delivering: {}", FidesmoApiClient.lamei18n(description.get("title"))); logger.info("Session ID: {}", sessionId); diff --git a/library/src/test/java/com/fidesmo/fdsm/TranslationsTest.java b/library/src/test/java/com/fidesmo/fdsm/TranslationsTest.java index 06c0906..c8af0d1 100644 --- a/library/src/test/java/com/fidesmo/fdsm/TranslationsTest.java +++ b/library/src/test/java/com/fidesmo/fdsm/TranslationsTest.java @@ -63,6 +63,15 @@ public void returnMessagesInNewFormatWithoutParams() throws JsonProcessingExcept ObjectMapper objectMapper = new ObjectMapper(); JsonNode jsonNode = objectMapper.readTree(jsonString); + assertEquals(FidesmoApiClient.lamei18n(jsonNode), "Your card has been removed"); + } + @Test + public void returnMessagesInNewFormatWithEmptyParams() throws JsonProcessingException { + String jsonString = "{ \"id\": \"service.statuses.success\", \"text\": \"Your card has been removed\", \"params\": []}"; + + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode jsonNode = objectMapper.readTree(jsonString); + assertEquals(FidesmoApiClient.lamei18n(jsonNode), "Your card has been removed"); } }