Home / Class/ ImagePlatformTests Class — spring-boot Architecture

ImagePlatformTests Class — spring-boot Architecture

Architecture documentation for the ImagePlatformTests class in ImagePlatformTests.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/ImagePlatformTests.java lines 29–85

class ImagePlatformTests extends AbstractJsonTests {

	@Test
	void ofWithOsParses() {
		ImagePlatform platform = ImagePlatform.of("linux");
		assertThat(platform.toString()).isEqualTo("linux");
	}

	@Test
	void ofWithOsAndArchitectureParses() {
		ImagePlatform platform = ImagePlatform.of("linux/amd64");
		assertThat(platform.toString()).isEqualTo("linux/amd64");
	}

	@Test
	void ofWithOsAndArchitectureAndVariantParses() {
		ImagePlatform platform = ImagePlatform.of("linux/amd64/v1");
		assertThat(platform.toString()).isEqualTo("linux/amd64/v1");
	}

	@Test
	void ofWithEmptyValueFails() {
		assertThatIllegalArgumentException().isThrownBy(() -> ImagePlatform.of(""))
			.withMessageContaining("'value' must not be empty");
	}

	@Test
	void ofWithTooManySegmentsFails() {
		assertThatIllegalArgumentException().isThrownBy(() -> ImagePlatform.of("linux/amd64/v1/extra"))
			.withMessageContaining("'value' [linux/amd64/v1/extra] must be in the form");
	}

	@Test
	void fromImageMatchesImage() throws IOException {
		ImagePlatform platform = ImagePlatform.from(getImage());
		assertThat(platform.toString()).isEqualTo("linux/amd64/v1");
	}

	@Test
	void toJsonString() {
		ImagePlatform platform = ImagePlatform.of("linux/amd64/v1");
		assertThat(platform.toJson()).isEqualTo("""
				{"os":"linux","architecture":"amd64","variant":"v1"}""");
	}

	@Test
	void toJsonStringWhenOnlyOs() {
		ImagePlatform platform = ImagePlatform.of("linux");
		assertThat(platform.toJson()).isEqualTo("""
				{"os":"linux"}""");
	}

	private Image getImage() throws IOException {
		return Image.of(getContent("type/image.json"));
	}

}

Domain

Analyze Your Own Codebase

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

Try Supermodel Free