### Question:
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);  }### Answer:
@Test public void succeedSerializeJsonString() throws IOException { test = new IngestionSerializer(mapper); JsonNode jsonNode = mapper.readTree(TestConstants.CUSTOMER_INGESTION_PAYLOAD); String result = test.serialize(jsonNode); assertEquals(TestConstants.getPlainText(TestConstants.CUSTOMER_INGESTION_PAYLOAD), TestConstants.getPlainText(result)); }
@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); }