use of org.springframework.mock.env.MockEnvironment in project spring-boot by spring-projects.
the class DefaultServletWebServerFactoryCustomizerTests method deduceUseForwardHeadersUndertow.
@Test
public void deduceUseForwardHeadersUndertow() throws Exception {
this.customizer.setEnvironment(new MockEnvironment().withProperty("DYNO", "-"));
UndertowServletWebServerFactory factory = spy(new UndertowServletWebServerFactory());
this.customizer.customize(factory);
verify(factory).setUseForwardHeaders(true);
}
use of org.springframework.mock.env.MockEnvironment in project spring-boot by spring-projects.
the class LocalHostUriTemplateHandlerTests method getRootUriUsesCustomScheme.
@Test
public void getRootUriUsesCustomScheme() {
MockEnvironment environment = new MockEnvironment();
LocalHostUriTemplateHandler handler = new LocalHostUriTemplateHandler(environment, "https");
assertThat(handler.getRootUri()).isEqualTo("https://localhost:8080");
}
use of org.springframework.mock.env.MockEnvironment in project spring-boot by spring-projects.
the class LocalHostUriTemplateHandlerTests method getRootUriShouldUseLocalServerPort.
@Test
public void getRootUriShouldUseLocalServerPort() throws Exception {
MockEnvironment environment = new MockEnvironment();
environment.setProperty("local.server.port", "1234");
LocalHostUriTemplateHandler handler = new LocalHostUriTemplateHandler(environment);
assertThat(handler.getRootUri()).isEqualTo("http://localhost:1234");
}
use of org.springframework.mock.env.MockEnvironment in project spring-boot by spring-projects.
the class LocalHostUriTemplateHandlerTests method createWhenSchemeIsNullShouldThrowException.
@Test
public void createWhenSchemeIsNullShouldThrowException() {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("Scheme must not be null");
new LocalHostUriTemplateHandler(new MockEnvironment(), null);
}
use of org.springframework.mock.env.MockEnvironment in project spring-boot by spring-projects.
the class LocalHostUriTemplateHandlerTests method getRootUriWhenLocalServerPortMissingShouldUsePort8080.
@Test
public void getRootUriWhenLocalServerPortMissingShouldUsePort8080() throws Exception {
MockEnvironment environment = new MockEnvironment();
LocalHostUriTemplateHandler handler = new LocalHostUriTemplateHandler(environment);
assertThat(handler.getRootUri()).isEqualTo("http://localhost:8080");
}
Aggregations