Browse Source

Polishing

(cherry picked from commit 723c94e5ac)
pull/33048/head
Juergen Hoeller 2 years ago
parent
commit
a3647a8c5e
  1. 16
      spring-core/src/test/java/org/springframework/core/io/support/PathMatchingResourcePatternResolverTests.java

16
spring-core/src/test/java/org/springframework/core/io/support/PathMatchingResourcePatternResolverTests.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2023 the original author or authors. * Copyright 2002-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -51,14 +51,14 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
*/ */
class PathMatchingResourcePatternResolverTests { class PathMatchingResourcePatternResolverTests {
private static final String[] CLASSES_IN_CORE_IO_SUPPORT = { "EncodedResource.class", private static final String[] CLASSES_IN_CORE_IO_SUPPORT = {"EncodedResource.class",
"LocalizedResourceHelper.class", "PathMatchingResourcePatternResolver.class", "PropertiesLoaderSupport.class", "LocalizedResourceHelper.class", "PathMatchingResourcePatternResolver.class", "PropertiesLoaderSupport.class",
"PropertiesLoaderUtils.class", "ResourceArrayPropertyEditor.class", "ResourcePatternResolver.class", "PropertiesLoaderUtils.class", "ResourceArrayPropertyEditor.class", "ResourcePatternResolver.class",
"ResourcePatternUtils.class", "SpringFactoriesLoader.class" }; "ResourcePatternUtils.class", "SpringFactoriesLoader.class"};
private static final String[] TEST_CLASSES_IN_CORE_IO_SUPPORT = { "PathMatchingResourcePatternResolverTests.class" }; private static final String[] TEST_CLASSES_IN_CORE_IO_SUPPORT = {"PathMatchingResourcePatternResolverTests.class"};
private static final String[] CLASSES_IN_REACTOR_UTIL_ANNOTATION = { "NonNull.class", "NonNullApi.class", "Nullable.class" }; private static final String[] CLASSES_IN_REACTOR_UTIL_ANNOTATION = {"NonNull.class", "NonNullApi.class", "Nullable.class"};
private PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); private PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
@ -200,7 +200,7 @@ class PathMatchingResourcePatternResolverTests {
} }
@Test @Test
void usingFileProtocolWithoutWildcardInPatternAndEndingInSlashStarStar() { void usingFileProtocolWithoutWildcardInPatternAndEndingInSlashStarStar() {
Path testResourcesDir = Paths.get("src/test/resources").toAbsolutePath(); Path testResourcesDir = Paths.get("src/test/resources").toAbsolutePath();
String pattern = String.format("file:%s/scanned-resources/**", testResourcesDir); String pattern = String.format("file:%s/scanned-resources/**", testResourcesDir);
String pathPrefix = ".+?resources/"; String pathPrefix = ".+?resources/";
@ -329,8 +329,8 @@ class PathMatchingResourcePatternResolverTests {
} }
private String getPath(Resource resource) { private String getPath(Resource resource) {
// Tests fail if we use resouce.getURL().getPath(). They would also fail on Mac OS when // Tests fail if we use resource.getURL().getPath(). They would also fail on macOS when
// using resouce.getURI().getPath() if the resource paths are not Unicode normalized. // using resource.getURI().getPath() if the resource paths are not Unicode normalized.
// //
// On the JVM, all tests should pass when using resouce.getFile().getPath(); however, // On the JVM, all tests should pass when using resouce.getFile().getPath(); however,
// we use FileSystemResource#getPath since this test class is sometimes run within a // we use FileSystemResource#getPath since this test class is sometimes run within a

Loading…
Cancel
Save