BundleContentPropertyTests Class — spring-boot Architecture
Architecture documentation for the BundleContentPropertyTests class in BundleContentPropertyTests.java from the spring-boot codebase.
Entity Profile
Relationship Graph
Source Code
core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ssl/BundleContentPropertyTests.java lines 41–111
class BundleContentPropertyTests {
private static final String PEM_TEXT = """
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
""";
@Test
void isPemContentWhenValueIsPemTextReturnsTrue() {
BundleContentProperty property = new BundleContentProperty("name", PEM_TEXT);
assertThat(property.isPemContent()).isTrue();
}
@Test
void isPemContentWhenValueIsNotPemTextReturnsFalse() {
BundleContentProperty property = new BundleContentProperty("name", "file.pem");
assertThat(property.isPemContent()).isFalse();
}
@Test
void hasValueWhenHasValueReturnsTrue() {
BundleContentProperty property = new BundleContentProperty("name", "file.pem");
assertThat(property.hasValue()).isTrue();
}
@Test
void hasValueWhenHasNullValueReturnsFalse() {
BundleContentProperty property = new BundleContentProperty("name", null);
assertThat(property.hasValue()).isFalse();
}
@Test
void hasValueWhenHasEmptyValueReturnsFalse() {
BundleContentProperty property = new BundleContentProperty("name", "");
assertThat(property.hasValue()).isFalse();
}
@Test
void toWatchPathWhenNotPathThrowsException() {
BundleContentProperty property = new BundleContentProperty("name", PEM_TEXT);
assertThatIllegalStateException().isThrownBy(() -> property.toWatchPath(ApplicationResourceLoader.get()))
.withMessage("Unable to convert value of property 'name' to a path");
}
@Test
void toWatchPathWhenPathReturnsPath() throws URISyntaxException {
URL resource = getClass().getResource("keystore.jks");
Path file = Path.of(resource.toURI()).toAbsolutePath();
BundleContentProperty property = new BundleContentProperty("name", file.toString());
assertThat(property.toWatchPath(ApplicationResourceLoader.get())).isEqualTo(file);
}
@Test
void toWatchPathUsesResourceLoader() throws URISyntaxException {
URL resource = getClass().getResource("keystore.jks");
Path file = Path.of(resource.toURI()).toAbsolutePath();
BundleContentProperty property = new BundleContentProperty("name", file.toString());
ResourceLoader resourceLoader = spy(ApplicationResourceLoader.get());
assertThat(property.toWatchPath(resourceLoader)).isEqualTo(file);
then(resourceLoader).should(atLeastOnce()).getResource(file.toString());
}
@Test
void shouldThrowBundleContentNotWatchableExceptionIfContentIsNotWatchable() {
BundleContentProperty property = new BundleContentProperty("name", "https://example.com/");
assertThatExceptionOfType(BundleContentNotWatchableException.class)
.isThrownBy(() -> property.toWatchPath(ApplicationResourceLoader.get()))
.withMessageContaining("Only 'file:' resources are watchable");
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free