use of org.springframework.mock.env.MockEnvironment in project spring-boot-admin by codecentric.
the class SpringBootAdminClientEnabledConditionTest method test_nonEmptyUrl_enabled.
@Test
public void test_nonEmptyUrl_enabled() {
MockEnvironment environment = new MockEnvironment();
environment.setProperty("spring.boot.admin.url", "http://localhost:8080/management");
BDDMockito.given(conditionContext.getEnvironment()).willReturn(environment);
assertTrue(condition.getMatchOutcome(conditionContext, annotatedTypeMetadata).isMatch());
}
use of org.springframework.mock.env.MockEnvironment in project spring-boot-admin by codecentric.
the class SpringBootAdminClientEnabledConditionTest method test_emptyUrl_disabled.
@Test
public void test_emptyUrl_disabled() {
MockEnvironment environment = new MockEnvironment();
environment.setProperty("spring.boot.admin.client.enabled", "false");
BDDMockito.given(conditionContext.getEnvironment()).willReturn(environment);
assertFalse(condition.getMatchOutcome(conditionContext, annotatedTypeMetadata).isMatch());
}
use of org.springframework.mock.env.MockEnvironment in project spring-boot by spring-projects.
the class LocalDebugPortAvailableConditionTests method getOutcome.
private ConditionOutcome getOutcome() {
MockEnvironment environment = new MockEnvironment();
EnvironmentTestUtils.addEnvironment(environment, "spring.devtools.remote.debug.local-port:" + this.port);
ConditionContext context = mock(ConditionContext.class);
given(context.getEnvironment()).willReturn(environment);
ConditionOutcome outcome = this.condition.getMatchOutcome(context, null);
return outcome;
}
use of org.springframework.mock.env.MockEnvironment in project spring-boot by spring-projects.
the class DevToolsHomePropertiesPostProcessorTests method ignoresMissingHomeProperties.
@Test
public void ignoresMissingHomeProperties() throws Exception {
ConfigurableEnvironment environment = new MockEnvironment();
MockDevToolHomePropertiesPostProcessor postProcessor = new MockDevToolHomePropertiesPostProcessor();
postProcessor.postProcessEnvironment(environment, null);
assertThat(environment.getProperty("abc")).isNull();
}
use of org.springframework.mock.env.MockEnvironment in project spring-boot by spring-projects.
the class LocalHostWebClientTests method getPageWhenUrlIsRelativeAndNoPortWillUseLocalhost8080.
@Test
public void getPageWhenUrlIsRelativeAndNoPortWillUseLocalhost8080() throws Exception {
MockEnvironment environment = new MockEnvironment();
WebClient client = new LocalHostWebClient(environment);
WebConnection connection = mockConnection();
client.setWebConnection(connection);
client.getPage("/test");
verify(connection).getResponse(this.requestCaptor.capture());
assertThat(this.requestCaptor.getValue().getUrl()).isEqualTo(new URL("http://localhost:8080/test"));
}
Aggregations