Rearranged cache test class names across several modules
This commit is contained in:
@@ -34,14 +34,14 @@ import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Abstract annotation test (containing several reusable methods).
|
||||
* Abstract cache annotation tests (containing several reusable methods).
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Chris Beams
|
||||
* @author Phillip Webb
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public abstract class AbstractAnnotationTests {
|
||||
public abstract class AbstractCacheAnnotationTests {
|
||||
|
||||
protected ConfigurableApplicationContext ctx;
|
||||
|
||||
@@ -72,7 +72,7 @@ public abstract class AbstractAnnotationTests {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
public void close() {
|
||||
if (ctx != null) {
|
||||
ctx.close();
|
||||
}
|
||||
@@ -128,7 +128,8 @@ public abstract class AbstractAnnotationTests {
|
||||
assertSame(r1, r2);
|
||||
try {
|
||||
service.evictEarly(o1);
|
||||
} catch (RuntimeException ex) {
|
||||
}
|
||||
catch (RuntimeException ex) {
|
||||
// expected
|
||||
}
|
||||
|
||||
@@ -147,7 +148,8 @@ public abstract class AbstractAnnotationTests {
|
||||
assertSame(r1, r2);
|
||||
try {
|
||||
service.evictWithException(o1);
|
||||
} catch (RuntimeException ex) {
|
||||
}
|
||||
catch (RuntimeException ex) {
|
||||
// expected
|
||||
}
|
||||
// exception occurred, eviction skipped, data should still be in the cache
|
||||
@@ -179,7 +181,8 @@ public abstract class AbstractAnnotationTests {
|
||||
|
||||
try {
|
||||
service.invalidateEarly(o1, null);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
// expected
|
||||
}
|
||||
Object r3 = service.cache(o1);
|
||||
@@ -290,7 +293,8 @@ public abstract class AbstractAnnotationTests {
|
||||
try {
|
||||
service.throwChecked(arg);
|
||||
fail("Excepted exception");
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
assertEquals("Wrong exception type", IOException.class, ex.getClass());
|
||||
assertEquals(arg, ex.getMessage());
|
||||
}
|
||||
@@ -300,7 +304,8 @@ public abstract class AbstractAnnotationTests {
|
||||
try {
|
||||
service.throwUnchecked(Long.valueOf(1));
|
||||
fail("Excepted exception");
|
||||
} catch (RuntimeException ex) {
|
||||
}
|
||||
catch (RuntimeException ex) {
|
||||
assertEquals("Wrong exception type", UnsupportedOperationException.class, ex.getClass());
|
||||
assertEquals("1", ex.getMessage());
|
||||
}
|
||||
@@ -623,7 +628,8 @@ public abstract class AbstractAnnotationTests {
|
||||
Object param = new Object();
|
||||
cs.unknownCustomKeyGenerator(param);
|
||||
fail("should have failed with NoSuchBeanDefinitionException");
|
||||
} catch (NoSuchBeanDefinitionException e) {
|
||||
}
|
||||
catch (NoSuchBeanDefinitionException ex) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
@@ -645,7 +651,8 @@ public abstract class AbstractAnnotationTests {
|
||||
Object param = new Object();
|
||||
cs.unknownCustomCacheManager(param);
|
||||
fail("should have failed with NoSuchBeanDefinitionException");
|
||||
} catch (NoSuchBeanDefinitionException e) {
|
||||
}
|
||||
catch (NoSuchBeanDefinitionException ex) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ import org.springframework.context.support.GenericXmlApplicationContext;
|
||||
* @author Costin Leau
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public class AnnotationTests extends AbstractAnnotationTests {
|
||||
public class AnnotationDrivenCacheConfigTests extends AbstractCacheAnnotationTests {
|
||||
|
||||
@Override
|
||||
protected ConfigurableApplicationContext getApplicationContext() {
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,7 +30,7 @@ import static org.junit.Assert.*;
|
||||
* @author Chris Beams
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class AnnotationNamespaceDrivenTests extends AbstractAnnotationTests {
|
||||
public class AnnotationNamespaceDrivenTests extends AbstractCacheAnnotationTests {
|
||||
|
||||
@Override
|
||||
protected ConfigurableApplicationContext getApplicationContext() {
|
||||
@@ -40,8 +40,8 @@ public class AnnotationNamespaceDrivenTests extends AbstractAnnotationTests {
|
||||
|
||||
@Test
|
||||
public void testKeyStrategy() {
|
||||
CacheInterceptor ci = ctx.getBean("org.springframework.cache.interceptor.CacheInterceptor#0",
|
||||
CacheInterceptor.class);
|
||||
CacheInterceptor ci = ctx.getBean(
|
||||
"org.springframework.cache.interceptor.CacheInterceptor#0", CacheInterceptor.class);
|
||||
assertSame(ctx.getBean("keyGenerator"), ci.getKeyGenerator());
|
||||
}
|
||||
|
||||
@@ -67,8 +67,9 @@ public class AnnotationNamespaceDrivenTests extends AbstractAnnotationTests {
|
||||
|
||||
@Test
|
||||
public void testCacheErrorHandler() {
|
||||
CacheInterceptor ci = ctx.getBean("org.springframework.cache.interceptor.CacheInterceptor#0",
|
||||
CacheInterceptor.class);
|
||||
CacheInterceptor ci = ctx.getBean(
|
||||
"org.springframework.cache.interceptor.CacheInterceptor#0", CacheInterceptor.class);
|
||||
assertSame(ctx.getBean("errorHandler", CacheErrorHandler.class), ci.getErrorHandler());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,7 +27,7 @@ import org.springframework.context.support.GenericXmlApplicationContext;
|
||||
* @author Costin Leau
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public class CacheAdviceNamespaceTests extends AbstractAnnotationTests {
|
||||
public class CacheAdviceNamespaceTests extends AbstractCacheAnnotationTests {
|
||||
|
||||
@Override
|
||||
protected ConfigurableApplicationContext getApplicationContext() {
|
||||
|
||||
@@ -44,7 +44,7 @@ import static org.junit.Assert.*;
|
||||
* @author Chris Beams
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class EnableCachingTests extends AbstractAnnotationTests {
|
||||
public class EnableCachingTests extends AbstractCacheAnnotationTests {
|
||||
|
||||
/** hook into superclass suite of tests */
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user