Skip to content

Commit eba33b6

Browse files
committed
polishing
1 parent 070b7b6 commit eba33b6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

org.springframework.test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static Class<? extends ContextLoader> resolveContextLoaderClass(Class<?> clazz,
126126
}
127127

128128
try {
129-
ContextConfiguration contextConfiguration = clazz.getAnnotation(ContextConfiguration.class);
129+
ContextConfiguration contextConfiguration = clazz.getAnnotation(annotationType);
130130
if (logger.isTraceEnabled()) {
131131
logger.trace("Using default ContextLoader class [" + defaultContextLoaderClassName
132132
+ "] for @ContextConfiguration [" + contextConfiguration + "] and class [" + clazz + "]");
@@ -165,17 +165,17 @@ public static String[] resolveContextLocations(ContextLoader contextLoader, Clas
165165
Assert.notNull(contextLoader, "ContextLoader must not be null");
166166
Assert.notNull(clazz, "Class must not be null");
167167

168+
boolean processConfigurationClasses = (contextLoader instanceof ResourceTypeAwareContextLoader)
169+
&& ((ResourceTypeAwareContextLoader) contextLoader).supportsClassResources();
170+
LocationsResolver locationsResolver = processConfigurationClasses ? classNameLocationsResolver
171+
: resourcePathLocationsResolver;
172+
168173
Class<ContextConfiguration> annotationType = ContextConfiguration.class;
169174
Class<?> declaringClass = AnnotationUtils.findAnnotationDeclaringClass(annotationType, clazz);
170175
Assert.notNull(declaringClass, String.format(
171176
"Could not find an 'annotation declaring class' for annotation type [%s] and class [%s]", annotationType,
172177
clazz));
173178

174-
boolean processConfigurationClasses = (contextLoader instanceof ResourceTypeAwareContextLoader)
175-
&& ((ResourceTypeAwareContextLoader) contextLoader).supportsClassResources();
176-
LocationsResolver locationsResolver = processConfigurationClasses ? classNameLocationsResolver
177-
: resourcePathLocationsResolver;
178-
179179
List<String> locationsList = new ArrayList<String>();
180180

181181
while (declaringClass != null) {

0 commit comments

Comments
 (0)