@Test public void test_ignore_route_error_handle_right_parameter() { ParameterReader<Boolean> ignoreRouteServiceErrorReader = factory.buildIgnoreRouteServiceErrorReader(); String parameter = ignoreRouteServiceErrorReader.getParameterName(); assertThat(parameter, is(equalTo(ServiceInstanceParameters.IGNORE_ROUTE_SERVICE_ERROR))); }
@Bean(name = ServiceInstanceParameters.IGNORE_ROUTE_SERVICE_ERROR) public ParameterReader<Boolean> buildIgnoreRouteServiceErrorReader() { return new ParameterReader<Boolean>() { @Override public String getParameterName() { return Config.ServiceInstanceParameters.IGNORE_ROUTE_SERVICE_ERROR; } @Override public Boolean readParameter(Object parameter, boolean withDefault) throws InvalidParameterException { if (parameter != null) { String ignoreRouteError = ((String) parameter).toLowerCase(); log.debug("ignoreRouteServiceError " + ignoreRouteError); if (parameter.equals(Boolean.TRUE.toString().toLowerCase())) { return Boolean.TRUE; } else if (parameter.equals(Boolean.FALSE.toString().toLowerCase())) { return Boolean.FALSE; } else { throw new InvalidParameterException(Config.ServiceInstanceParameters.IGNORE_ROUTE_SERVICE_ERROR, "bad parameter value. Must be a boolean value."); } } else { return Config.DEFAULT_IGNORE_SERVICE_ERROR; } } }; }
ParameterReaderFactory { @Bean(name = ServiceInstanceParameters.IGNORE_ROUTE_SERVICE_ERROR) public ParameterReader<Boolean> buildIgnoreRouteServiceErrorReader() { return new ParameterReader<Boolean>() { @Override public String getParameterName() { return Config.ServiceInstanceParameters.IGNORE_ROUTE_SERVICE_ERROR; } @Override public Boolean readParameter(Object parameter, boolean withDefault) throws InvalidParameterException { if (parameter != null) { String ignoreRouteError = ((String) parameter).toLowerCase(); log.debug("ignoreRouteServiceError " + ignoreRouteError); if (parameter.equals(Boolean.TRUE.toString().toLowerCase())) { return Boolean.TRUE; } else if (parameter.equals(Boolean.FALSE.toString().toLowerCase())) { return Boolean.FALSE; } else { throw new InvalidParameterException(Config.ServiceInstanceParameters.IGNORE_ROUTE_SERVICE_ERROR, "bad parameter value. Must be a boolean value."); } } else { return Config.DEFAULT_IGNORE_SERVICE_ERROR; } } }; } }
ParameterReaderFactory { @Bean(name = ServiceInstanceParameters.IGNORE_ROUTE_SERVICE_ERROR) public ParameterReader<Boolean> buildIgnoreRouteServiceErrorReader() { return new ParameterReader<Boolean>() { @Override public String getParameterName() { return Config.ServiceInstanceParameters.IGNORE_ROUTE_SERVICE_ERROR; } @Override public Boolean readParameter(Object parameter, boolean withDefault) throws InvalidParameterException { if (parameter != null) { String ignoreRouteError = ((String) parameter).toLowerCase(); log.debug("ignoreRouteServiceError " + ignoreRouteError); if (parameter.equals(Boolean.TRUE.toString().toLowerCase())) { return Boolean.TRUE; } else if (parameter.equals(Boolean.FALSE.toString().toLowerCase())) { return Boolean.FALSE; } else { throw new InvalidParameterException(Config.ServiceInstanceParameters.IGNORE_ROUTE_SERVICE_ERROR, "bad parameter value. Must be a boolean value."); } } else { return Config.DEFAULT_IGNORE_SERVICE_ERROR; } } }; }  }
ParameterReaderFactory { @Bean(name = ServiceInstanceParameters.IGNORE_ROUTE_SERVICE_ERROR) public ParameterReader<Boolean> buildIgnoreRouteServiceErrorReader() { return new ParameterReader<Boolean>() { @Override public String getParameterName() { return Config.ServiceInstanceParameters.IGNORE_ROUTE_SERVICE_ERROR; } @Override public Boolean readParameter(Object parameter, boolean withDefault) throws InvalidParameterException { if (parameter != null) { String ignoreRouteError = ((String) parameter).toLowerCase(); log.debug("ignoreRouteServiceError " + ignoreRouteError); if (parameter.equals(Boolean.TRUE.toString().toLowerCase())) { return Boolean.TRUE; } else if (parameter.equals(Boolean.FALSE.toString().toLowerCase())) { return Boolean.FALSE; } else { throw new InvalidParameterException(Config.ServiceInstanceParameters.IGNORE_ROUTE_SERVICE_ERROR, "bad parameter value. Must be a boolean value."); } } else { return Config.DEFAULT_IGNORE_SERVICE_ERROR; } } }; }  @Bean(name = Config.ServiceInstanceParameters.AUTO_ENROLLMENT) ParameterReader<Enrollment> buildAutoEnrollmentReader(); @Bean(name = Config.ServiceInstanceParameters.EXCLUDE_FROM_AUTO_ENROLLMENT) ParameterReader<Pattern> buildExcludeFromAutoEnrollmentReader(); @Bean(name = Config.ServiceInstanceParameters.IDLE_DURATION) ParameterReader<Duration> buildIdleDurationReader(); @Bean(name = ServiceInstanceParameters.IGNORE_ROUTE_SERVICE_ERROR) ParameterReader<Boolean> buildIgnoreRouteServiceErrorReader(); @Bean(name = Config.ServiceInstanceParameters.SECRET) ParameterReader<String> buildSecretReader(); @Bean(name = EnrollmentConfig.EnrollmentParameters.STATE) ParameterReader<EnrollmentState> buildEnrollmentStateReader(); }
ParameterReaderFactory { @Bean(name = ServiceInstanceParameters.IGNORE_ROUTE_SERVICE_ERROR) public ParameterReader<Boolean> buildIgnoreRouteServiceErrorReader() { return new ParameterReader<Boolean>() { @Override public String getParameterName() { return Config.ServiceInstanceParameters.IGNORE_ROUTE_SERVICE_ERROR; } @Override public Boolean readParameter(Object parameter, boolean withDefault) throws InvalidParameterException { if (parameter != null) { String ignoreRouteError = ((String) parameter).toLowerCase(); log.debug("ignoreRouteServiceError " + ignoreRouteError); if (parameter.equals(Boolean.TRUE.toString().toLowerCase())) { return Boolean.TRUE; } else if (parameter.equals(Boolean.FALSE.toString().toLowerCase())) { return Boolean.FALSE; } else { throw new InvalidParameterException(Config.ServiceInstanceParameters.IGNORE_ROUTE_SERVICE_ERROR, "bad parameter value. Must be a boolean value."); } } else { return Config.DEFAULT_IGNORE_SERVICE_ERROR; } } }; }  @Bean(name = Config.ServiceInstanceParameters.AUTO_ENROLLMENT) ParameterReader<Enrollment> buildAutoEnrollmentReader(); @Bean(name = Config.ServiceInstanceParameters.EXCLUDE_FROM_AUTO_ENROLLMENT) ParameterReader<Pattern> buildExcludeFromAutoEnrollmentReader(); @Bean(name = Config.ServiceInstanceParameters.IDLE_DURATION) ParameterReader<Duration> buildIdleDurationReader(); @Bean(name = ServiceInstanceParameters.IGNORE_ROUTE_SERVICE_ERROR) ParameterReader<Boolean> buildIgnoreRouteServiceErrorReader(); @Bean(name = Config.ServiceInstanceParameters.SECRET) ParameterReader<String> buildSecretReader(); @Bean(name = EnrollmentConfig.EnrollmentParameters.STATE) ParameterReader<EnrollmentState> buildEnrollmentStateReader();  }