Fix build

Commit 29f085bd1a690ff7281e00b3a925e1160850ffbb in Spring Framework
automatically registers hints for enclosing directories. This fixes the
tests to expect hints for those directories as well.
pull/32943/head
Moritz Halbritter 2 years ago
parent ec0d598ba4
commit 50599c5046

@ -42,13 +42,14 @@ class WebResourcesRuntimeHintsTests {
RuntimeHints hints = register( RuntimeHints hints = register(
new TestClassLoader(List.of("META-INF/resources/", "resources/", "static/", "public/"))); new TestClassLoader(List.of("META-INF/resources/", "resources/", "static/", "public/")));
assertThat(hints.resources().resourcePatternHints()).singleElement() assertThat(hints.resources().resourcePatternHints()).singleElement()
.satisfies(include("META-INF/resources/*", "resources/*", "static/*", "public/*")); .satisfies(include("META-INF", "META-INF/resources", "META-INF/resources/*", "resources", "resources/*",
"static", "static/*", "public", "public/*"));
} }
@Test @Test
void registerHintsWithOnlyStaticLocations() { void registerHintsWithOnlyStaticLocations() {
RuntimeHints hints = register(new TestClassLoader(List.of("static/"))); RuntimeHints hints = register(new TestClassLoader(List.of("static/")));
assertThat(hints.resources().resourcePatternHints()).singleElement().satisfies(include("static/*")); assertThat(hints.resources().resourcePatternHints()).singleElement().satisfies(include("static", "static/*"));
} }
@Test @Test
@ -66,7 +67,7 @@ class WebResourcesRuntimeHintsTests {
private Consumer<ResourcePatternHints> include(String... patterns) { private Consumer<ResourcePatternHints> include(String... patterns) {
return (hint) -> { return (hint) -> {
assertThat(hint.getIncludes()).map(ResourcePatternHint::getPattern).containsExactly(patterns); assertThat(hint.getIncludes()).map(ResourcePatternHint::getPattern).containsExactlyInAnyOrder(patterns);
assertThat(hint.getExcludes()).isEmpty(); assertThat(hint.getExcludes()).isEmpty();
}; };
} }

Loading…
Cancel
Save