From eba33b6156c354d789ec9261028629201870075e Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Mon, 4 Apr 2011 22:06:05 +0000 Subject: [PATCH] polishing --- .../test/context/ContextLoaderUtils.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/org.springframework.test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java b/org.springframework.test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java index 83a1d365e1..bbf848f0af 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java +++ b/org.springframework.test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java @@ -126,7 +126,7 @@ public abstract class ContextLoaderUtils { } try { - ContextConfiguration contextConfiguration = clazz.getAnnotation(ContextConfiguration.class); + ContextConfiguration contextConfiguration = clazz.getAnnotation(annotationType); if (logger.isTraceEnabled()) { logger.trace("Using default ContextLoader class [" + defaultContextLoaderClassName + "] for @ContextConfiguration [" + contextConfiguration + "] and class [" + clazz + "]"); @@ -165,17 +165,17 @@ public abstract class ContextLoaderUtils { Assert.notNull(contextLoader, "ContextLoader must not be null"); Assert.notNull(clazz, "Class must not be null"); + boolean processConfigurationClasses = (contextLoader instanceof ResourceTypeAwareContextLoader) + && ((ResourceTypeAwareContextLoader) contextLoader).supportsClassResources(); + LocationsResolver locationsResolver = processConfigurationClasses ? classNameLocationsResolver + : resourcePathLocationsResolver; + Class annotationType = ContextConfiguration.class; Class declaringClass = AnnotationUtils.findAnnotationDeclaringClass(annotationType, clazz); Assert.notNull(declaringClass, String.format( "Could not find an 'annotation declaring class' for annotation type [%s] and class [%s]", annotationType, clazz)); - boolean processConfigurationClasses = (contextLoader instanceof ResourceTypeAwareContextLoader) - && ((ResourceTypeAwareContextLoader) contextLoader).supportsClassResources(); - LocationsResolver locationsResolver = processConfigurationClasses ? classNameLocationsResolver - : resourcePathLocationsResolver; - List locationsList = new ArrayList(); while (declaringClass != null) {