@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()); }
public String serialize(@NonNull PreprocessingConfigRequest configRequest) throws InvalidRequestException { try { return mapper.writeValueAsString(configRequest); } catch (JsonProcessingException e) { throw new InvalidRequestException(CustomerMessage.CONFIG_MALFORMED_ERROR, e); } }
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); } } }
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); } }  }
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); }
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);  }