Home / Class/ ContainerConfigTests Class — spring-boot Architecture

ContainerConfigTests Class — spring-boot Architecture

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

Entity Profile

Relationship Graph

Source Code

buildpack/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/type/ContainerConfigTests.java lines 37–75

class ContainerConfigTests extends AbstractJsonTests {

	@Test
	@SuppressWarnings("NullAway") // Test null check
	void ofWhenImageReferenceIsNullThrowsException() {
		assertThatIllegalArgumentException().isThrownBy(() -> ContainerConfig.of(null, (update) -> {
		})).withMessage("'imageReference' must not be null");
	}

	@Test
	@SuppressWarnings("NullAway") // Test null check
	void ofWhenUpdateIsNullThrowsException() {
		ImageReference imageReference = ImageReference.of("ubuntu:bionic");
		assertThatIllegalArgumentException().isThrownBy(() -> ContainerConfig.of(imageReference, null))
			.withMessage("'update' must not be null");
	}

	@Test
	void writeToWritesJson() throws Exception {
		ImageReference imageReference = ImageReference.of("ubuntu:bionic");
		ContainerConfig containerConfig = ContainerConfig.of(imageReference, (update) -> {
			update.withUser("root");
			update.withCommand("ls", "-l");
			update.withArgs("-h");
			update.withLabel("spring", "boot");
			update.withBinding(Binding.from("bind-source", "bind-dest"));
			update.withEnv("name1", "value1");
			update.withEnv("name2", "value2");
			update.withNetworkMode("test");
			update.withSecurityOption("option=value");
		});
		ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
		containerConfig.writeTo(outputStream);
		String actualJson = outputStream.toString(StandardCharsets.UTF_8);
		String expectedJson = StreamUtils.copyToString(getContent("container-config.json"), StandardCharsets.UTF_8);
		JSONAssert.assertEquals(expectedJson, actualJson, true);
	}

}

Domain

Analyze Your Own Codebase

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

Try Supermodel Free