@@ -46,22 +46,22 @@ class ResourceHintsTests {
46
46
void registerType () {
47
47
this .resourceHints .registerType (String .class );
48
48
assertThat (this .resourceHints .resourcePatternHints ()).singleElement ().satisfies (
49
- patternOf ("java" , "java/lang" , "java/lang/String.class" ));
49
+ patternOf ("/" , " java" , "java/lang" , "java/lang/String.class" ));
50
50
}
51
51
52
52
@ Test
53
53
void registerTypeWithNestedType () {
54
54
this .resourceHints .registerType (TypeReference .of (Nested .class ));
55
55
assertThat (this .resourceHints .resourcePatternHints ()).singleElement ().satisfies (
56
- patternOf ("org" , "org/springframework" , "org/springframework/aot" , "org/springframework/aot/hint" ,
56
+ patternOf ("/" , " org" , "org/springframework" , "org/springframework/aot" , "org/springframework/aot/hint" ,
57
57
"org/springframework/aot/hint/ResourceHintsTests$Nested.class" ));
58
58
}
59
59
60
60
@ Test
61
61
void registerTypeWithInnerNestedType () {
62
62
this .resourceHints .registerType (TypeReference .of (Inner .class ));
63
63
assertThat (this .resourceHints .resourcePatternHints ()).singleElement ().satisfies (
64
- patternOf ("org" , "org/springframework" , "org/springframework/aot" , "org/springframework/aot/hint" ,
64
+ patternOf ("/" , " org" , "org/springframework" , "org/springframework/aot" , "org/springframework/aot/hint" ,
65
65
"org/springframework/aot/hint/ResourceHintsTests$Nested$Inner.class" ));
66
66
}
67
67
@@ -70,16 +70,26 @@ void registerTypeSeveralTimesAddsOnlyOneEntry() {
70
70
this .resourceHints .registerType (String .class );
71
71
this .resourceHints .registerType (TypeReference .of (String .class ));
72
72
assertThat (this .resourceHints .resourcePatternHints ()).singleElement ().satisfies (
73
- patternOf ("java" , "java/lang" , "java/lang/String.class" ));
73
+ patternOf ("/" , " java" , "java/lang" , "java/lang/String.class" ));
74
74
}
75
75
76
76
@ Test
77
77
void registerExactMatches () {
78
78
this .resourceHints .registerPattern ("com/example/test.properties" );
79
79
this .resourceHints .registerPattern ("com/example/another.properties" );
80
80
assertThat (this .resourceHints .resourcePatternHints ())
81
- .anySatisfy (patternOf ("com" , "com/example" , "com/example/test.properties" ))
82
- .anySatisfy (patternOf ("com" , "com/example" , "com/example/another.properties" ))
81
+ .anySatisfy (patternOf ("/" , "com" , "com/example" , "com/example/test.properties" ))
82
+ .anySatisfy (patternOf ("/" , "com" , "com/example" , "com/example/another.properties" ))
83
+ .hasSize (2 );
84
+ }
85
+
86
+ @ Test
87
+ void registerExactMatchesInRootDirectory () {
88
+ this .resourceHints .registerPattern ("test.properties" );
89
+ this .resourceHints .registerPattern ("another.properties" );
90
+ assertThat (this .resourceHints .resourcePatternHints ())
91
+ .anySatisfy (patternOf ("/" , "test.properties" ))
92
+ .anySatisfy (patternOf ("/" , "another.properties" ))
83
93
.hasSize (2 );
84
94
}
85
95
@@ -101,15 +111,15 @@ void registerRootPattern() {
101
111
void registerPattern () {
102
112
this .resourceHints .registerPattern ("com/example/*.properties" );
103
113
assertThat (this .resourceHints .resourcePatternHints ()).singleElement ().satisfies (
104
- patternOf ("com" , "com/example" , "com/example/*.properties" ));
114
+ patternOf ("/" , " com" , "com/example" , "com/example/*.properties" ));
105
115
}
106
116
107
117
@ Test
108
118
void registerPatternWithIncludesAndExcludes () {
109
119
this .resourceHints .registerPattern (resourceHint ->
110
120
resourceHint .includes ("com/example/*.properties" ).excludes ("com/example/to-ignore.properties" ));
111
121
assertThat (this .resourceHints .resourcePatternHints ()).singleElement ().satisfies (patternOf (
112
- List .of ("com" , "com/example" , "com/example/*.properties" ),
122
+ List .of ("/" , " com" , "com/example" , "com/example/*.properties" ),
113
123
List .of ("com/example/to-ignore.properties" )));
114
124
}
115
125
@@ -118,7 +128,7 @@ void registerIfPresentRegisterExistingLocation() {
118
128
this .resourceHints .registerPatternIfPresent (null , "META-INF/" ,
119
129
resourceHint -> resourceHint .includes ("com/example/*.properties" ));
120
130
assertThat (this .resourceHints .resourcePatternHints ()).singleElement ().satisfies (
121
- patternOf ("com" , "com/example" , "com/example/*.properties" ));
131
+ patternOf ("/" , " com" , "com/example" , "com/example/*.properties" ));
122
132
}
123
133
124
134
@ Test
@@ -152,7 +162,7 @@ void registerResourceWithExistingClassPathResource() {
152
162
ClassPathResource resource = new ClassPathResource (path );
153
163
this .resourceHints .registerResource (resource );
154
164
assertThat (this .resourceHints .resourcePatternHints ()).singleElement ().satisfies (
155
- patternOf ("org" , "org/springframework" , "org/springframework/aot" , "org/springframework/aot/hint" , path ));
165
+ patternOf ("/" , " org" , "org/springframework" , "org/springframework/aot" , "org/springframework/aot/hint" , path ));
156
166
}
157
167
158
168
@ Test
@@ -161,7 +171,7 @@ void registerResourceWithExistingRelativeClassPathResource() {
161
171
ClassPathResource resource = new ClassPathResource ("support" , RuntimeHints .class );
162
172
this .resourceHints .registerResource (resource );
163
173
assertThat (this .resourceHints .resourcePatternHints ()).singleElement ().satisfies (
164
- patternOf ("org" , "org/springframework" , "org/springframework/aot" , "org/springframework/aot/hint" , path ));
174
+ patternOf ("/" , " org" , "org/springframework" , "org/springframework/aot" , "org/springframework/aot/hint" , path ));
165
175
}
166
176
167
177
@ Test
@@ -197,8 +207,7 @@ private Consumer<ResourcePatternHints> patternOf(List<String> includes, List<Str
197
207
198
208
static class Nested {
199
209
200
- static class Inner {
201
-
210
+ class Inner {
202
211
}
203
212
}
204
213
0 commit comments