@Test public void FailedToTransformConfigRequestToConfigMapEmptyFields() { try { configMap = ConfigSerializer.transformConfigRequestToConfigMap(TestConstants.getEmptyFieldConfigRequest()); } catch (InvalidRequestException e) { assertEquals(CustomerMessage.CONFIG_FIELD_MISSING_OR_EMPTY_ERROR, e.getMessage()); } }
public static Map<String, ComprehendConfiguration> transformConfigRequestToConfigMap( @NonNull PreprocessingConfigRequest configRequest) { List<ComprehendConfiguration> configList = configRequest.getComprehendConfigurations(); try { Map<String, ComprehendConfiguration> configMap = configList.stream() .filter(config -> !config.configIsInvalid()) .collect(Collectors.toMap( value -> String.format("%s_%s", value.getIndexName(), value.getFieldName()), value -> value)); if (configMap.size() != configList.size()) { throw new InvalidRequestException(CustomerMessage.CONFIG_FIELD_MISSING_OR_EMPTY_ERROR); } return configMap; } catch (IllegalStateException e) { throw new InvalidRequestException(CustomerMessage.CONFIG_FIELD_NAME_DUPLICATED_ERROR); } }
ConfigSerializer implements ComprehendSerializer<PreprocessingConfigRequest> { public static Map<String, ComprehendConfiguration> transformConfigRequestToConfigMap( @NonNull PreprocessingConfigRequest configRequest) { List<ComprehendConfiguration> configList = configRequest.getComprehendConfigurations(); try { Map<String, ComprehendConfiguration> configMap = configList.stream() .filter(config -> !config.configIsInvalid()) .collect(Collectors.toMap( value -> String.format("%s_%s", value.getIndexName(), value.getFieldName()), value -> value)); if (configMap.size() != configList.size()) { throw new InvalidRequestException(CustomerMessage.CONFIG_FIELD_MISSING_OR_EMPTY_ERROR); } return configMap; } catch (IllegalStateException e) { throw new InvalidRequestException(CustomerMessage.CONFIG_FIELD_NAME_DUPLICATED_ERROR); } } }
ConfigSerializer implements ComprehendSerializer<PreprocessingConfigRequest> { public static Map<String, ComprehendConfiguration> transformConfigRequestToConfigMap( @NonNull PreprocessingConfigRequest configRequest) { List<ComprehendConfiguration> configList = configRequest.getComprehendConfigurations(); try { Map<String, ComprehendConfiguration> configMap = configList.stream() .filter(config -> !config.configIsInvalid()) .collect(Collectors.toMap( value -> String.format("%s_%s", value.getIndexName(), value.getFieldName()), value -> value)); if (configMap.size() != configList.size()) { throw new InvalidRequestException(CustomerMessage.CONFIG_FIELD_MISSING_OR_EMPTY_ERROR); } return configMap; } catch (IllegalStateException e) { throw new InvalidRequestException(CustomerMessage.CONFIG_FIELD_NAME_DUPLICATED_ERROR); } }  }
ConfigSerializer implements ComprehendSerializer<PreprocessingConfigRequest> { public static Map<String, ComprehendConfiguration> transformConfigRequestToConfigMap( @NonNull PreprocessingConfigRequest configRequest) { List<ComprehendConfiguration> configList = configRequest.getComprehendConfigurations(); try { Map<String, ComprehendConfiguration> configMap = configList.stream() .filter(config -> !config.configIsInvalid()) .collect(Collectors.toMap( value -> String.format("%s_%s", value.getIndexName(), value.getFieldName()), value -> value)); if (configMap.size() != configList.size()) { throw new InvalidRequestException(CustomerMessage.CONFIG_FIELD_MISSING_OR_EMPTY_ERROR); } return configMap; } catch (IllegalStateException e) { throw new InvalidRequestException(CustomerMessage.CONFIG_FIELD_NAME_DUPLICATED_ERROR); } }  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 static Map<String, ComprehendConfiguration> transformConfigRequestToConfigMap( @NonNull PreprocessingConfigRequest configRequest) { List<ComprehendConfiguration> configList = configRequest.getComprehendConfigurations(); try { Map<String, ComprehendConfiguration> configMap = configList.stream() .filter(config -> !config.configIsInvalid()) .collect(Collectors.toMap( value -> String.format("%s_%s", value.getIndexName(), value.getFieldName()), value -> value)); if (configMap.size() != configList.size()) { throw new InvalidRequestException(CustomerMessage.CONFIG_FIELD_MISSING_OR_EMPTY_ERROR); } return configMap; } catch (IllegalStateException e) { throw new InvalidRequestException(CustomerMessage.CONFIG_FIELD_NAME_DUPLICATED_ERROR); } }  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);  }