Search in sources :

Example 1 with ApplicationBuilder

use of cn.taketoday.framework.builder.ApplicationBuilder in project today-infrastructure by TAKETODAY.

the class FailureAnalyzersIntegrationTests method analysisIsPerformed.

@Test
void analysisIsPerformed(CapturedOutput output) {
    assertThatExceptionOfType(Exception.class).isThrownBy(() -> new ApplicationBuilder(TestConfiguration.class).type(ApplicationType.NONE_WEB).run());
    assertThat(output).contains("APPLICATION FAILED TO START");
}
Also used : ApplicationBuilder(cn.taketoday.framework.builder.ApplicationBuilder) PortInUseException(cn.taketoday.framework.web.server.PortInUseException) Test(org.junit.jupiter.api.Test)

Example 2 with ApplicationBuilder

use of cn.taketoday.framework.builder.ApplicationBuilder in project today-infrastructure by TAKETODAY.

the class ApplicationTests method defaultPropertiesShouldBeMerged.

@Test
void defaultPropertiesShouldBeMerged() {
    MockEnvironment environment = new MockEnvironment();
    environment.getPropertySources().addFirst(new MapPropertySource(DefaultPropertiesPropertySource.NAME, Collections.singletonMap("bar", "foo")));
    Application application = new ApplicationBuilder(ExampleConfig.class).environment(environment).properties("baz=bing").type(ApplicationType.NONE_WEB).build();
    this.context = application.run();
    assertThat(getEnvironment().getProperty("bar")).isEqualTo("foo");
    assertThat(getEnvironment().getProperty("baz")).isEqualTo("bing");
}
Also used : ApplicationBuilder(cn.taketoday.framework.builder.ApplicationBuilder) MockEnvironment(cn.taketoday.mock.env.MockEnvironment) MapPropertySource(cn.taketoday.core.env.MapPropertySource) Test(org.junit.jupiter.api.Test)

Example 3 with ApplicationBuilder

use of cn.taketoday.framework.builder.ApplicationBuilder in project today-framework by TAKETODAY.

the class FailureAnalyzersIntegrationTests method analysisIsPerformed.

@Test
void analysisIsPerformed(CapturedOutput output) {
    assertThatExceptionOfType(Exception.class).isThrownBy(() -> new ApplicationBuilder(TestConfiguration.class).type(ApplicationType.NONE_WEB).run());
    assertThat(output).contains("APPLICATION FAILED TO START");
}
Also used : ApplicationBuilder(cn.taketoday.framework.builder.ApplicationBuilder) PortInUseException(cn.taketoday.framework.web.server.PortInUseException) Test(org.junit.jupiter.api.Test)

Example 4 with ApplicationBuilder

use of cn.taketoday.framework.builder.ApplicationBuilder in project today-framework by TAKETODAY.

the class ApplicationTests method defaultPropertiesShouldBeMerged.

@Test
void defaultPropertiesShouldBeMerged() {
    MockEnvironment environment = new MockEnvironment();
    environment.getPropertySources().addFirst(new MapPropertySource(DefaultPropertiesPropertySource.NAME, Collections.singletonMap("bar", "foo")));
    Application application = new ApplicationBuilder(ExampleConfig.class).environment(environment).properties("baz=bing").type(ApplicationType.NONE_WEB).build();
    this.context = application.run();
    assertThat(getEnvironment().getProperty("bar")).isEqualTo("foo");
    assertThat(getEnvironment().getProperty("baz")).isEqualTo("bing");
}
Also used : ApplicationBuilder(cn.taketoday.framework.builder.ApplicationBuilder) MockEnvironment(cn.taketoday.mock.env.MockEnvironment) MapPropertySource(cn.taketoday.core.env.MapPropertySource) Test(org.junit.jupiter.api.Test)

Aggregations

ApplicationBuilder (cn.taketoday.framework.builder.ApplicationBuilder)4 Test (org.junit.jupiter.api.Test)4 MapPropertySource (cn.taketoday.core.env.MapPropertySource)2 PortInUseException (cn.taketoday.framework.web.server.PortInUseException)2 MockEnvironment (cn.taketoday.mock.env.MockEnvironment)2