### Question:
ConfigSerializer implements ComprehendSerializer<PreprocessingConfigRequest> { public String serialize(@NonNull PreprocessingConfigRequest configRequest) throws InvalidRequestException { try { return mapper.writeValueAsString(configRequest); } catch (JsonProcessingException e) { throw new InvalidRequestException(CustomerMessage.CONFIG_MALFORMED_ERROR, e); } }  PreprocessingConfigRequest deserialize(@NonNull final String input); String serialize(@NonNull PreprocessingConfigRequest configRequest); static Map<String, ComprehendConfiguration> transformConfigRequestToConfigMap(
            @NonNull PreprocessingConfigRequest configRequest); static PreprocessingConfigRequest transformConfigMapToConfigRequest(
            @NonNull Map<String, ComprehendConfiguration> configMap);  }### Answer:
@Test public void SucceedSerializeConfigMap() { String configStr = test.serialize(TestConstants.getListConfigRequest()); assertEquals(configStr, TestConstants.getPlainText(TestConstants.CONFIG_LIST)); }
@Test(expected = InvalidRequestException.class) public void FailedToSerializeConfigMap() throws IOException { ObjectMapper mockBadMapper = mock(ObjectMapper.class); when(mockBadMapper.writeValueAsString(any())) .thenThrow(new JsonProcessingException(TestConstants.DUMMY_ERROR_MESSAGE) {}); test = new ConfigSerializer(mockBadMapper); test.serialize(TestConstants.getConfigRequest()); }