@Test(expected = InternalErrorException.class) public void failedSerializeJsonString() throws IOException { ObjectMapper mockBadMapper = mock(ObjectMapper.class); when(mockBadMapper.writeValueAsString(any())).thenThrow(new JsonProcessingException(TestConstants.DUMMY_ERROR_MESSAGE) {}); test = new IngestionSerializer(mockBadMapper); JsonNode jsonNode = mapper.readTree(TestConstants.CUSTOMER_INGESTION_PAYLOAD); test.serialize(jsonNode); }
public String serialize(@NonNull final JsonNode input){ try { return mapper.writeValueAsString(input); } catch (JsonProcessingException e) { throw new InternalErrorException(CustomerMessage.INTERNAL_ERROR, e); } }
IngestionSerializer implements ComprehendSerializer<JsonNode> { public String serialize(@NonNull final JsonNode input){ try { return mapper.writeValueAsString(input); } catch (JsonProcessingException e) { throw new InternalErrorException(CustomerMessage.INTERNAL_ERROR, e); } } }
IngestionSerializer implements ComprehendSerializer<JsonNode> { public String serialize(@NonNull final JsonNode input){ try { return mapper.writeValueAsString(input); } catch (JsonProcessingException e) { throw new InternalErrorException(CustomerMessage.INTERNAL_ERROR, e); } }  }
IngestionSerializer implements ComprehendSerializer<JsonNode> { public String serialize(@NonNull final JsonNode input){ try { return mapper.writeValueAsString(input); } catch (JsonProcessingException e) { throw new InternalErrorException(CustomerMessage.INTERNAL_ERROR, e); } }  JsonNode deserialize(@NonNull final String input); String serialize(@NonNull final JsonNode input); }
IngestionSerializer implements ComprehendSerializer<JsonNode> { public String serialize(@NonNull final JsonNode input){ try { return mapper.writeValueAsString(input); } catch (JsonProcessingException e) { throw new InternalErrorException(CustomerMessage.INTERNAL_ERROR, e); } }  JsonNode deserialize(@NonNull final String input); String serialize(@NonNull final JsonNode input);  }