@Test void testSmokeProperty() { this.contextRunner .run( context -> { final SpringApplication application = Mockito.mock(SpringApplication.class); final ConfigurableEnvironment environment = context.getEnvironment(); Assertions.assertThat( environment .getPropertySources() .contains(GenieDefaultPropertiesPostProcessor.DEFAULT_PROPERTY_SOURCE_NAME) ).isFalse(); Assertions.assertThat(environment.getProperty("genie.smoke")).isBlank(); this.processor.postProcessEnvironment(environment, application); Assertions .assertThat( environment .getPropertySources() .contains(GenieDefaultPropertiesPostProcessor.DEFAULT_PROPERTY_SOURCE_NAME) ) .isTrue(); Assertions .assertThat(environment.getProperty("genie.smoke", Boolean.class, false)) .isTrue(); } ); }
@Override public void postProcessEnvironment(final ConfigurableEnvironment environment, final SpringApplication application) { final Resource defaultProperties = new ClassPathResource(DEFAULT_PROPERTIES_FILE); final PropertySource<?> defaultSource = PropertySourceUtils.loadYamlPropertySource(DEFAULT_PROPERTY_SOURCE_NAME, defaultProperties); environment.getPropertySources().addLast(defaultSource); }
GenieDefaultPropertiesPostProcessor implements EnvironmentPostProcessor { @Override public void postProcessEnvironment(final ConfigurableEnvironment environment, final SpringApplication application) { final Resource defaultProperties = new ClassPathResource(DEFAULT_PROPERTIES_FILE); final PropertySource<?> defaultSource = PropertySourceUtils.loadYamlPropertySource(DEFAULT_PROPERTY_SOURCE_NAME, defaultProperties); environment.getPropertySources().addLast(defaultSource); } }
GenieDefaultPropertiesPostProcessor implements EnvironmentPostProcessor { @Override public void postProcessEnvironment(final ConfigurableEnvironment environment, final SpringApplication application) { final Resource defaultProperties = new ClassPathResource(DEFAULT_PROPERTIES_FILE); final PropertySource<?> defaultSource = PropertySourceUtils.loadYamlPropertySource(DEFAULT_PROPERTY_SOURCE_NAME, defaultProperties); environment.getPropertySources().addLast(defaultSource); }  }
GenieDefaultPropertiesPostProcessor implements EnvironmentPostProcessor { @Override public void postProcessEnvironment(final ConfigurableEnvironment environment, final SpringApplication application) { final Resource defaultProperties = new ClassPathResource(DEFAULT_PROPERTIES_FILE); final PropertySource<?> defaultSource = PropertySourceUtils.loadYamlPropertySource(DEFAULT_PROPERTY_SOURCE_NAME, defaultProperties); environment.getPropertySources().addLast(defaultSource); }  @Override void postProcessEnvironment(final ConfigurableEnvironment environment, final SpringApplication application); }
GenieDefaultPropertiesPostProcessor implements EnvironmentPostProcessor { @Override public void postProcessEnvironment(final ConfigurableEnvironment environment, final SpringApplication application) { final Resource defaultProperties = new ClassPathResource(DEFAULT_PROPERTIES_FILE); final PropertySource<?> defaultSource = PropertySourceUtils.loadYamlPropertySource(DEFAULT_PROPERTY_SOURCE_NAME, defaultProperties); environment.getPropertySources().addLast(defaultSource); }  @Override void postProcessEnvironment(final ConfigurableEnvironment environment, final SpringApplication application);  }