TemplateRuntimeHintsTests Class — spring-boot Architecture
Architecture documentation for the TemplateRuntimeHintsTests class in TemplateRuntimeHintsTests.java from the spring-boot codebase.
Entity Profile
Source Code
core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/template/TemplateRuntimeHintsTests.java lines 38–69
class TemplateRuntimeHintsTests {
private static final Predicate<RuntimeHints> TEST_PREDICATE = RuntimeHintsPredicates.resource()
.forResource("templates/something/hello.html");
@Test
void templateRuntimeHintsIsRegistered() {
Iterable<RuntimeHintsRegistrar> registrar = AotServices.factories().load(RuntimeHintsRegistrar.class);
assertThat(registrar).anyMatch(TemplateRuntimeHints.class::isInstance);
}
@Test
@WithResource(name = "templates/test.html")
void contributeWhenTemplateLocationExists() {
RuntimeHints runtimeHints = contribute(Thread.currentThread().getContextClassLoader());
assertThat(TEST_PREDICATE.test(runtimeHints)).isTrue();
}
@Test
void contributeWhenTemplateLocationDoesNotExist() {
FilteredClassLoader classLoader = new FilteredClassLoader(new ClassPathResource("templates"));
RuntimeHints runtimeHints = contribute(classLoader);
assertThat(TEST_PREDICATE.test(runtimeHints)).isFalse();
}
private RuntimeHints contribute(ClassLoader classLoader) {
RuntimeHints runtimeHints = new RuntimeHints();
new TemplateRuntimeHints().registerHints(runtimeHints, classLoader);
return runtimeHints;
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free