Home / Class/ InfoPropertiesTests Class — spring-boot Architecture

InfoPropertiesTests Class — spring-boot Architecture

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

Entity Profile

Source Code

core/spring-boot/src/test/java/org/springframework/boot/info/InfoPropertiesTests.java lines 33–86

class InfoPropertiesTests {

	@Test
	void inputIsImmutable() {
		Properties p = new Properties();
		p.put("foo", "bar");
		InfoProperties infoProperties = new InfoProperties(p);
		assertThat(infoProperties.get("foo")).isEqualTo("bar");
		p.remove("foo");
		assertThat(infoProperties.get("foo")).isEqualTo("bar");
	}

	@Test
	void iterator() {
		Properties p = new Properties();
		p.put("one", "first");
		p.put("two", "second");
		InfoProperties infoProperties = new InfoProperties(p);
		Properties copy = new Properties();
		for (InfoProperties.Entry entry : infoProperties) {
			copy.put(entry.getKey(), entry.getValue());
		}
		assertThat(p).isEqualTo(copy);
	}

	@Test
	void removeNotSupported() {
		Properties p = new Properties();
		p.put("foo", "bar");
		InfoProperties infoProperties = new InfoProperties(p);
		assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(infoProperties.iterator()::remove);
	}

	@Test
	void toPropertySources() {
		Properties p = new Properties();
		p.put("one", "first");
		p.put("two", "second");
		InfoProperties infoProperties = new MyInfoProperties(p);
		PropertySource<?> source = infoProperties.toPropertySource();
		assertThat(source.getProperty("one")).isEqualTo("first");
		assertThat(source.getProperty("two")).isEqualTo("second");
		assertThat(source.getName()).isEqualTo("MyInfoProperties");
	}

	static class MyInfoProperties extends InfoProperties {

		MyInfoProperties(Properties entries) {
			super(entries);
		}

	}

}

Analyze Your Own Codebase

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

Try Supermodel Free