Home / Class/ DefaultPropertyMapperTests Class — spring-boot Architecture

DefaultPropertyMapperTests Class — spring-boot Architecture

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

Entity Profile

Source Code

core/spring-boot/src/test/java/org/springframework/boot/context/properties/source/DefaultPropertyMapperTests.java lines 29–63

class DefaultPropertyMapperTests extends AbstractPropertyMapperTests {

	@Override
	protected PropertyMapper getMapper() {
		return DefaultPropertyMapper.INSTANCE;
	}

	@Test
	void mapFromStringShouldReturnBestGuess() {
		assertThat(mapPropertySourceName("server")).isEqualTo("server");
		assertThat(mapPropertySourceName("server.port")).isEqualTo("server.port");
		assertThat(mapPropertySourceName("host[0]")).isEqualTo("host[0]");
		assertThat(mapPropertySourceName("host[0][1]")).isEqualTo("host[0][1]");
		assertThat(mapPropertySourceName("host[0].name")).isEqualTo("host[0].name");
		assertThat(mapPropertySourceName("host.f00.name")).isEqualTo("host.f00.name");
		assertThat(mapPropertySourceName("my.host-name")).isEqualTo("my.host-name");
		assertThat(mapPropertySourceName("my.hostName")).isEqualTo("my.hostname");
		assertThat(mapPropertySourceName("my.HOST_NAME")).isEqualTo("my.hostname");
		assertThat(mapPropertySourceName("s[!@#$%^&*()=+]e-rVeR")).isEqualTo("s[!@#$%^&*()=+].e-rver");
		assertThat(mapPropertySourceName("host[FOO].name")).isEqualTo("host[FOO].name");
	}

	@Test
	void mapFromConfigurationShouldReturnBestGuess() {
		assertThat(mapConfigurationPropertyName("server")).containsExactly("server");
		assertThat(mapConfigurationPropertyName("server.port")).containsExactly("server.port");
		assertThat(mapConfigurationPropertyName("host[0]")).containsExactly("host[0]");
		assertThat(mapConfigurationPropertyName("host[0][1]")).containsExactly("host[0][1]");
		assertThat(mapConfigurationPropertyName("host[0].name")).containsExactly("host[0].name");
		assertThat(mapConfigurationPropertyName("host.f00.name")).containsExactly("host.f00.name");
		assertThat(mapConfigurationPropertyName("my.host-name")).containsExactly("my.host-name");
		assertThat(mapConfigurationPropertyName("host[FOO].name")).containsExactly("host[FOO].name");
	}

}

Analyze Your Own Codebase

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

Try Supermodel Free