Search in sources :

Example 1 with CommandLinePropertySource

use of cn.taketoday.core.env.CommandLinePropertySource in project today-infrastructure by TAKETODAY.

the class ApplicationTests method commandLinePropertySource.

@Test
void commandLinePropertySource() {
    Application application = new Application(ExampleConfig.class);
    application.setApplicationType(ApplicationType.NONE_WEB);
    ConfigurableEnvironment environment = new StandardEnvironment();
    application.setEnvironment(environment);
    this.context = application.run("--foo=bar");
    assertThat(environment).has(matchingPropertySource(CommandLinePropertySource.class, "commandLineArgs"));
}
Also used : ConfigurableEnvironment(cn.taketoday.core.env.ConfigurableEnvironment) CommandLinePropertySource(cn.taketoday.core.env.CommandLinePropertySource) StandardEnvironment(cn.taketoday.core.env.StandardEnvironment) Test(org.junit.jupiter.api.Test)

Example 2 with CommandLinePropertySource

use of cn.taketoday.core.env.CommandLinePropertySource in project today-framework by TAKETODAY.

the class ApplicationTests method commandLinePropertySource.

@Test
void commandLinePropertySource() {
    Application application = new Application(ExampleConfig.class);
    application.setApplicationType(ApplicationType.NONE_WEB);
    ConfigurableEnvironment environment = new StandardEnvironment();
    application.setEnvironment(environment);
    this.context = application.run("--foo=bar");
    assertThat(environment).has(matchingPropertySource(CommandLinePropertySource.class, "commandLineArgs"));
}
Also used : ConfigurableEnvironment(cn.taketoday.core.env.ConfigurableEnvironment) CommandLinePropertySource(cn.taketoday.core.env.CommandLinePropertySource) StandardEnvironment(cn.taketoday.core.env.StandardEnvironment) Test(org.junit.jupiter.api.Test)

Aggregations

CommandLinePropertySource (cn.taketoday.core.env.CommandLinePropertySource)2 ConfigurableEnvironment (cn.taketoday.core.env.ConfigurableEnvironment)2 StandardEnvironment (cn.taketoday.core.env.StandardEnvironment)2 Test (org.junit.jupiter.api.Test)2