@Test public void test_secret_handle_right_parameter() { ParameterReader<String> secretReader = factory.buildSecretReader(); String parameter = secretReader.getParameterName(); assertThat(parameter, is(equalTo(ServiceInstanceParameters.SECRET))); }
@Bean(name = Config.ServiceInstanceParameters.SECRET) public ParameterReader<String> buildSecretReader() { return new ParameterReader<String>() { @Override public String getParameterName() { return Config.ServiceInstanceParameters.SECRET; } @Override public String readParameter(Object parameter, boolean withDefault) throws InvalidParameterException { if (parameter != null) { return String.class.cast(parameter); } else { return null; } } }; }
ParameterReaderFactory { @Bean(name = Config.ServiceInstanceParameters.SECRET) public ParameterReader<String> buildSecretReader() { return new ParameterReader<String>() { @Override public String getParameterName() { return Config.ServiceInstanceParameters.SECRET; } @Override public String readParameter(Object parameter, boolean withDefault) throws InvalidParameterException { if (parameter != null) { return String.class.cast(parameter); } else { return null; } } }; } }
ParameterReaderFactory { @Bean(name = Config.ServiceInstanceParameters.SECRET) public ParameterReader<String> buildSecretReader() { return new ParameterReader<String>() { @Override public String getParameterName() { return Config.ServiceInstanceParameters.SECRET; } @Override public String readParameter(Object parameter, boolean withDefault) throws InvalidParameterException { if (parameter != null) { return String.class.cast(parameter); } else { return null; } } }; }  }
ParameterReaderFactory { @Bean(name = Config.ServiceInstanceParameters.SECRET) public ParameterReader<String> buildSecretReader() { return new ParameterReader<String>() { @Override public String getParameterName() { return Config.ServiceInstanceParameters.SECRET; } @Override public String readParameter(Object parameter, boolean withDefault) throws InvalidParameterException { if (parameter != null) { return String.class.cast(parameter); } else { return null; } } }; }  @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 = Config.ServiceInstanceParameters.SECRET) public ParameterReader<String> buildSecretReader() { return new ParameterReader<String>() { @Override public String getParameterName() { return Config.ServiceInstanceParameters.SECRET; } @Override public String readParameter(Object parameter, boolean withDefault) throws InvalidParameterException { if (parameter != null) { return String.class.cast(parameter); } else { return null; } } }; }  @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();  }