Skip to content

Commit 723c94e

Browse files
committed
Polishing
1 parent e5a69dc commit 723c94e

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

spring-core/src/test/java/org/springframework/core/io/ModuleResourceTests.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
class ModuleResourceTests {
3636

3737
private static final String existingPath = "java/beans/Introspector.class";
38+
3839
private static final String nonExistingPath = "org/example/NonExistingClass.class";
3940

4041

@@ -48,20 +49,10 @@ void existingClassFileResource() throws IOException {
4849
ModuleResource mr = new ModuleResource(Introspector.class.getModule(), existingPath);
4950
assertExistingResource(mr);
5051
assertThat(mr.getDescription()).startsWith("module resource").contains(mr.getModule().getName(), mr.getPath());
51-
System.err.println(mr.getDescription());
52-
5352
assertThat(mr.getContentAsByteArray()).isEqualTo(cpr.getContentAsByteArray());
5453
assertThat(mr.contentLength()).isEqualTo(cpr.contentLength());
5554
}
5655

57-
private static void assertExistingResource(Resource resource) {
58-
assertThat(resource.exists()).isTrue();
59-
assertThat(resource.isReadable()).isTrue();
60-
assertThat(resource.isOpen()).isFalse();
61-
assertThat(resource.isFile()).isFalse();
62-
assertThat(resource.getFilename()).isEqualTo("Introspector.class");
63-
}
64-
6556
@Test
6657
void nonExistingResource() {
6758
ModuleResource mr = new ModuleResource(Introspector.class.getModule(), nonExistingPath);
@@ -81,6 +72,7 @@ void equalsAndHashCode() {
8172
Resource resource1 = new ModuleResource(Introspector.class.getModule(), existingPath);
8273
Resource resource2 = new ModuleResource(Introspector.class.getModule(), existingPath);
8374
Resource resource3 = new ModuleResource(Introspector.class.getModule(), nonExistingPath);
75+
8476
assertThat(resource1).isEqualTo(resource1);
8577
assertThat(resource1).isEqualTo(resource2);
8678
assertThat(resource2).isEqualTo(resource1);
@@ -89,4 +81,13 @@ void equalsAndHashCode() {
8981
assertThat(resource1).doesNotHaveSameHashCodeAs(resource3);
9082
}
9183

84+
85+
private static void assertExistingResource(Resource resource) {
86+
assertThat(resource.exists()).isTrue();
87+
assertThat(resource.isReadable()).isTrue();
88+
assertThat(resource.isOpen()).isFalse();
89+
assertThat(resource.isFile()).isFalse();
90+
assertThat(resource.getFilename()).isEqualTo("Introspector.class");
91+
}
92+
9293
}

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,14 +51,14 @@
5151
*/
5252
class PathMatchingResourcePatternResolverTests {
5353

54-
private static final String[] CLASSES_IN_CORE_IO_SUPPORT = { "EncodedResource.class",
54+
private static final String[] CLASSES_IN_CORE_IO_SUPPORT = {"EncodedResource.class",
5555
"LocalizedResourceHelper.class", "PathMatchingResourcePatternResolver.class", "PropertiesLoaderSupport.class",
5656
"PropertiesLoaderUtils.class", "ResourceArrayPropertyEditor.class", "ResourcePatternResolver.class",
57-
"ResourcePatternUtils.class", "SpringFactoriesLoader.class" };
57+
"ResourcePatternUtils.class", "SpringFactoriesLoader.class"};
5858

59-
private static final String[] TEST_CLASSES_IN_CORE_IO_SUPPORT = { "PathMatchingResourcePatternResolverTests.class" };
59+
private static final String[] TEST_CLASSES_IN_CORE_IO_SUPPORT = {"PathMatchingResourcePatternResolverTests.class"};
6060

61-
private static final String[] CLASSES_IN_REACTOR_UTIL_ANNOTATION = { "NonNull.class", "NonNullApi.class", "Nullable.class" };
61+
private static final String[] CLASSES_IN_REACTOR_UTIL_ANNOTATION = {"NonNull.class", "NonNullApi.class", "Nullable.class"};
6262

6363

6464
private PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
@@ -329,8 +329,8 @@ private void assertExactSubPaths(String pattern, String pathPrefix, String... su
329329
}
330330

331331
private String getPath(Resource resource) {
332-
// Tests fail if we use resouce.getURL().getPath(). They would also fail on Mac OS when
333-
// using resouce.getURI().getPath() if the resource paths are not Unicode normalized.
332+
// Tests fail if we use resource.getURL().getPath(). They would also fail on macOS when
333+
// using resource.getURI().getPath() if the resource paths are not Unicode normalized.
334334
//
335335
// On the JVM, all tests should pass when using resouce.getFile().getPath(); however,
336336
// we use FileSystemResource#getPath since this test class is sometimes run within a

0 commit comments

Comments
 (0)