Clean up warnings

This commit is contained in:
Sam Brannen
2019-05-10 18:00:29 +02:00
parent 0cff7eb32c
commit 64819bbc1d
13 changed files with 19 additions and 13 deletions

View File

@@ -97,7 +97,7 @@ public class JCacheCacheManagerTests extends AbstractTransactionSupportingCacheM
return cacheManager;
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public void addCache(String name) {
cacheNames.add(name);
Cache cache = mock(Cache.class);

View File

@@ -74,6 +74,7 @@ public class JCacheJavaConfigTests extends AbstractJCacheAnnotationTests {
cos.getExceptionCacheResolver());
JCacheInterceptor interceptor = context.getBean(JCacheInterceptor.class);
assertSame(context.getBean("errorHandler", CacheErrorHandler.class), interceptor.getErrorHandler());
context.close();
}
@Test

View File

@@ -59,6 +59,7 @@ public class CacheResolverAdapterTests extends AbstractJCacheTests {
adapter.resolveCaches(dummyContext));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
protected CacheResolver getCacheResolver(CacheInvocationContext<? extends Annotation> context, String cacheName) {
CacheResolver cacheResolver = mock(CacheResolver.class);
javax.cache.Cache cache;

View File

@@ -66,6 +66,7 @@ public class JCacheErrorHandlerTests {
this.errorCache = context.getBean("mockErrorCache", Cache.class);
this.errorHandler = context.getBean(CacheErrorHandler.class);
this.simpleService = context.getBean(SimpleService.class);
context.close();
}

View File

@@ -43,7 +43,6 @@ import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
/**
*
* @author Stephane Nicoll
*/
public class JCacheKeyGeneratorTests {
@@ -60,6 +59,7 @@ public class JCacheKeyGeneratorTests {
this.keyGenerator = context.getBean(TestKeyGenerator.class);
this.simpleService = context.getBean(SimpleService.class);
this.cache = context.getBean(CacheManager.class).getCache("test");
context.close();
}
@Test

View File

@@ -32,6 +32,7 @@ public class TestableCacheResolver implements CacheResolver {
@Override
public <K, V> Cache<K, V> resolveCache(CacheInvocationContext<? extends Annotation> cacheInvocationContext) {
String cacheName = cacheInvocationContext.getCacheName();
@SuppressWarnings("unchecked")
Cache<K, V> mock = mock(Cache.class);
given(mock.getName()).willReturn(cacheName);
return mock;

View File

@@ -63,9 +63,11 @@ import static org.junit.Assert.fail;
/**
* @author Juergen Hoeller
*/
@SuppressWarnings("resource")
public class ValidatorFactoryTests {
@Test
@SuppressWarnings("cast")
public void testSimpleValidation() {
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
validator.afterPropertiesSet();
@@ -92,6 +94,7 @@ public class ValidatorFactoryTests {
}
@Test
@SuppressWarnings("cast")
public void testSimpleValidationWithCustomProvider() {
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
validator.setProviderClass(HibernateValidator.class);