Polish
This commit is contained in:
parent
2784f6008e
commit
4f599b7396
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -265,7 +265,6 @@ class CaffeineCacheManagerTests {
|
|||
CaffeineCacheManager cm = new CaffeineCacheManager("c1");
|
||||
Cache cache1 = cm.getCache("c1");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
CacheLoader<Object, Object> loader = mock();
|
||||
|
||||
cm.setCacheLoader(loader);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
* @author Juergen Hoeller
|
||||
* @since 6.1
|
||||
*/
|
||||
public class CaffeineReactiveCachingTests {
|
||||
class CaffeineReactiveCachingTests {
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(classes = {AsyncCacheModeConfig.class, AsyncCacheModeConfig.class})
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -32,7 +32,7 @@ import static org.mockito.Mockito.mock;
|
|||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class JCacheCacheManagerTests extends AbstractTransactionSupportingCacheManagerTests<JCacheCacheManager> {
|
||||
class JCacheCacheManagerTests extends AbstractTransactionSupportingCacheManagerTests<JCacheCacheManager> {
|
||||
|
||||
private CacheManagerMock cacheManagerMock;
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ public class JCacheCacheManagerTests extends AbstractTransactionSupportingCacheM
|
|||
|
||||
|
||||
@BeforeEach
|
||||
public void setupOnce() {
|
||||
void setupOnce() {
|
||||
cacheManagerMock = new CacheManagerMock();
|
||||
cacheManagerMock.addCache(CACHE_NAME);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -46,7 +46,7 @@ import org.springframework.transaction.testfixture.CallCountingTransactionManage
|
|||
* @author Stephane Nicoll
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class JCacheEhCacheAnnotationTests extends AbstractCacheAnnotationTests {
|
||||
class JCacheEhCacheAnnotationTests extends AbstractCacheAnnotationTests {
|
||||
|
||||
private final TransactionTemplate txTemplate = new TransactionTemplate(new CallCountingTransactionManager());
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ public class JCacheEhCacheAnnotationTests extends AbstractCacheAnnotationTests {
|
|||
}
|
||||
|
||||
@AfterEach
|
||||
public void shutdown() {
|
||||
void shutdown() {
|
||||
if (jCacheManager != null) {
|
||||
jCacheManager.close();
|
||||
}
|
||||
|
|
@ -82,22 +82,22 @@ public class JCacheEhCacheAnnotationTests extends AbstractCacheAnnotationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testEvictWithTransaction() {
|
||||
void testEvictWithTransaction() {
|
||||
txTemplate.executeWithoutResult(s -> testEvict(this.cs, false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEvictEarlyWithTransaction() {
|
||||
void testEvictEarlyWithTransaction() {
|
||||
txTemplate.executeWithoutResult(s -> testEvictEarly(this.cs));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEvictAllWithTransaction() {
|
||||
void testEvictAllWithTransaction() {
|
||||
txTemplate.executeWithoutResult(s -> testEvictAll(this.cs, false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEvictAllEarlyWithTransaction() {
|
||||
void testEvictAllEarlyWithTransaction() {
|
||||
txTemplate.executeWithoutResult(s -> testEvictAllEarly(this.cs));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class JCacheEhCacheApiTests extends AbstractValueAdaptingCacheTests<JCacheCache> {
|
||||
class JCacheEhCacheApiTests extends AbstractValueAdaptingCacheTests<JCacheCache> {
|
||||
|
||||
private CacheManager cacheManager;
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ public class JCacheEhCacheApiTests extends AbstractValueAdaptingCacheTests<JCach
|
|||
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
void setup() {
|
||||
this.cacheManager = getCachingProvider().getCacheManager();
|
||||
this.cacheManager.createCache(CACHE_NAME, new MutableConfiguration<>());
|
||||
this.cacheManager.createCache(CACHE_NAME_NO_NULL, new MutableConfiguration<>());
|
||||
|
|
@ -61,7 +61,7 @@ public class JCacheEhCacheApiTests extends AbstractValueAdaptingCacheTests<JCach
|
|||
}
|
||||
|
||||
@AfterEach
|
||||
public void shutdown() {
|
||||
void shutdown() {
|
||||
if (this.cacheManager != null) {
|
||||
this.cacheManager.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThatRuntimeException;
|
|||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class JCacheCustomInterceptorTests {
|
||||
class JCacheCustomInterceptorTests {
|
||||
|
||||
protected ConfigurableApplicationContext ctx;
|
||||
|
||||
|
|
@ -55,14 +55,14 @@ public class JCacheCustomInterceptorTests {
|
|||
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
void setup() {
|
||||
ctx = new AnnotationConfigApplicationContext(EnableCachingConfig.class);
|
||||
cs = ctx.getBean("service", JCacheableService.class);
|
||||
exceptionCache = ctx.getBean("exceptionCache", Cache.class);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
void tearDown() {
|
||||
if (ctx != null) {
|
||||
ctx.close();
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ public class JCacheCustomInterceptorTests {
|
|||
|
||||
|
||||
@Test
|
||||
public void onlyOneInterceptorIsAvailable() {
|
||||
void onlyOneInterceptorIsAvailable() {
|
||||
Map<String, JCacheInterceptor> interceptors = ctx.getBeansOfType(JCacheInterceptor.class);
|
||||
assertThat(interceptors).as("Only one interceptor should be defined").hasSize(1);
|
||||
JCacheInterceptor interceptor = interceptors.values().iterator().next();
|
||||
|
|
@ -78,14 +78,14 @@ public class JCacheCustomInterceptorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void customInterceptorAppliesWithRuntimeException() {
|
||||
void customInterceptorAppliesWithRuntimeException() {
|
||||
Object o = cs.cacheWithException("id", true);
|
||||
// See TestCacheInterceptor
|
||||
assertThat(o).isEqualTo(55L);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customInterceptorAppliesWithCheckedException() {
|
||||
void customInterceptorAppliesWithCheckedException() {
|
||||
assertThatRuntimeException()
|
||||
.isThrownBy(() -> cs.cacheWithCheckedException("id", true))
|
||||
.withCauseExactlyInstanceOf(IOException.class);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -52,7 +52,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
|||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class JCacheJavaConfigTests extends AbstractJCacheAnnotationTests {
|
||||
class JCacheJavaConfigTests extends AbstractJCacheAnnotationTests {
|
||||
|
||||
@Override
|
||||
protected ApplicationContext getApplicationContext() {
|
||||
|
|
@ -61,7 +61,7 @@ public class JCacheJavaConfigTests extends AbstractJCacheAnnotationTests {
|
|||
|
||||
|
||||
@Test
|
||||
public void fullCachingConfig() throws Exception {
|
||||
void fullCachingConfig() {
|
||||
AnnotationConfigApplicationContext context =
|
||||
new AnnotationConfigApplicationContext(FullCachingConfig.class);
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ public class JCacheJavaConfigTests extends AbstractJCacheAnnotationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void emptyConfigSupport() {
|
||||
void emptyConfigSupport() {
|
||||
ConfigurableApplicationContext context =
|
||||
new AnnotationConfigApplicationContext(EmptyConfigSupportConfig.class);
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ public class JCacheJavaConfigTests extends AbstractJCacheAnnotationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void bothSetOnlyResolverIsUsed() {
|
||||
void bothSetOnlyResolverIsUsed() {
|
||||
ConfigurableApplicationContext context =
|
||||
new AnnotationConfigApplicationContext(FullCachingConfigSupport.class);
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ public class JCacheJavaConfigTests extends AbstractJCacheAnnotationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void exceptionCacheResolverLazilyRequired() {
|
||||
void exceptionCacheResolverLazilyRequired() {
|
||||
try (ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(NoExceptionCacheResolverConfig.class)) {
|
||||
DefaultJCacheOperationSource cos = context.getBean(DefaultJCacheOperationSource.class);
|
||||
assertThat(cos.getCacheResolver()).isSameAs(context.getBean("cacheResolver"));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class JCacheNamespaceDrivenTests extends AbstractJCacheAnnotationTests {
|
||||
class JCacheNamespaceDrivenTests extends AbstractJCacheAnnotationTests {
|
||||
|
||||
@Override
|
||||
protected ApplicationContext getApplicationContext() {
|
||||
|
|
@ -40,7 +40,7 @@ public class JCacheNamespaceDrivenTests extends AbstractJCacheAnnotationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void cacheResolver() {
|
||||
void cacheResolver() {
|
||||
ConfigurableApplicationContext context = new GenericXmlApplicationContext(
|
||||
"/org/springframework/cache/jcache/config/jCacheNamespaceDriven-resolver.xml");
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ public class JCacheNamespaceDrivenTests extends AbstractJCacheAnnotationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCacheErrorHandler() {
|
||||
void testCacheErrorHandler() {
|
||||
JCacheInterceptor ci = ctx.getBean(JCacheInterceptor.class);
|
||||
assertThat(ci.getErrorHandler()).isSameAs(ctx.getBean("errorHandler", CacheErrorHandler.class));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -23,7 +23,7 @@ import org.springframework.contextsupport.testfixture.jcache.AbstractJCacheAnnot
|
|||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class JCacheStandaloneConfigTests extends AbstractJCacheAnnotationTests {
|
||||
class JCacheStandaloneConfigTests extends AbstractJCacheAnnotationTests {
|
||||
|
||||
@Override
|
||||
protected ApplicationContext getApplicationContext() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -42,7 +42,7 @@ public abstract class AbstractCacheOperationTests<O extends JCacheOperation<?>>
|
|||
|
||||
|
||||
@Test
|
||||
public void simple() {
|
||||
void simple() {
|
||||
O operation = createSimpleOperation();
|
||||
assertThat(operation.getCacheName()).as("Wrong cache name").isEqualTo("simpleCache");
|
||||
assertThat(operation.getAnnotations()).as("Unexpected number of annotation on " + operation.getMethod())
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -46,7 +46,7 @@ import static org.mockito.Mockito.mock;
|
|||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
|
||||
class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
|
||||
|
||||
private final DefaultJCacheOperationSource source = new DefaultJCacheOperationSource();
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
|
|||
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
void setup() {
|
||||
source.setCacheResolver(defaultCacheResolver);
|
||||
source.setExceptionCacheResolver(defaultExceptionCacheResolver);
|
||||
source.setKeyGenerator(defaultKeyGenerator);
|
||||
|
|
@ -63,14 +63,14 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
|
|||
|
||||
|
||||
@Test
|
||||
public void cache() {
|
||||
void cache() {
|
||||
CacheResultOperation op = getDefaultCacheOperation(CacheResultOperation.class, String.class);
|
||||
assertDefaults(op);
|
||||
assertThat(op.getExceptionCacheResolver()).as("Exception caching not enabled so resolver should not be set").isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cacheWithException() {
|
||||
void cacheWithException() {
|
||||
CacheResultOperation op = getDefaultCacheOperation(CacheResultOperation.class, String.class, boolean.class);
|
||||
assertDefaults(op);
|
||||
assertThat(op.getExceptionCacheResolver()).isEqualTo(defaultExceptionCacheResolver);
|
||||
|
|
@ -78,41 +78,41 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void put() {
|
||||
void put() {
|
||||
CachePutOperation op = getDefaultCacheOperation(CachePutOperation.class, String.class, Object.class);
|
||||
assertDefaults(op);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void remove() {
|
||||
void remove() {
|
||||
CacheRemoveOperation op = getDefaultCacheOperation(CacheRemoveOperation.class, String.class);
|
||||
assertDefaults(op);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void removeAll() {
|
||||
void removeAll() {
|
||||
CacheRemoveAllOperation op = getDefaultCacheOperation(CacheRemoveAllOperation.class);
|
||||
assertThat(op.getCacheResolver()).isEqualTo(defaultCacheResolver);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noAnnotation() {
|
||||
void noAnnotation() {
|
||||
assertThat(getCacheOperation(AnnotatedJCacheableService.class, this.cacheName)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void multiAnnotations() {
|
||||
void multiAnnotations() {
|
||||
assertThatIllegalStateException().isThrownBy(() -> getCacheOperation(InvalidCases.class, this.cacheName));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultCacheNameWithCandidate() {
|
||||
void defaultCacheNameWithCandidate() {
|
||||
Method method = ReflectionUtils.findMethod(Object.class, "toString");
|
||||
assertThat(source.determineCacheName(method, null, "foo")).isEqualTo("foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultCacheNameWithDefaults() {
|
||||
void defaultCacheNameWithDefaults() {
|
||||
Method method = ReflectionUtils.findMethod(Object.class, "toString");
|
||||
CacheDefaults mock = mock();
|
||||
given(mock.cacheName()).willReturn("");
|
||||
|
|
@ -120,19 +120,19 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void defaultCacheNameNoDefaults() {
|
||||
void defaultCacheNameNoDefaults() {
|
||||
Method method = ReflectionUtils.findMethod(Object.class, "toString");
|
||||
assertThat(source.determineCacheName(method, null, "")).isEqualTo("java.lang.Object.toString()");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultCacheNameWithParameters() {
|
||||
void defaultCacheNameWithParameters() {
|
||||
Method method = ReflectionUtils.findMethod(Comparator.class, "compare", Object.class, Object.class);
|
||||
assertThat(source.determineCacheName(method, null, "")).isEqualTo("java.util.Comparator.compare(java.lang.Object,java.lang.Object)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customCacheResolver() {
|
||||
void customCacheResolver() {
|
||||
CacheResultOperation operation =
|
||||
getCacheOperation(CacheResultOperation.class, CustomService.class, this.cacheName, Long.class);
|
||||
assertJCacheResolver(operation.getCacheResolver(), TestableCacheResolver.class);
|
||||
|
|
@ -142,7 +142,7 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void customKeyGenerator() {
|
||||
void customKeyGenerator() {
|
||||
CacheResultOperation operation =
|
||||
getCacheOperation(CacheResultOperation.class, CustomService.class, this.cacheName, Long.class);
|
||||
assertThat(operation.getCacheResolver()).isEqualTo(defaultCacheResolver);
|
||||
|
|
@ -151,7 +151,7 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void customKeyGeneratorSpringBean() {
|
||||
void customKeyGeneratorSpringBean() {
|
||||
TestableCacheKeyGenerator bean = new TestableCacheKeyGenerator();
|
||||
beanFactory.registerSingleton("fooBar", bean);
|
||||
CacheResultOperation operation =
|
||||
|
|
@ -164,7 +164,7 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void customKeyGeneratorAndCacheResolver() {
|
||||
void customKeyGeneratorAndCacheResolver() {
|
||||
CacheResultOperation operation = getCacheOperation(CacheResultOperation.class,
|
||||
CustomServiceWithDefaults.class, this.cacheName, Long.class);
|
||||
assertJCacheResolver(operation.getCacheResolver(), TestableCacheResolver.class);
|
||||
|
|
@ -173,7 +173,7 @@ public class AnnotationCacheOperationSourceTests extends AbstractJCacheTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void customKeyGeneratorAndCacheResolverWithExceptionName() {
|
||||
void customKeyGeneratorAndCacheResolverWithExceptionName() {
|
||||
CacheResultOperation operation = getCacheOperation(CacheResultOperation.class,
|
||||
CustomServiceWithDefaults.class, this.cacheName, Long.class);
|
||||
assertJCacheResolver(operation.getCacheResolver(), TestableCacheResolver.class);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
|||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class CachePutOperationTests extends AbstractCacheOperationTests<CachePutOperation> {
|
||||
class CachePutOperationTests extends AbstractCacheOperationTests<CachePutOperation> {
|
||||
|
||||
@Override
|
||||
protected CachePutOperation createSimpleOperation() {
|
||||
|
|
@ -41,7 +41,7 @@ public class CachePutOperationTests extends AbstractCacheOperationTests<CachePut
|
|||
}
|
||||
|
||||
@Test
|
||||
public void simplePut() {
|
||||
void simplePut() {
|
||||
CachePutOperation operation = createSimpleOperation();
|
||||
|
||||
CacheInvocationParameter[] allParameters = operation.getAllParameters(2L, sampleInstance);
|
||||
|
|
@ -55,7 +55,7 @@ public class CachePutOperationTests extends AbstractCacheOperationTests<CachePut
|
|||
}
|
||||
|
||||
@Test
|
||||
public void noCacheValue() {
|
||||
void noCacheValue() {
|
||||
CacheMethodDetails<CachePut> methodDetails = create(CachePut.class,
|
||||
SampleObject.class, "noCacheValue", Long.class);
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ public class CachePutOperationTests extends AbstractCacheOperationTests<CachePut
|
|||
}
|
||||
|
||||
@Test
|
||||
public void multiCacheValues() {
|
||||
void multiCacheValues() {
|
||||
CacheMethodDetails<CachePut> methodDetails = create(CachePut.class,
|
||||
SampleObject.class, "multiCacheValues", Long.class, SampleObject.class, SampleObject.class);
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ public class CachePutOperationTests extends AbstractCacheOperationTests<CachePut
|
|||
}
|
||||
|
||||
@Test
|
||||
public void invokeWithWrongParameters() {
|
||||
void invokeWithWrongParameters() {
|
||||
CachePutOperation operation = createSimpleOperation();
|
||||
|
||||
assertThatIllegalStateException().isThrownBy(() ->
|
||||
|
|
@ -81,7 +81,7 @@ public class CachePutOperationTests extends AbstractCacheOperationTests<CachePut
|
|||
}
|
||||
|
||||
@Test
|
||||
public void fullPutConfig() {
|
||||
void fullPutConfig() {
|
||||
CacheMethodDetails<CachePut> methodDetails = create(CachePut.class,
|
||||
SampleObject.class, "fullPutConfig", Long.class, SampleObject.class);
|
||||
CachePutOperation operation = createDefaultOperation(methodDetails);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2024 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 static org.assertj.core.api.Assertions.assertThat;
|
|||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class CacheRemoveAllOperationTests extends AbstractCacheOperationTests<CacheRemoveAllOperation> {
|
||||
class CacheRemoveAllOperationTests extends AbstractCacheOperationTests<CacheRemoveAllOperation> {
|
||||
|
||||
@Override
|
||||
protected CacheRemoveAllOperation createSimpleOperation() {
|
||||
|
|
@ -38,7 +38,7 @@ public class CacheRemoveAllOperationTests extends AbstractCacheOperationTests<Ca
|
|||
}
|
||||
|
||||
@Test
|
||||
public void simpleRemoveAll() {
|
||||
void simpleRemoveAll() {
|
||||
CacheRemoveAllOperation operation = createSimpleOperation();
|
||||
|
||||
CacheInvocationParameter[] allParameters = operation.getAllParameters();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2024 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 static org.assertj.core.api.Assertions.assertThat;
|
|||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class CacheRemoveOperationTests extends AbstractCacheOperationTests<CacheRemoveOperation> {
|
||||
class CacheRemoveOperationTests extends AbstractCacheOperationTests<CacheRemoveOperation> {
|
||||
|
||||
@Override
|
||||
protected CacheRemoveOperation createSimpleOperation() {
|
||||
|
|
@ -38,7 +38,7 @@ public class CacheRemoveOperationTests extends AbstractCacheOperationTests<Cache
|
|||
}
|
||||
|
||||
@Test
|
||||
public void simpleRemove() {
|
||||
void simpleRemove() {
|
||||
CacheRemoveOperation operation = createSimpleOperation();
|
||||
|
||||
CacheInvocationParameter[] allParameters = operation.getAllParameters(2L);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -38,10 +38,10 @@ import static org.mockito.Mockito.mock;
|
|||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class CacheResolverAdapterTests extends AbstractJCacheTests {
|
||||
class CacheResolverAdapterTests extends AbstractJCacheTests {
|
||||
|
||||
@Test
|
||||
public void resolveSimpleCache() throws Exception {
|
||||
void resolveSimpleCache() throws Exception {
|
||||
DefaultCacheInvocationContext<?> dummyContext = createDummyContext();
|
||||
CacheResolverAdapter adapter = new CacheResolverAdapter(getCacheResolver(dummyContext, "testCache"));
|
||||
Collection<? extends Cache> caches = adapter.resolveCaches(dummyContext);
|
||||
|
|
@ -51,7 +51,7 @@ public class CacheResolverAdapterTests extends AbstractJCacheTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void resolveUnknownCache() throws Exception {
|
||||
void resolveUnknownCache() throws Exception {
|
||||
DefaultCacheInvocationContext<?> dummyContext = createDummyContext();
|
||||
CacheResolverAdapter adapter = new CacheResolverAdapter(getCacheResolver(dummyContext, null));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
|||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class CacheResultOperationTests extends AbstractCacheOperationTests<CacheResultOperation> {
|
||||
class CacheResultOperationTests extends AbstractCacheOperationTests<CacheResultOperation> {
|
||||
|
||||
@Override
|
||||
protected CacheResultOperation createSimpleOperation() {
|
||||
|
|
@ -47,7 +47,7 @@ public class CacheResultOperationTests extends AbstractCacheOperationTests<Cache
|
|||
}
|
||||
|
||||
@Test
|
||||
public void simpleGet() {
|
||||
void simpleGet() {
|
||||
CacheResultOperation operation = createSimpleOperation();
|
||||
|
||||
assertThat(operation.getKeyGenerator()).isNotNull();
|
||||
|
|
@ -66,7 +66,7 @@ public class CacheResultOperationTests extends AbstractCacheOperationTests<Cache
|
|||
}
|
||||
|
||||
@Test
|
||||
public void multiParameterKey() {
|
||||
void multiParameterKey() {
|
||||
CacheMethodDetails<CacheResult> methodDetails = create(CacheResult.class,
|
||||
SampleObject.class, "multiKeysGet", Long.class, Boolean.class, String.class);
|
||||
CacheResultOperation operation = createDefaultOperation(methodDetails);
|
||||
|
|
@ -78,7 +78,7 @@ public class CacheResultOperationTests extends AbstractCacheOperationTests<Cache
|
|||
}
|
||||
|
||||
@Test
|
||||
public void invokeWithWrongParameters() {
|
||||
void invokeWithWrongParameters() {
|
||||
CacheMethodDetails<CacheResult> methodDetails = create(CacheResult.class,
|
||||
SampleObject.class, "anotherSimpleGet", String.class, Long.class);
|
||||
CacheResultOperation operation = createDefaultOperation(methodDetails);
|
||||
|
|
@ -89,7 +89,7 @@ public class CacheResultOperationTests extends AbstractCacheOperationTests<Cache
|
|||
}
|
||||
|
||||
@Test
|
||||
public void tooManyKeyValues() {
|
||||
void tooManyKeyValues() {
|
||||
CacheMethodDetails<CacheResult> methodDetails = create(CacheResult.class,
|
||||
SampleObject.class, "anotherSimpleGet", String.class, Long.class);
|
||||
CacheResultOperation operation = createDefaultOperation(methodDetails);
|
||||
|
|
@ -100,7 +100,7 @@ public class CacheResultOperationTests extends AbstractCacheOperationTests<Cache
|
|||
}
|
||||
|
||||
@Test
|
||||
public void annotatedGet() {
|
||||
void annotatedGet() {
|
||||
CacheMethodDetails<CacheResult> methodDetails = create(CacheResult.class,
|
||||
SampleObject.class, "annotatedGet", Long.class, String.class);
|
||||
CacheResultOperation operation = createDefaultOperation(methodDetails);
|
||||
|
|
@ -116,7 +116,7 @@ public class CacheResultOperationTests extends AbstractCacheOperationTests<Cache
|
|||
}
|
||||
|
||||
@Test
|
||||
public void fullGetConfig() {
|
||||
void fullGetConfig() {
|
||||
CacheMethodDetails<CacheResult> methodDetails = create(CacheResult.class,
|
||||
SampleObject.class, "fullGetConfig", Long.class);
|
||||
CacheResultOperation operation = createDefaultOperation(methodDetails);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -49,7 +49,7 @@ import static org.mockito.Mockito.verify;
|
|||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class JCacheErrorHandlerTests {
|
||||
class JCacheErrorHandlerTests {
|
||||
|
||||
private Cache cache;
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ public class JCacheErrorHandlerTests {
|
|||
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
void setup() {
|
||||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
|
||||
this.cache = context.getBean("mockCache", Cache.class);
|
||||
this.errorCache = context.getBean("mockErrorCache", Cache.class);
|
||||
|
|
@ -72,7 +72,7 @@ public class JCacheErrorHandlerTests {
|
|||
|
||||
|
||||
@Test
|
||||
public void getFail() {
|
||||
void getFail() {
|
||||
UnsupportedOperationException exception = new UnsupportedOperationException("Test exception on get");
|
||||
Object key = SimpleKeyGenerator.generateKey(0L);
|
||||
willThrow(exception).given(this.cache).get(key);
|
||||
|
|
@ -82,7 +82,7 @@ public class JCacheErrorHandlerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getPutNewElementFail() {
|
||||
void getPutNewElementFail() {
|
||||
UnsupportedOperationException exception = new UnsupportedOperationException("Test exception on put");
|
||||
Object key = SimpleKeyGenerator.generateKey(0L);
|
||||
given(this.cache.get(key)).willReturn(null);
|
||||
|
|
@ -93,7 +93,7 @@ public class JCacheErrorHandlerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getFailPutExceptionFail() {
|
||||
void getFailPutExceptionFail() {
|
||||
UnsupportedOperationException exceptionOnPut = new UnsupportedOperationException("Test exception on put");
|
||||
Object key = SimpleKeyGenerator.generateKey(0L);
|
||||
given(this.cache.get(key)).willReturn(null);
|
||||
|
|
@ -110,7 +110,7 @@ public class JCacheErrorHandlerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void putFail() {
|
||||
void putFail() {
|
||||
UnsupportedOperationException exception = new UnsupportedOperationException("Test exception on put");
|
||||
Object key = SimpleKeyGenerator.generateKey(0L);
|
||||
willThrow(exception).given(this.cache).put(key, 234L);
|
||||
|
|
@ -120,7 +120,7 @@ public class JCacheErrorHandlerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void evictFail() {
|
||||
void evictFail() {
|
||||
UnsupportedOperationException exception = new UnsupportedOperationException("Test exception on evict");
|
||||
Object key = SimpleKeyGenerator.generateKey(0L);
|
||||
willThrow(exception).given(this.cache).evict(key);
|
||||
|
|
@ -130,7 +130,7 @@ public class JCacheErrorHandlerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void clearFail() {
|
||||
void clearFail() {
|
||||
UnsupportedOperationException exception = new UnsupportedOperationException("Test exception on evict");
|
||||
willThrow(exception).given(this.cache).clear();
|
||||
|
||||
|
|
@ -183,7 +183,7 @@ public class JCacheErrorHandlerTests {
|
|||
|
||||
private static final IllegalStateException TEST_EXCEPTION = new IllegalStateException("Test exception");
|
||||
|
||||
private AtomicLong counter = new AtomicLong();
|
||||
private final AtomicLong counter = new AtomicLong();
|
||||
|
||||
@CacheResult
|
||||
public Object get(long id) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -35,12 +35,12 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
|||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class JCacheInterceptorTests extends AbstractJCacheTests {
|
||||
class JCacheInterceptorTests extends AbstractJCacheTests {
|
||||
|
||||
private final CacheOperationInvoker dummyInvoker = new DummyInvoker(null);
|
||||
|
||||
@Test
|
||||
public void severalCachesNotSupported() {
|
||||
void severalCachesNotSupported() {
|
||||
JCacheInterceptor interceptor = createInterceptor(createOperationSource(
|
||||
cacheManager, new NamedCacheResolver(cacheManager, "default", "simpleCache"),
|
||||
defaultExceptionCacheResolver, defaultKeyGenerator));
|
||||
|
|
@ -54,7 +54,7 @@ public class JCacheInterceptorTests extends AbstractJCacheTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void noCacheCouldBeResolved() {
|
||||
void noCacheCouldBeResolved() {
|
||||
JCacheInterceptor interceptor = createInterceptor(createOperationSource(
|
||||
cacheManager, new NamedCacheResolver(cacheManager), // Returns empty list
|
||||
defaultExceptionCacheResolver, defaultKeyGenerator));
|
||||
|
|
@ -67,18 +67,18 @@ public class JCacheInterceptorTests extends AbstractJCacheTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void cacheManagerMandatoryIfCacheResolverNotSet() {
|
||||
void cacheManagerMandatoryIfCacheResolverNotSet() {
|
||||
assertThatIllegalStateException().isThrownBy(() ->
|
||||
createOperationSource(null, null, null, defaultKeyGenerator));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cacheManagerOptionalIfCacheResolversSet() {
|
||||
void cacheManagerOptionalIfCacheResolversSet() {
|
||||
createOperationSource(null, defaultCacheResolver, defaultExceptionCacheResolver, defaultKeyGenerator);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cacheResultReturnsProperType() throws Throwable {
|
||||
void cacheResultReturnsProperType() {
|
||||
JCacheInterceptor interceptor = createInterceptor(createOperationSource(
|
||||
cacheManager, defaultCacheResolver, defaultExceptionCacheResolver, defaultKeyGenerator));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class JCacheKeyGeneratorTests {
|
||||
class JCacheKeyGeneratorTests {
|
||||
|
||||
private TestKeyGenerator keyGenerator;
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ public class JCacheKeyGeneratorTests {
|
|||
private Cache cache;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
void setup() {
|
||||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
|
||||
this.keyGenerator = context.getBean(TestKeyGenerator.class);
|
||||
this.simpleService = context.getBean(SimpleService.class);
|
||||
|
|
@ -62,7 +62,7 @@ public class JCacheKeyGeneratorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getSimple() {
|
||||
void getSimple() {
|
||||
this.keyGenerator.expect(1L);
|
||||
Object first = this.simpleService.get(1L);
|
||||
Object second = this.simpleService.get(1L);
|
||||
|
|
@ -73,7 +73,7 @@ public class JCacheKeyGeneratorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getFlattenVararg() {
|
||||
void getFlattenVararg() {
|
||||
this.keyGenerator.expect(1L, "foo", "bar");
|
||||
Object first = this.simpleService.get(1L, "foo", "bar");
|
||||
Object second = this.simpleService.get(1L, "foo", "bar");
|
||||
|
|
@ -84,7 +84,7 @@ public class JCacheKeyGeneratorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getFiltered() {
|
||||
void getFiltered() {
|
||||
this.keyGenerator.expect(1L);
|
||||
Object first = this.simpleService.getFiltered(1L, "foo", "bar");
|
||||
Object second = this.simpleService.getFiltered(1L, "foo", "bar");
|
||||
|
|
@ -120,7 +120,7 @@ public class JCacheKeyGeneratorTests {
|
|||
|
||||
@CacheDefaults(cacheName = "test")
|
||||
public static class SimpleService {
|
||||
private AtomicLong counter = new AtomicLong();
|
||||
private final AtomicLong counter = new AtomicLong();
|
||||
|
||||
@CacheResult
|
||||
public Object get(long id) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -71,12 +71,12 @@ public abstract class AbstractTransactionSupportingCacheManagerTests<T extends C
|
|||
|
||||
|
||||
@Test
|
||||
public void getOnExistingCache() {
|
||||
void getOnExistingCache() {
|
||||
assertThat(getCacheManager(false).getCache(CACHE_NAME)).isInstanceOf(getCacheType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getOnNewCache() {
|
||||
void getOnNewCache() {
|
||||
T cacheManager = getCacheManager(false);
|
||||
addNativeCache(this.cacheName);
|
||||
assertThat(cacheManager.getCacheNames()).doesNotContain(this.cacheName);
|
||||
|
|
@ -90,20 +90,20 @@ public abstract class AbstractTransactionSupportingCacheManagerTests<T extends C
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getOnUnknownCache() {
|
||||
void getOnUnknownCache() {
|
||||
T cacheManager = getCacheManager(false);
|
||||
assertThat(cacheManager.getCacheNames()).doesNotContain(this.cacheName);
|
||||
assertThat(cacheManager.getCache(this.cacheName)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getTransactionalOnExistingCache() {
|
||||
void getTransactionalOnExistingCache() {
|
||||
assertThat(getCacheManager(true).getCache(CACHE_NAME))
|
||||
.isInstanceOf(TransactionAwareCacheDecorator.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getTransactionalOnNewCache() {
|
||||
void getTransactionalOnNewCache() {
|
||||
T cacheManager = getCacheManager(true);
|
||||
assertThat(cacheManager.getCacheNames()).doesNotContain(this.cacheName);
|
||||
addNativeCache(this.cacheName);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2024 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,25 +30,25 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
|||
* @author Stephane Nicoll
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class TransactionAwareCacheDecoratorTests {
|
||||
class TransactionAwareCacheDecoratorTests {
|
||||
|
||||
private final TransactionTemplate txTemplate = new TransactionTemplate(new CallCountingTransactionManager());
|
||||
|
||||
|
||||
@Test
|
||||
public void createWithNullTarget() {
|
||||
void createWithNullTarget() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> new TransactionAwareCacheDecorator(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getTargetCache() {
|
||||
void getTargetCache() {
|
||||
Cache target = new ConcurrentMapCache("testCache");
|
||||
TransactionAwareCacheDecorator cache = new TransactionAwareCacheDecorator(target);
|
||||
assertThat(cache.getTargetCache()).isSameAs(target);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void regularOperationsOnTarget() {
|
||||
void regularOperationsOnTarget() {
|
||||
Cache target = new ConcurrentMapCache("testCache");
|
||||
Cache cache = new TransactionAwareCacheDecorator(target);
|
||||
assertThat(cache.getName()).isEqualTo(target.getName());
|
||||
|
|
@ -64,7 +64,7 @@ public class TransactionAwareCacheDecoratorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void putNonTransactional() {
|
||||
void putNonTransactional() {
|
||||
Cache target = new ConcurrentMapCache("testCache");
|
||||
Cache cache = new TransactionAwareCacheDecorator(target);
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ public class TransactionAwareCacheDecoratorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void putTransactional() {
|
||||
void putTransactional() {
|
||||
Cache target = new ConcurrentMapCache("testCache");
|
||||
Cache cache = new TransactionAwareCacheDecorator(target);
|
||||
Object key = new Object();
|
||||
|
|
@ -88,7 +88,7 @@ public class TransactionAwareCacheDecoratorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void putIfAbsentNonTransactional() {
|
||||
void putIfAbsentNonTransactional() {
|
||||
Cache target = new ConcurrentMapCache("testCache");
|
||||
Cache cache = new TransactionAwareCacheDecorator(target);
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ public class TransactionAwareCacheDecoratorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void putIfAbsentTransactional() { // no transactional support for putIfAbsent
|
||||
void putIfAbsentTransactional() { // no transactional support for putIfAbsent
|
||||
Cache target = new ConcurrentMapCache("testCache");
|
||||
Cache cache = new TransactionAwareCacheDecorator(target);
|
||||
Object key = new Object();
|
||||
|
|
@ -118,7 +118,7 @@ public class TransactionAwareCacheDecoratorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void evictNonTransactional() {
|
||||
void evictNonTransactional() {
|
||||
Cache target = new ConcurrentMapCache("testCache");
|
||||
Cache cache = new TransactionAwareCacheDecorator(target);
|
||||
Object key = new Object();
|
||||
|
|
@ -129,7 +129,7 @@ public class TransactionAwareCacheDecoratorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void evictTransactional() {
|
||||
void evictTransactional() {
|
||||
Cache target = new ConcurrentMapCache("testCache");
|
||||
Cache cache = new TransactionAwareCacheDecorator(target);
|
||||
Object key = new Object();
|
||||
|
|
@ -144,7 +144,7 @@ public class TransactionAwareCacheDecoratorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void evictIfPresentNonTransactional() {
|
||||
void evictIfPresentNonTransactional() {
|
||||
Cache target = new ConcurrentMapCache("testCache");
|
||||
Cache cache = new TransactionAwareCacheDecorator(target);
|
||||
Object key = new Object();
|
||||
|
|
@ -155,7 +155,7 @@ public class TransactionAwareCacheDecoratorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void evictIfPresentTransactional() { // no transactional support for evictIfPresent
|
||||
void evictIfPresentTransactional() { // no transactional support for evictIfPresent
|
||||
Cache target = new ConcurrentMapCache("testCache");
|
||||
Cache cache = new TransactionAwareCacheDecorator(target);
|
||||
Object key = new Object();
|
||||
|
|
@ -170,7 +170,7 @@ public class TransactionAwareCacheDecoratorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void clearNonTransactional() {
|
||||
void clearNonTransactional() {
|
||||
Cache target = new ConcurrentMapCache("testCache");
|
||||
Cache cache = new TransactionAwareCacheDecorator(target);
|
||||
Object key = new Object();
|
||||
|
|
@ -181,7 +181,7 @@ public class TransactionAwareCacheDecoratorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void clearTransactional() {
|
||||
void clearTransactional() {
|
||||
Cache target = new ConcurrentMapCache("testCache");
|
||||
Cache cache = new TransactionAwareCacheDecorator(target);
|
||||
Object key = new Object();
|
||||
|
|
@ -196,7 +196,7 @@ public class TransactionAwareCacheDecoratorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void invalidateNonTransactional() {
|
||||
void invalidateNonTransactional() {
|
||||
Cache target = new ConcurrentMapCache("testCache");
|
||||
Cache cache = new TransactionAwareCacheDecorator(target);
|
||||
Object key = new Object();
|
||||
|
|
@ -207,7 +207,7 @@ public class TransactionAwareCacheDecoratorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void invalidateTransactional() { // no transactional support for invalidate
|
||||
void invalidateTransactional() { // no transactional support for invalidate
|
||||
Cache target = new ConcurrentMapCache("testCache");
|
||||
Cache cache = new TransactionAwareCacheDecorator(target);
|
||||
Object key = new Object();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -32,10 +32,10 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
|||
* @author Chris Beams
|
||||
* @since 10.09.2003
|
||||
*/
|
||||
public class SimpleMailMessageTests {
|
||||
class SimpleMailMessageTests {
|
||||
|
||||
@Test
|
||||
public void testSimpleMessageCopyCtor() {
|
||||
void testSimpleMessageCopyCtor() {
|
||||
SimpleMailMessage message = new SimpleMailMessage();
|
||||
message.setFrom("me@mail.org");
|
||||
message.setTo("you@mail.org");
|
||||
|
|
@ -45,8 +45,8 @@ public class SimpleMailMessageTests {
|
|||
assertThat(messageCopy.getTo()[0]).isEqualTo("you@mail.org");
|
||||
|
||||
message.setReplyTo("reply@mail.org");
|
||||
message.setCc(new String[]{"he@mail.org", "she@mail.org"});
|
||||
message.setBcc(new String[]{"us@mail.org", "them@mail.org"});
|
||||
message.setCc("he@mail.org", "she@mail.org");
|
||||
message.setBcc("us@mail.org", "them@mail.org");
|
||||
Date sentDate = new Date();
|
||||
message.setSentDate(sentDate);
|
||||
message.setSubject("my subject");
|
||||
|
|
@ -81,12 +81,12 @@ public class SimpleMailMessageTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDeepCopyOfStringArrayTypedFieldsOnCopyCtor() throws Exception {
|
||||
void testDeepCopyOfStringArrayTypedFieldsOnCopyCtor() {
|
||||
|
||||
SimpleMailMessage original = new SimpleMailMessage();
|
||||
original.setTo(new String[]{"fiona@mail.org", "apple@mail.org"});
|
||||
original.setCc(new String[]{"he@mail.org", "she@mail.org"});
|
||||
original.setBcc(new String[]{"us@mail.org", "them@mail.org"});
|
||||
original.setTo("fiona@mail.org", "apple@mail.org");
|
||||
original.setCc("he@mail.org", "she@mail.org");
|
||||
original.setBcc("us@mail.org", "them@mail.org");
|
||||
|
||||
SimpleMailMessage copy = new SimpleMailMessage(original);
|
||||
|
||||
|
|
@ -160,13 +160,13 @@ public class SimpleMailMessageTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCopyCtorChokesOnNullOriginalMessage() throws Exception {
|
||||
void testCopyCtorChokesOnNullOriginalMessage() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
new SimpleMailMessage(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCopyToChokesOnNullTargetMessage() throws Exception {
|
||||
void testCopyToChokesOnNullTargetMessage() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
new SimpleMailMessage().copyTo(null));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -29,10 +29,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class ConfigurableMimeFileTypeMapTests {
|
||||
class ConfigurableMimeFileTypeMapTests {
|
||||
|
||||
@Test
|
||||
public void againstDefaultConfiguration() throws Exception {
|
||||
void againstDefaultConfiguration() {
|
||||
ConfigurableMimeFileTypeMap ftm = new ConfigurableMimeFileTypeMap();
|
||||
ftm.afterPropertiesSet();
|
||||
|
||||
|
|
@ -45,15 +45,15 @@ public class ConfigurableMimeFileTypeMapTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void againstDefaultConfigurationWithFilePath() throws Exception {
|
||||
void againstDefaultConfigurationWithFilePath() {
|
||||
ConfigurableMimeFileTypeMap ftm = new ConfigurableMimeFileTypeMap();
|
||||
assertThat(ftm.getContentType(new File("/tmp/foobar.HTM"))).as("Invalid content type for HTM").isEqualTo("text/html");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withAdditionalMappings() throws Exception {
|
||||
void withAdditionalMappings() {
|
||||
ConfigurableMimeFileTypeMap ftm = new ConfigurableMimeFileTypeMap();
|
||||
ftm.setMappings(new String[] {"foo/bar HTM foo", "foo/cpp c++"});
|
||||
ftm.setMappings("foo/bar HTM foo", "foo/cpp c++");
|
||||
ftm.afterPropertiesSet();
|
||||
|
||||
assertThat(ftm.getContentType("foobar.HTM")).as("Invalid content type for HTM - override didn't work").isEqualTo("foo/bar");
|
||||
|
|
@ -62,7 +62,7 @@ public class ConfigurableMimeFileTypeMapTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void withCustomMappingLocation() throws Exception {
|
||||
void withCustomMappingLocation() {
|
||||
Resource resource = new ClassPathResource("test.mime.types", getClass());
|
||||
|
||||
ConfigurableMimeFileTypeMap ftm = new ConfigurableMimeFileTypeMap();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
|||
* @author Sam Brannen
|
||||
* @since 09.07.2005
|
||||
*/
|
||||
public class InternetAddressEditorTests {
|
||||
class InternetAddressEditorTests {
|
||||
|
||||
private static final String EMPTY = "";
|
||||
private static final String SIMPLE = "nobody@nowhere.com";
|
||||
|
|
@ -36,42 +36,42 @@ public class InternetAddressEditorTests {
|
|||
|
||||
|
||||
@Test
|
||||
public void uninitialized() {
|
||||
void uninitialized() {
|
||||
assertThat(editor.getAsText()).as("Uninitialized editor did not return empty value string").isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setNull() {
|
||||
void setNull() {
|
||||
editor.setAsText(null);
|
||||
assertThat(editor.getAsText()).as("Setting null did not result in empty value string").isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setEmpty() {
|
||||
void setEmpty() {
|
||||
editor.setAsText(EMPTY);
|
||||
assertThat(editor.getAsText()).as("Setting empty string did not result in empty value string").isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void allWhitespace() {
|
||||
void allWhitespace() {
|
||||
editor.setAsText(" ");
|
||||
assertThat(editor.getAsText()).as("All whitespace was not recognized").isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void simpleGoodAddress() {
|
||||
void simpleGoodAddress() {
|
||||
editor.setAsText(SIMPLE);
|
||||
assertThat(editor.getAsText()).as("Simple email address failed").isEqualTo(SIMPLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void excessWhitespace() {
|
||||
void excessWhitespace() {
|
||||
editor.setAsText(" " + SIMPLE + " ");
|
||||
assertThat(editor.getAsText()).as("Whitespace was not stripped").isEqualTo(SIMPLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void simpleBadAddress() {
|
||||
void simpleBadAddress() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
editor.setAsText(BAD));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -456,7 +456,7 @@ class JavaMailSenderTests {
|
|||
private String connectedUsername = null;
|
||||
private String connectedPassword = null;
|
||||
private boolean closeCalled = false;
|
||||
private List<Message> sentMessages = new ArrayList<>();
|
||||
private final List<Message> sentMessages = new ArrayList<>();
|
||||
|
||||
private MockTransport(Session session, URLName urlName) {
|
||||
super(session, urlName);
|
||||
|
|
@ -504,7 +504,7 @@ class JavaMailSenderTests {
|
|||
|
||||
@Override
|
||||
public synchronized void close() throws MessagingException {
|
||||
if ("".equals(connectedHost)) {
|
||||
if (this.connectedHost.isEmpty()) {
|
||||
throw new MessagingException("close failure");
|
||||
}
|
||||
this.closeCalled = true;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
* @author Mark Fisher
|
||||
* @since 3.0
|
||||
*/
|
||||
public class QuartzSchedulerLifecycleTests {
|
||||
class QuartzSchedulerLifecycleTests {
|
||||
|
||||
@Test // SPR-6354
|
||||
public void destroyLazyInitSchedulerWithDefaultShutdownOrderDoesNotHang() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -25,7 +25,6 @@ import javax.sql.DataSource;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.quartz.Scheduler;
|
||||
import org.quartz.SchedulerContext;
|
||||
import org.quartz.SchedulerFactory;
|
||||
|
|
@ -352,7 +351,6 @@ class QuartzSupportTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("resource")
|
||||
void schedulerAutoStartsOnContextRefreshedEventByDefault() throws Exception {
|
||||
StaticApplicationContext context = new StaticApplicationContext();
|
||||
context.registerBeanDefinition("scheduler", new RootBeanDefinition(SchedulerFactoryBean.class));
|
||||
|
|
@ -363,7 +361,6 @@ class QuartzSupportTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("resource")
|
||||
void schedulerAutoStartupFalse() throws Exception {
|
||||
StaticApplicationContext context = new StaticApplicationContext();
|
||||
BeanDefinition beanDefinition = BeanDefinitionBuilder.genericBeanDefinition(SchedulerFactoryBean.class)
|
||||
|
|
@ -376,7 +373,7 @@ class QuartzSupportTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
void schedulerRepositoryExposure() throws Exception {
|
||||
void schedulerRepositoryExposure() {
|
||||
try (ClassPathXmlApplicationContext ctx = context("schedulerRepositoryExposure.xml")) {
|
||||
assertThat(ctx.getBean("scheduler")).isSameAs(SchedulerRepository.getInstance().lookup("myScheduler"));
|
||||
}
|
||||
|
|
@ -387,7 +384,7 @@ class QuartzSupportTests {
|
|||
* TODO: Against Quartz 2.2, this test's job doesn't actually execute anymore...
|
||||
*/
|
||||
@Test
|
||||
void schedulerWithHsqlDataSource() throws Exception {
|
||||
void schedulerWithHsqlDataSource() {
|
||||
DummyJob.param = 0;
|
||||
DummyJob.count = 0;
|
||||
|
||||
|
|
@ -403,7 +400,6 @@ class QuartzSupportTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("resource")
|
||||
void schedulerFactoryBeanWithCustomJobStore() throws Exception {
|
||||
StaticApplicationContext context = new StaticApplicationContext();
|
||||
|
||||
|
|
@ -459,7 +455,7 @@ class QuartzSupportTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
public synchronized void execute(JobExecutionContext jobExecutionContext) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
|
@ -480,7 +476,7 @@ class QuartzSupportTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected synchronized void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
protected synchronized void executeInternal(JobExecutionContext jobExecutionContext) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
*
|
||||
* @author Sebastien Deleuze
|
||||
*/
|
||||
public class SchedulerFactoryBeanRuntimeHintsTests {
|
||||
class SchedulerFactoryBeanRuntimeHintsTests {
|
||||
|
||||
private final RuntimeHints hints = new RuntimeHints();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
|
|
@ -39,12 +39,12 @@ import static org.assertj.core.api.Assertions.assertThatIOException;
|
|||
* @author Issam El-atif
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
public class FreeMarkerConfigurationFactoryBeanTests {
|
||||
class FreeMarkerConfigurationFactoryBeanTests {
|
||||
|
||||
private final FreeMarkerConfigurationFactoryBean fcfb = new FreeMarkerConfigurationFactoryBean();
|
||||
|
||||
@Test
|
||||
public void freeMarkerConfigurationFactoryBeanWithConfigLocation() throws Exception {
|
||||
void freeMarkerConfigurationFactoryBeanWithConfigLocation() {
|
||||
fcfb.setConfigLocation(new FileSystemResource("myprops.properties"));
|
||||
Properties props = new Properties();
|
||||
props.setProperty("myprop", "/mydir");
|
||||
|
|
@ -53,7 +53,7 @@ public class FreeMarkerConfigurationFactoryBeanTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void freeMarkerConfigurationFactoryBeanWithResourceLoaderPath() throws Exception {
|
||||
void freeMarkerConfigurationFactoryBeanWithResourceLoaderPath() throws Exception {
|
||||
fcfb.setTemplateLoaderPath("file:/mydir");
|
||||
fcfb.afterPropertiesSet();
|
||||
Configuration cfg = fcfb.getObject();
|
||||
|
|
|
|||
Loading…
Reference in New Issue