|
19 | 19 | import java.io.FileNotFoundException;
|
20 | 20 | import java.io.IOException;
|
21 | 21 | import java.io.UncheckedIOException;
|
| 22 | +import java.net.URLDecoder; |
22 | 23 | import java.nio.file.Path;
|
| 24 | +import java.text.Normalizer; |
23 | 25 | import java.util.Arrays;
|
24 | 26 | import java.util.List;
|
25 | 27 |
|
|
29 | 31 | import org.springframework.core.io.Resource;
|
30 | 32 | import org.springframework.util.StringUtils;
|
31 | 33 |
|
| 34 | +import static java.nio.charset.StandardCharsets.UTF_8; |
| 35 | +import static java.text.Normalizer.Form.NFC; |
32 | 36 | import static org.assertj.core.api.Assertions.assertThat;
|
33 | 37 | import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
34 | 38 |
|
@@ -117,7 +121,7 @@ void usingClasspathStarProtocol() {
|
117 | 121 |
|
118 | 122 | @Test
|
119 | 123 | void usingFilePrototol() {
|
120 |
| - Path testResourcesDir = Paths.get("src/test/resources").toAbsolutePath(); |
| 124 | + Path testResourcesDir = Path.of("src/test/resources").toAbsolutePath(); |
121 | 125 | String pattern = String.format("file:%s/japanese-resources/バリューオブジェクト/**/*.text", testResourcesDir);
|
122 | 126 | String pathPrefix = ".+japanese-resources/";
|
123 | 127 |
|
@@ -208,8 +212,12 @@ private void assertExactSubPaths(String pattern, String pathPrefix, String... su
|
208 | 212 | Resource[] resources = resolver.getResources(pattern);
|
209 | 213 | List<String> actualSubPaths = Arrays.stream(resources)
|
210 | 214 | .map(resource -> getPath(resource).replaceFirst(pathPrefix, ""))
|
| 215 | + // TODO Remove URL-decoding and Unicode normalization. |
| 216 | + // https://github.com/spring-projects/spring-framework/issues/29243 |
| 217 | + .map(path -> URLDecoder.decode(path, UTF_8)) |
| 218 | + .map(path -> Normalizer.normalize(path, NFC)) |
211 | 219 | .sorted()
|
212 |
| - .collect(Collectors.toList()); |
| 220 | + .toList(); |
213 | 221 | assertThat(actualSubPaths).containsExactlyInAnyOrder(subPaths);
|
214 | 222 | }
|
215 | 223 | catch (IOException ex) {
|
|
0 commit comments