LevelConfigurationTests Class — spring-boot Architecture
Architecture documentation for the LevelConfigurationTests class in LoggerConfigurationTests.java from the spring-boot codebase.
Entity Profile
Source Code
core/spring-boot/src/test/java/org/springframework/boot/logging/LoggerConfigurationTests.java lines 119–191
@Nested
class LevelConfigurationTests {
@Test
@SuppressWarnings("NullAway") // Test null check
void ofWhenLogLevelIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> LevelConfiguration.of(null))
.withMessage("'logLevel' must not be null");
}
@Test
void ofCreatesConfiguration() {
LevelConfiguration configuration = LevelConfiguration.of(LogLevel.DEBUG);
assertThat(configuration.getLevel()).isEqualTo(LogLevel.DEBUG);
}
@Test
@SuppressWarnings("NullAway") // Test null check
void ofCustomWhenNameIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> LevelConfiguration.ofCustom(null))
.withMessage("'name' must not be empty");
}
@Test
void ofCustomWhenNameIsEmptyThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> LevelConfiguration.ofCustom(""))
.withMessage("'name' must not be empty");
}
@Test
void ofCustomCreatesConfiguration() {
LevelConfiguration configuration = LevelConfiguration.ofCustom("FINE");
assertThat(configuration).isNotNull();
}
@Test
void getNameWhenFromLogLevelReturnsName() {
LevelConfiguration configuration = LevelConfiguration.of(LogLevel.DEBUG);
assertThat(configuration.getName()).isEqualTo("DEBUG");
}
@Test
void getNameWhenCustomReturnsName() {
LevelConfiguration configuration = LevelConfiguration.ofCustom("FINE");
assertThat(configuration.getName()).isEqualTo("FINE");
}
@Test
void getLevelWhenCustomThrowsException() {
LevelConfiguration configuration = LevelConfiguration.ofCustom("FINE");
assertThatIllegalStateException().isThrownBy(configuration::getLevel)
.withMessage("Unable to provide LogLevel for 'FINE'");
}
@Test
void getLevelReturnsLevel() {
LevelConfiguration configuration = LevelConfiguration.of(LogLevel.DEBUG);
assertThat(configuration.getLevel()).isEqualTo(LogLevel.DEBUG);
}
@Test
void isCustomWhenNotCustomReturnsFalse() {
LevelConfiguration configuration = LevelConfiguration.of(LogLevel.DEBUG);
assertThat(configuration.isCustom()).isFalse();
}
@Test
void isCustomWhenCustomReturnsTrue() {
LevelConfiguration configuration = LevelConfiguration.ofCustom("DEBUG");
assertThat(configuration.isCustom()).isTrue();
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free