HerdApiClientOperations { JsonSqsMessageBody mapJsontoBdataKey(String messageBody) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); return mapper.readValue(new JSONObject(messageBody).getString(JSON_KEY), JsonSqsMessageBody.class); }    }
@Test public void testMapJsontoBdataKey() throws Exception { String fileName = "sqsMessage.txt"; String expectedNamespace = "DMFormatNamespace1"; Path path = Paths.get(getClass().getClassLoader().getResource(fileName).toURI()); Stream<String> lines = Files.lines(path); String messageBody = lines.collect(Collectors.joining("\n")).trim(); lines.close(); BusinessObjectDataKey bdataKey = herdApiClientOperations.mapJsontoBdataKey(messageBody).getBusinessObjectDataKey(); Assert.assertEquals("Did not get the correct namespace", expectedNamespace, bdataKey.getNamespace()); }