ConditionalOnCloudPlatformTests Class — spring-boot Architecture
Architecture documentation for the ConditionalOnCloudPlatformTests class in ConditionalOnCloudPlatformTests.java from the spring-boot codebase.
Entity Profile
Relationship Graph
Source Code
core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnCloudPlatformTests.java lines 31–77
class ConditionalOnCloudPlatformTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner();
@Test
void outcomeWhenCloudfoundryPlatformNotPresentShouldNotMatch() {
this.contextRunner.withUserConfiguration(CloudFoundryPlatformConfig.class)
.run((context) -> assertThat(context).doesNotHaveBean("foo"));
}
@Test
void outcomeWhenCloudfoundryPlatformPresentShouldMatch() {
this.contextRunner.withUserConfiguration(CloudFoundryPlatformConfig.class)
.withPropertyValues("VCAP_APPLICATION:---")
.run((context) -> assertThat(context).hasBean("foo"));
}
@Test
void outcomeWhenCloudfoundryPlatformPresentAndMethodTargetShouldMatch() {
this.contextRunner.withUserConfiguration(CloudFoundryPlatformOnMethodConfig.class)
.withPropertyValues("VCAP_APPLICATION:---")
.run((context) -> assertThat(context).hasBean("foo"));
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnCloudPlatform(CloudPlatform.CLOUD_FOUNDRY)
static class CloudFoundryPlatformConfig {
@Bean
String foo() {
return "foo";
}
}
@Configuration(proxyBeanMethods = false)
static class CloudFoundryPlatformOnMethodConfig {
@Bean
@ConditionalOnCloudPlatform(CloudPlatform.CLOUD_FOUNDRY)
String foo() {
return "foo";
}
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free