diff --git a/org.springframework.context/src/test/java/org/springframework/cache/config/AbstractAnnotationTests.java b/org.springframework.context/src/test/java/org/springframework/cache/config/AbstractAnnotationTests.java index 24fc8ceec7..7bea88e760 100644 --- a/org.springframework.context/src/test/java/org/springframework/cache/config/AbstractAnnotationTests.java +++ b/org.springframework.context/src/test/java/org/springframework/cache/config/AbstractAnnotationTests.java @@ -16,7 +16,13 @@ package org.springframework.cache.config; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.util.Collection; import java.util.UUID; @@ -27,12 +33,12 @@ import org.springframework.aop.framework.AopProxyUtils; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; /** * Abstract annotation test (containing several reusable methods). * * @author Costin Leau + * @author Chris Beams */ public abstract class AbstractAnnotationTests { @@ -44,11 +50,12 @@ public abstract class AbstractAnnotationTests { protected CacheManager cm; - protected abstract String getConfig(); + /** @return a refreshed application context */ + protected abstract ApplicationContext getApplicationContext(); @Before public void setup() { - ctx = new ClassPathXmlApplicationContext(getConfig()); + ctx = getApplicationContext(); cs = ctx.getBean("service", CacheableService.class); ccs = ctx.getBean("classService", CacheableService.class); cm = ctx.getBean(CacheManager.class); diff --git a/org.springframework.context/src/test/java/org/springframework/cache/config/AnnotationNamespaceDrivenTests.java b/org.springframework.context/src/test/java/org/springframework/cache/config/AnnotationNamespaceDrivenTests.java index f394011458..06ec9e8dbd 100644 --- a/org.springframework.context/src/test/java/org/springframework/cache/config/AnnotationNamespaceDrivenTests.java +++ b/org.springframework.context/src/test/java/org/springframework/cache/config/AnnotationNamespaceDrivenTests.java @@ -20,15 +20,19 @@ import junit.framework.Assert; import org.junit.Test; import org.springframework.cache.interceptor.CacheInterceptor; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.GenericXmlApplicationContext; /** * @author Costin Leau + * @author Chris Beams */ public class AnnotationNamespaceDrivenTests extends AbstractAnnotationTests { @Override - protected String getConfig() { - return "/org/springframework/cache/config/annotationDrivenCacheNamespace.xml"; + protected ApplicationContext getApplicationContext() { + return new GenericXmlApplicationContext( + "/org/springframework/cache/config/annotationDrivenCacheNamespace.xml"); } @Test diff --git a/org.springframework.context/src/test/java/org/springframework/cache/config/AnnotationTests.java b/org.springframework.context/src/test/java/org/springframework/cache/config/AnnotationTests.java index c1372dbde9..8de9d7bb52 100644 --- a/org.springframework.context/src/test/java/org/springframework/cache/config/AnnotationTests.java +++ b/org.springframework.context/src/test/java/org/springframework/cache/config/AnnotationTests.java @@ -16,13 +16,18 @@ package org.springframework.cache.config; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.GenericXmlApplicationContext; + /** * @author Costin Leau + * @author Chris Beams */ public class AnnotationTests extends AbstractAnnotationTests { @Override - protected String getConfig() { - return "/org/springframework/cache/config/annotationDrivenCacheConfig.xml"; + protected ApplicationContext getApplicationContext() { + return new GenericXmlApplicationContext( + "/org/springframework/cache/config/annotationDrivenCacheConfig.xml"); } } \ No newline at end of file diff --git a/org.springframework.context/src/test/java/org/springframework/cache/config/CacheAdviceNamespaceTests.java b/org.springframework.context/src/test/java/org/springframework/cache/config/CacheAdviceNamespaceTests.java index b34317e3ca..09dcf34607 100644 --- a/org.springframework.context/src/test/java/org/springframework/cache/config/CacheAdviceNamespaceTests.java +++ b/org.springframework.context/src/test/java/org/springframework/cache/config/CacheAdviceNamespaceTests.java @@ -19,15 +19,19 @@ package org.springframework.cache.config; import org.junit.Assert; import org.junit.Test; import org.springframework.cache.interceptor.CacheInterceptor; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.GenericXmlApplicationContext; /** * @author Costin Leau + * @author Chris Beams */ public class CacheAdviceNamespaceTests extends AbstractAnnotationTests { @Override - protected String getConfig() { - return "/org/springframework/cache/config/cache-advice.xml"; + protected ApplicationContext getApplicationContext() { + return new GenericXmlApplicationContext( + "/org/springframework/cache/config/cache-advice.xml"); } @Test