Home / Class/ BuildPropertiesTests Class — spring-boot Architecture

BuildPropertiesTests Class — spring-boot Architecture

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

Entity Profile

Source Code

core/spring-boot/src/test/java/org/springframework/boot/info/BuildPropertiesTests.java lines 37–77

class BuildPropertiesTests {

	@Test
	void basicInfo() {
		Instant instant = Instant.now();
		BuildProperties properties = new BuildProperties(
				createProperties("com.example", "demo", "0.0.1", DateTimeFormatter.ISO_INSTANT.format(instant)));
		assertThat(properties.getGroup()).isEqualTo("com.example");
		assertThat(properties.getArtifact()).isEqualTo("demo");
		assertThat(properties.getVersion()).isEqualTo("0.0.1");
		assertThat(properties.getTime()).isEqualTo(instant.truncatedTo(ChronoUnit.MILLIS));
		assertThat(properties.get("time")).isEqualTo(String.valueOf(instant.toEpochMilli()));
	}

	@Test
	void noInfo() {
		BuildProperties properties = new BuildProperties(new Properties());
		assertThat(properties.getGroup()).isNull();
		assertThat(properties.getArtifact()).isNull();
		assertThat(properties.getVersion()).isNull();
		assertThat(properties.getTime()).isNull();
	}

	@Test
	void shouldRegisterHints() {
		RuntimeHints runtimeHints = new RuntimeHints();
		new BuildProperties.BuildPropertiesRuntimeHints().registerHints(runtimeHints, getClass().getClassLoader());
		assertThat(RuntimeHintsPredicates.resource().forResource("META-INF/build-info.properties"))
			.accepts(runtimeHints);
	}

	private static Properties createProperties(String group, String artifact, String version, String buildTime) {
		Properties properties = new Properties();
		properties.put("group", group);
		properties.put("artifact", artifact);
		properties.put("version", version);
		properties.put("time", buildTime);
		return properties;
	}

}

Analyze Your Own Codebase

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

Try Supermodel Free