Search in sources :

Example 1 with CommandLinePropertySource

use of org.springframework.core.env.CommandLinePropertySource in project spring-boot by spring-projects.

the class SpringApplicationTests method commandLinePropertySource.

@Test
public void commandLinePropertySource() throws Exception {
    SpringApplication application = new SpringApplication(ExampleConfig.class);
    application.setWebApplicationType(WebApplicationType.NONE);
    ConfigurableEnvironment environment = new StandardEnvironment();
    application.setEnvironment(environment);
    this.context = application.run("--foo=bar");
    assertThat(environment).has(matchingPropertySource(CommandLinePropertySource.class, "commandLineArgs"));
}
Also used : ConfigurableEnvironment(org.springframework.core.env.ConfigurableEnvironment) CommandLinePropertySource(org.springframework.core.env.CommandLinePropertySource) StandardEnvironment(org.springframework.core.env.StandardEnvironment) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 CommandLinePropertySource (org.springframework.core.env.CommandLinePropertySource)1 ConfigurableEnvironment (org.springframework.core.env.ConfigurableEnvironment)1 StandardEnvironment (org.springframework.core.env.StandardEnvironment)1