Home / Class/ AutoConfigurationReplacementsTests Class — spring-boot Architecture

AutoConfigurationReplacementsTests Class — spring-boot Architecture

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

Entity Profile

Source Code

core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationReplacementsTests.java lines 39–79

@WithResource(
		name = "META-INF/spring/org.springframework.boot.autoconfigure.AutoConfigurationReplacementsTests$TestAutoConfigurationReplacements.replacements",
		content = """
				com.example.A1=com.example.A2
				com.example.B1=com.example.B2
				""")
class AutoConfigurationReplacementsTests {

	private AutoConfigurationReplacements replacements;

	@BeforeEach
	void loadReplacements() {
		this.replacements = AutoConfigurationReplacements.load(TestAutoConfigurationReplacements.class,
				Thread.currentThread().getContextClassLoader());
	}

	@Test
	void replaceWhenMatchReplacesClassName() {
		assertThat(this.replacements.replace("com.example.A1")).isEqualTo("com.example.A2");
	}

	@Test
	void replaceWhenNoMatchReturnsOriginalClassName() {
		assertThat(this.replacements.replace("com.example.Z1")).isEqualTo("com.example.Z1");
	}

	@Test
	void replaceAllReplacesAllMatching() {
		Set<String> classNames = new LinkedHashSet<>(
				List.of("com.example.A1", "com.example.B1", "com.example.Y1", "com.example.Z1"));
		assertThat(this.replacements.replaceAll(classNames)).containsExactly("com.example.A2", "com.example.B2",
				"com.example.Y1", "com.example.Z1");
	}

	@Target(ElementType.TYPE)
	@Retention(RetentionPolicy.RUNTIME)
	@interface TestAutoConfigurationReplacements {

	}

}

Analyze Your Own Codebase

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

Try Supermodel Free