Aligned with PathMatchingResourcePatternResolverTests on main

See gh-29333
This commit is contained in:
Juergen Hoeller 2022-10-18 23:04:44 +02:00
parent 6f64cfd1e5
commit dbcfeb8f4f
1 changed files with 5 additions and 6 deletions

View File

@ -146,15 +146,14 @@ class PathMatchingResourcePatternResolverTests {
}
@Test
void usingClasspathStarProtocolWithWildcardInPatternAndEndingWithSlashStarStar() throws Exception {
String pattern = "classpath*:org/springframework/core/io/sup*/**";
void usingClasspathStarProtocolWithWildcardInPatternAndEndingWithSuffixPattern() throws Exception {
String pattern = "classpath*:org/springframework/core/io/sup*/*.txt";
String pathPrefix = ".+org/springframework/core/io/";
List<String> actualSubPaths = getSubPathsIgnoringClassFiles(pattern, pathPrefix);
// We DO find "support" if the pattern ENDS with "/**".
assertThat(actualSubPaths)
.containsExactlyInAnyOrder("support", "support/resource#test1.txt", "support/resource#test2.txt");
.containsExactlyInAnyOrder("support/resource#test1.txt", "support/resource#test2.txt");
}
private List<String> getSubPathsIgnoringClassFiles(String pattern, String pathPrefix) throws IOException {
@ -167,7 +166,7 @@ class PathMatchingResourcePatternResolverTests {
}
@Test
void usingFileProtocolWithoutWildcardInPatternAndEndingInSlashStarStar() throws Exception {
void usingFileProtocolWithoutWildcardInPatternAndEndingInSlashStarStar() {
Path testResourcesDir = Paths.get("src/test/resources").toAbsolutePath();
String pattern = String.format("file:%s/scanned-resources/**", testResourcesDir);
String pathPrefix = ".+?resources/";
@ -179,7 +178,7 @@ class PathMatchingResourcePatternResolverTests {
}
@Test
void usingFileProtocolWithWildcardInPatternAndEndingInSlashStarStar() throws Exception {
void usingFileProtocolWithWildcardInPatternAndEndingInSlashStarStar() {
Path testResourcesDir = Paths.get("src/test/resources").toAbsolutePath();
String pattern = String.format("file:%s/scanned*resources/**", testResourcesDir);
String pathPrefix = ".+?resources/";