Home / Class/ ConditionalOnNotWarDeploymentTests Class — spring-boot Architecture

ConditionalOnNotWarDeploymentTests Class — spring-boot Architecture

Architecture documentation for the ConditionalOnNotWarDeploymentTests class in ConditionalOnNotWarDeploymentTests.java from the spring-boot codebase.

Entity Profile

Relationship Graph

Source Code

core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/condition/ConditionalOnNotWarDeploymentTests.java lines 35–77

class ConditionalOnNotWarDeploymentTests {

	@Test
	void nonWebApplicationShouldMatch() {
		ApplicationContextRunner contextRunner = new ApplicationContextRunner();
		contextRunner.withUserConfiguration(NotWarDeploymentConfiguration.class)
			.run((context) -> assertThat(context).hasBean("notForWar"));
	}

	@Test
	void reactiveWebApplicationShouldMatch() {
		ReactiveWebApplicationContextRunner contextRunner = new ReactiveWebApplicationContextRunner();
		contextRunner.withUserConfiguration(NotWarDeploymentConfiguration.class)
			.run((context) -> assertThat(context).hasBean("notForWar"));
	}

	@Test
	void embeddedServletWebApplicationShouldMatch() {
		WebApplicationContextRunner contextRunner = new WebApplicationContextRunner(
				AnnotationConfigServletWebApplicationContext::new);
		contextRunner.withUserConfiguration(NotWarDeploymentConfiguration.class)
			.run((context) -> assertThat(context).hasBean("notForWar"));
	}

	@Test
	void warDeployedServletWebApplicationShouldNotMatch() {
		WebApplicationContextRunner contextRunner = new WebApplicationContextRunner();
		contextRunner.withUserConfiguration(NotWarDeploymentConfiguration.class)
			.run((context) -> assertThat(context).doesNotHaveBean("notForWar"));
	}

	@Configuration(proxyBeanMethods = false)
	@ConditionalOnNotWarDeployment
	static class NotWarDeploymentConfiguration {

		@Bean
		String notForWar() {
			return "notForWar";
		}

	}

}

Domain

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free