Home / Class/ LayerTests Class — spring-boot Architecture

LayerTests Class — spring-boot Architecture

Architecture documentation for the LayerTests class in LayerTests.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/LayerTests.java lines 38–72

class LayerTests {

	@Test
	@SuppressWarnings("NullAway") // Test null check
	void ofWhenLayoutIsNullThrowsException() {
		assertThatIllegalArgumentException().isThrownBy(() -> Layer.of((IOConsumer<Layout>) null))
			.withMessage("'layout' must not be null");
	}

	@Test
	@SuppressWarnings("NullAway") // Test null check
	void fromTarArchiveWhenTarArchiveIsNullThrowsException() {
		assertThatIllegalArgumentException().isThrownBy(() -> Layer.fromTarArchive(null))
			.withMessage("'tarArchive' must not be null");
	}

	@Test
	void ofCreatesLayer() throws Exception {
		Layer layer = Layer.of((layout) -> {
			layout.directory("/directory", Owner.ROOT);
			layout.file("/directory/file", Owner.ROOT, Content.of("test"));
		});
		assertThat(layer.getId())
			.hasToString("sha256:d03a34f73804698c875eb56ff694fc2fceccc69b645e4adceb004ed13588613b");
		ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
		layer.writeTo(outputStream);
		try (TarArchiveInputStream tarStream = new TarArchiveInputStream(
				new ByteArrayInputStream(outputStream.toByteArray()))) {
			assertThat(tarStream.getNextEntry().getName()).isEqualTo("/directory/");
			assertThat(tarStream.getNextEntry().getName()).isEqualTo("/directory/file");
			assertThat(tarStream.getNextEntry()).isNull();
		}
	}

}

Domain

Analyze Your Own Codebase

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

Try Supermodel Free