Polish
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 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,11 +23,10 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
/**
|
||||
* @author Adrian Colyer
|
||||
*/
|
||||
public class AutoProxyWithCodeStyleAspectsTests {
|
||||
class AutoProxyWithCodeStyleAspectsTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("resource")
|
||||
public void noAutoproxyingOfAjcCompiledAspects() {
|
||||
void noAutoproxyingOfAjcCompiledAspects() {
|
||||
new ClassPathXmlApplicationContext("org/springframework/aop/aspectj/autoproxy/ajcAutoproxyTests.xml");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 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,8 +23,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
public class SpringConfiguredWithAutoProxyingTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("resource")
|
||||
public void springConfiguredAndAutoProxyUsedTogether() {
|
||||
void springConfiguredAndAutoProxyUsedTogether() {
|
||||
// instantiation is sufficient to trigger failure if this is going to fail...
|
||||
new ClassPathXmlApplicationContext("org/springframework/beans/factory/aspectj/springConfigured.xml");
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -25,10 +25,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public class XmlBeanConfigurerTests {
|
||||
class XmlBeanConfigurerTests {
|
||||
|
||||
@Test
|
||||
public void injection() {
|
||||
void injection() {
|
||||
try (ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"org/springframework/beans/factory/aspectj/beanConfigurerTests.xml")) {
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -451,7 +451,7 @@ public abstract class AbstractCacheAnnotationTests {
|
||||
|
||||
protected void testMultiEvict(CacheableService<?> service) {
|
||||
Object o1 = new Object();
|
||||
Object o2 = o1.toString() + "A";
|
||||
Object o2 = o1 + "A";
|
||||
|
||||
|
||||
Object r1 = service.multiCache(o1);
|
||||
@@ -556,132 +556,132 @@ public abstract class AbstractCacheAnnotationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCacheable() {
|
||||
void testCacheable() {
|
||||
testCacheable(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCacheableNull() {
|
||||
void testCacheableNull() {
|
||||
testCacheableNull(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCacheableSync() {
|
||||
void testCacheableSync() {
|
||||
testCacheableSync(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCacheableSyncNull() {
|
||||
void testCacheableSyncNull() {
|
||||
testCacheableSyncNull(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEvict() {
|
||||
void testEvict() {
|
||||
testEvict(this.cs, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEvictEarly() {
|
||||
void testEvictEarly() {
|
||||
testEvictEarly(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEvictWithException() {
|
||||
void testEvictWithException() {
|
||||
testEvictException(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEvictAll() {
|
||||
void testEvictAll() {
|
||||
testEvictAll(this.cs, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEvictAllEarly() {
|
||||
void testEvictAllEarly() {
|
||||
testEvictAllEarly(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEvictWithKey() {
|
||||
void testEvictWithKey() {
|
||||
testEvictWithKey(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEvictWithKeyEarly() {
|
||||
void testEvictWithKeyEarly() {
|
||||
testEvictWithKeyEarly(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConditionalExpression() {
|
||||
void testConditionalExpression() {
|
||||
testConditionalExpression(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConditionalExpressionSync() {
|
||||
void testConditionalExpressionSync() {
|
||||
testConditionalExpressionSync(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnlessExpression() {
|
||||
void testUnlessExpression() {
|
||||
testUnlessExpression(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassCacheUnlessExpression() {
|
||||
void testClassCacheUnlessExpression() {
|
||||
testUnlessExpression(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testKeyExpression() {
|
||||
void testKeyExpression() {
|
||||
testKeyExpression(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVarArgsKey() {
|
||||
void testVarArgsKey() {
|
||||
testVarArgsKey(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassCacheCacheable() {
|
||||
void testClassCacheCacheable() {
|
||||
testCacheable(this.ccs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassCacheEvict() {
|
||||
void testClassCacheEvict() {
|
||||
testEvict(this.ccs, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassEvictEarly() {
|
||||
void testClassEvictEarly() {
|
||||
testEvictEarly(this.ccs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassEvictAll() {
|
||||
void testClassEvictAll() {
|
||||
testEvictAll(this.ccs, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassEvictWithException() {
|
||||
void testClassEvictWithException() {
|
||||
testEvictException(this.ccs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassCacheEvictWithWKey() {
|
||||
void testClassCacheEvictWithWKey() {
|
||||
testEvictWithKey(this.ccs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassEvictWithKeyEarly() {
|
||||
void testClassEvictWithKeyEarly() {
|
||||
testEvictWithKeyEarly(this.ccs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullValue() {
|
||||
void testNullValue() {
|
||||
testNullValue(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassNullValue() {
|
||||
void testClassNullValue() {
|
||||
Object key = new Object();
|
||||
assertThat(this.ccs.nullValue(key)).isNull();
|
||||
int nr = this.ccs.nullInvocations().intValue();
|
||||
@@ -694,27 +694,27 @@ public abstract class AbstractCacheAnnotationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMethodName() {
|
||||
void testMethodName() {
|
||||
testMethodName(this.cs, "name");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassMethodName() {
|
||||
void testClassMethodName() {
|
||||
testMethodName(this.ccs, "nametestCache");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRootVars() {
|
||||
void testRootVars() {
|
||||
testRootVars(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassRootVars() {
|
||||
void testClassRootVars() {
|
||||
testRootVars(this.ccs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustomKeyGenerator() {
|
||||
void testCustomKeyGenerator() {
|
||||
Object param = new Object();
|
||||
Object r1 = this.cs.customKeyGenerator(param);
|
||||
assertThat(this.cs.customKeyGenerator(param)).isSameAs(r1);
|
||||
@@ -725,14 +725,14 @@ public abstract class AbstractCacheAnnotationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnknownCustomKeyGenerator() {
|
||||
void testUnknownCustomKeyGenerator() {
|
||||
Object param = new Object();
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class).isThrownBy(() ->
|
||||
this.cs.unknownCustomKeyGenerator(param));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustomCacheManager() {
|
||||
void testCustomCacheManager() {
|
||||
CacheManager customCm = this.ctx.getBean("customCacheManager", CacheManager.class);
|
||||
Object key = new Object();
|
||||
Object r1 = this.cs.customCacheManager(key);
|
||||
@@ -743,139 +743,139 @@ public abstract class AbstractCacheAnnotationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnknownCustomCacheManager() {
|
||||
void testUnknownCustomCacheManager() {
|
||||
Object param = new Object();
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class).isThrownBy(() ->
|
||||
this.cs.unknownCustomCacheManager(param));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullArg() {
|
||||
void testNullArg() {
|
||||
testNullArg(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassNullArg() {
|
||||
void testClassNullArg() {
|
||||
testNullArg(this.ccs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheckedException() {
|
||||
void testCheckedException() {
|
||||
testCheckedThrowable(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassCheckedException() {
|
||||
void testClassCheckedException() {
|
||||
testCheckedThrowable(this.ccs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheckedExceptionSync() {
|
||||
void testCheckedExceptionSync() {
|
||||
testCheckedThrowableSync(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassCheckedExceptionSync() {
|
||||
void testClassCheckedExceptionSync() {
|
||||
testCheckedThrowableSync(this.ccs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUncheckedException() {
|
||||
void testUncheckedException() {
|
||||
testUncheckedThrowable(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassUncheckedException() {
|
||||
void testClassUncheckedException() {
|
||||
testUncheckedThrowable(this.ccs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUncheckedExceptionSync() {
|
||||
void testUncheckedExceptionSync() {
|
||||
testUncheckedThrowableSync(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassUncheckedExceptionSync() {
|
||||
void testClassUncheckedExceptionSync() {
|
||||
testUncheckedThrowableSync(this.ccs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdate() {
|
||||
void testUpdate() {
|
||||
testCacheUpdate(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassUpdate() {
|
||||
void testClassUpdate() {
|
||||
testCacheUpdate(this.ccs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConditionalUpdate() {
|
||||
void testConditionalUpdate() {
|
||||
testConditionalCacheUpdate(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassConditionalUpdate() {
|
||||
void testClassConditionalUpdate() {
|
||||
testConditionalCacheUpdate(this.ccs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiCache() {
|
||||
void testMultiCache() {
|
||||
testMultiCache(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassMultiCache() {
|
||||
void testClassMultiCache() {
|
||||
testMultiCache(this.ccs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiEvict() {
|
||||
void testMultiEvict() {
|
||||
testMultiEvict(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassMultiEvict() {
|
||||
void testClassMultiEvict() {
|
||||
testMultiEvict(this.ccs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiPut() {
|
||||
void testMultiPut() {
|
||||
testMultiPut(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassMultiPut() {
|
||||
void testClassMultiPut() {
|
||||
testMultiPut(this.ccs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPutRefersToResult() {
|
||||
void testPutRefersToResult() {
|
||||
testPutRefersToResult(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassPutRefersToResult() {
|
||||
void testClassPutRefersToResult() {
|
||||
testPutRefersToResult(this.ccs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiCacheAndEvict() {
|
||||
void testMultiCacheAndEvict() {
|
||||
testMultiCacheAndEvict(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassMultiCacheAndEvict() {
|
||||
void testClassMultiCacheAndEvict() {
|
||||
testMultiCacheAndEvict(this.ccs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiConditionalCacheAndEvict() {
|
||||
void testMultiConditionalCacheAndEvict() {
|
||||
testMultiConditionalCacheAndEvict(this.cs);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassMultiConditionalCacheAndEvict() {
|
||||
void testClassMultiConditionalCacheAndEvict() {
|
||||
testMultiConditionalCacheAndEvict(this.ccs);
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author Costin Leau
|
||||
*/
|
||||
public class AspectJCacheAnnotationTests extends AbstractCacheAnnotationTests {
|
||||
class AspectJCacheAnnotationTests extends AbstractCacheAnnotationTests {
|
||||
|
||||
@Override
|
||||
protected ConfigurableApplicationContext getApplicationContext() {
|
||||
@@ -37,7 +37,7 @@ public class AspectJCacheAnnotationTests extends AbstractCacheAnnotationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testKeyStrategy() {
|
||||
void testKeyStrategy() {
|
||||
AnnotationCacheAspect aspect = ctx.getBean(
|
||||
"org.springframework.cache.config.internalCacheAspect", AnnotationCacheAspect.class);
|
||||
assertThat(aspect.getKeyGenerator()).isSameAs(ctx.getBean("keyGenerator"));
|
||||
|
||||
@@ -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.
|
||||
@@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class AspectJEnableCachingIsolatedTests {
|
||||
class AspectJEnableCachingIsolatedTests {
|
||||
|
||||
private ConfigurableApplicationContext ctx;
|
||||
|
||||
@@ -65,14 +65,14 @@ public class AspectJEnableCachingIsolatedTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void testKeyStrategy() {
|
||||
void testKeyStrategy() {
|
||||
load(EnableCachingConfig.class);
|
||||
AnnotationCacheAspect aspect = this.ctx.getBean(AnnotationCacheAspect.class);
|
||||
assertThat(aspect.getKeyGenerator()).isSameAs(this.ctx.getBean("keyGenerator", KeyGenerator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCacheErrorHandler() {
|
||||
void testCacheErrorHandler() {
|
||||
load(EnableCachingConfig.class);
|
||||
AnnotationCacheAspect aspect = this.ctx.getBean(AnnotationCacheAspect.class);
|
||||
assertThat(aspect.getErrorHandler()).isSameAs(this.ctx.getBean("errorHandler", CacheErrorHandler.class));
|
||||
@@ -82,12 +82,12 @@ public class AspectJEnableCachingIsolatedTests {
|
||||
// --- local tests -------
|
||||
|
||||
@Test
|
||||
public void singleCacheManagerBean() {
|
||||
void singleCacheManagerBean() {
|
||||
load(SingleCacheManagerConfig.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void multipleCacheManagerBeans() {
|
||||
void multipleCacheManagerBeans() {
|
||||
try {
|
||||
load(MultiCacheManagerConfig.class);
|
||||
}
|
||||
@@ -97,12 +97,12 @@ public class AspectJEnableCachingIsolatedTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void multipleCacheManagerBeans_implementsCachingConfigurer() {
|
||||
void multipleCacheManagerBeans_implementsCachingConfigurer() {
|
||||
load(MultiCacheManagerConfigurer.class); // does not throw
|
||||
}
|
||||
|
||||
@Test
|
||||
public void multipleCachingConfigurers() {
|
||||
void multipleCachingConfigurers() {
|
||||
try {
|
||||
load(MultiCacheManagerConfigurer.class, EnableCachingConfig.class);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public class AspectJEnableCachingIsolatedTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noCacheManagerBeans() {
|
||||
void noCacheManagerBeans() {
|
||||
try {
|
||||
load(EmptyConfig.class);
|
||||
}
|
||||
@@ -132,7 +132,7 @@ public class AspectJEnableCachingIsolatedTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bothSetOnlyResolverIsUsed() {
|
||||
void bothSetOnlyResolverIsUsed() {
|
||||
load(FullCachingConfig.class);
|
||||
|
||||
AnnotationCacheAspect aspect = this.ctx.getBean(AnnotationCacheAspect.class);
|
||||
|
||||
@@ -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.
|
||||
@@ -37,7 +37,7 @@ import org.springframework.context.testfixture.cache.SomeKeyGenerator;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class AspectJEnableCachingTests extends AbstractCacheAnnotationTests {
|
||||
class AspectJEnableCachingTests extends AbstractCacheAnnotationTests {
|
||||
|
||||
@Override
|
||||
protected ConfigurableApplicationContext getApplicationContext() {
|
||||
|
||||
@@ -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.
|
||||
@@ -34,7 +34,7 @@ import org.springframework.contextsupport.testfixture.jcache.AbstractJCacheAnnot
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class JCacheAspectJJavaConfigTests extends AbstractJCacheAnnotationTests {
|
||||
class JCacheAspectJJavaConfigTests extends AbstractJCacheAnnotationTests {
|
||||
|
||||
@Override
|
||||
protected ApplicationContext getApplicationContext() {
|
||||
|
||||
@@ -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.
|
||||
@@ -24,7 +24,7 @@ import org.springframework.contextsupport.testfixture.jcache.AbstractJCacheAnnot
|
||||
* @author Stephane Nicoll
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
public class JCacheAspectJNamespaceConfigTests extends AbstractJCacheAnnotationTests {
|
||||
class JCacheAspectJNamespaceConfigTests 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.
|
||||
@@ -33,10 +33,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Chris Beams
|
||||
* @since 3.1
|
||||
*/
|
||||
public class AnnotationBeanConfigurerTests {
|
||||
class AnnotationBeanConfigurerTests {
|
||||
|
||||
@Test
|
||||
public void injection() {
|
||||
void injection() {
|
||||
try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class)) {
|
||||
ShouldBeConfiguredBySpring myObject = new ShouldBeConfiguredBySpring();
|
||||
assertThat(myObject.getName()).isEqualTo("Rod");
|
||||
|
||||
@@ -64,7 +64,7 @@ public class AnnotationAsyncExecutionAspectTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void asyncMethodGetsRoutedAsynchronously() {
|
||||
void asyncMethodGetsRoutedAsynchronously() {
|
||||
ClassWithoutAsyncAnnotation obj = new ClassWithoutAsyncAnnotation();
|
||||
obj.incrementAsync();
|
||||
executor.waitForCompletion();
|
||||
@@ -74,7 +74,7 @@ public class AnnotationAsyncExecutionAspectTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void asyncMethodReturningFutureGetsRoutedAsynchronouslyAndReturnsAFuture() throws InterruptedException, ExecutionException {
|
||||
void asyncMethodReturningFutureGetsRoutedAsynchronouslyAndReturnsAFuture() throws InterruptedException, ExecutionException {
|
||||
ClassWithoutAsyncAnnotation obj = new ClassWithoutAsyncAnnotation();
|
||||
Future<Integer> future = obj.incrementReturningAFuture();
|
||||
// No need to executor.waitForCompletion() as future.get() will have the same effect
|
||||
@@ -85,7 +85,7 @@ public class AnnotationAsyncExecutionAspectTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void syncMethodGetsRoutedSynchronously() {
|
||||
void syncMethodGetsRoutedSynchronously() {
|
||||
ClassWithoutAsyncAnnotation obj = new ClassWithoutAsyncAnnotation();
|
||||
obj.increment();
|
||||
assertThat(obj.counter).isEqualTo(1);
|
||||
@@ -94,7 +94,7 @@ public class AnnotationAsyncExecutionAspectTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void voidMethodInAsyncClassGetsRoutedAsynchronously() {
|
||||
void voidMethodInAsyncClassGetsRoutedAsynchronously() {
|
||||
ClassWithAsyncAnnotation obj = new ClassWithAsyncAnnotation();
|
||||
obj.increment();
|
||||
executor.waitForCompletion();
|
||||
@@ -104,7 +104,7 @@ public class AnnotationAsyncExecutionAspectTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void methodReturningFutureInAsyncClassGetsRoutedAsynchronouslyAndReturnsAFuture() throws InterruptedException, ExecutionException {
|
||||
void methodReturningFutureInAsyncClassGetsRoutedAsynchronouslyAndReturnsAFuture() throws InterruptedException, ExecutionException {
|
||||
ClassWithAsyncAnnotation obj = new ClassWithAsyncAnnotation();
|
||||
Future<Integer> future = obj.incrementReturningAFuture();
|
||||
assertThat(future.get().intValue()).isEqualTo(5);
|
||||
@@ -115,7 +115,7 @@ public class AnnotationAsyncExecutionAspectTests {
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void methodReturningNonVoidNonFutureInAsyncClassGetsRoutedSynchronously() {
|
||||
void methodReturningNonVoidNonFutureInAsyncClassGetsRoutedSynchronously() {
|
||||
ClassWithAsyncAnnotation obj = new ClassWithAsyncAnnotation();
|
||||
int returnValue = obj.return5();
|
||||
assertEquals(5, returnValue);
|
||||
@@ -125,7 +125,7 @@ public class AnnotationAsyncExecutionAspectTests {
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void qualifiedAsyncMethodsAreRoutedToCorrectExecutor() throws InterruptedException, ExecutionException {
|
||||
void qualifiedAsyncMethodsAreRoutedToCorrectExecutor() throws InterruptedException, ExecutionException {
|
||||
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
|
||||
beanFactory.registerBeanDefinition("e1", new RootBeanDefinition(ThreadPoolTaskExecutor.class));
|
||||
AnnotationAsyncExecutionAspect.aspectOf().setBeanFactory(beanFactory);
|
||||
@@ -144,7 +144,7 @@ public class AnnotationAsyncExecutionAspectTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exceptionHandlerCalled() {
|
||||
void exceptionHandlerCalled() {
|
||||
Method m = ReflectionUtils.findMethod(ClassWithException.class, "failWithVoid");
|
||||
TestableAsyncUncaughtExceptionHandler exceptionHandler = new TestableAsyncUncaughtExceptionHandler();
|
||||
AnnotationAsyncExecutionAspect.aspectOf().setExceptionHandler(exceptionHandler);
|
||||
@@ -161,7 +161,7 @@ public class AnnotationAsyncExecutionAspectTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exceptionHandlerNeverThrowsUnexpectedException() {
|
||||
void exceptionHandlerNeverThrowsUnexpectedException() {
|
||||
Method m = ReflectionUtils.findMethod(ClassWithException.class, "failWithVoid");
|
||||
TestableAsyncUncaughtExceptionHandler exceptionHandler = new TestableAsyncUncaughtExceptionHandler(true);
|
||||
AnnotationAsyncExecutionAspect.aspectOf().setExceptionHandler(exceptionHandler);
|
||||
|
||||
@@ -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.
|
||||
@@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class AnnotationDrivenBeanDefinitionParserTests {
|
||||
class AnnotationDrivenBeanDefinitionParserTests {
|
||||
|
||||
private ConfigurableApplicationContext context;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class AnnotationDrivenBeanDefinitionParserTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void asyncAspectRegistered() {
|
||||
void asyncAspectRegistered() {
|
||||
assertThat(context.containsBean(TaskManagementConfigUtils.ASYNC_EXECUTION_ASPECT_BEAN_NAME)).isTrue();
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -74,14 +74,6 @@ class TestableAsyncUncaughtExceptionHandler
|
||||
}
|
||||
}
|
||||
|
||||
private static final class UncaughtExceptionDescriptor {
|
||||
private final Throwable ex;
|
||||
|
||||
private final Method method;
|
||||
|
||||
private UncaughtExceptionDescriptor(Throwable ex, Method method) {
|
||||
this.ex = ex;
|
||||
this.method = method;
|
||||
}
|
||||
private record UncaughtExceptionDescriptor(Throwable ex, Method method) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -47,14 +47,14 @@ public class JtaTransactionAspectsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void commitOnAnnotatedPublicMethod() throws Throwable {
|
||||
void commitOnAnnotatedPublicMethod() throws Throwable {
|
||||
assertThat(this.txManager.begun).isEqualTo(0);
|
||||
new JtaAnnotationPublicAnnotatedMember().echo(null);
|
||||
assertThat(this.txManager.commits).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchingRollbackOnApplied() throws Throwable {
|
||||
void matchingRollbackOnApplied() {
|
||||
assertThat(this.txManager.begun).isEqualTo(0);
|
||||
InterruptedException test = new InterruptedException();
|
||||
assertThatExceptionOfType(InterruptedException.class).isThrownBy(() ->
|
||||
@@ -65,7 +65,7 @@ public class JtaTransactionAspectsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nonMatchingRollbackOnApplied() throws Throwable {
|
||||
void nonMatchingRollbackOnApplied() {
|
||||
assertThat(this.txManager.begun).isEqualTo(0);
|
||||
IOException test = new IOException();
|
||||
assertThatIOException().isThrownBy(() ->
|
||||
@@ -76,35 +76,35 @@ public class JtaTransactionAspectsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void commitOnAnnotatedProtectedMethod() {
|
||||
void commitOnAnnotatedProtectedMethod() {
|
||||
assertThat(this.txManager.begun).isEqualTo(0);
|
||||
new JtaAnnotationProtectedAnnotatedMember().doInTransaction();
|
||||
assertThat(this.txManager.commits).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nonAnnotatedMethodCallingProtectedMethod() {
|
||||
void nonAnnotatedMethodCallingProtectedMethod() {
|
||||
assertThat(this.txManager.begun).isEqualTo(0);
|
||||
new JtaAnnotationProtectedAnnotatedMember().doSomething();
|
||||
assertThat(this.txManager.commits).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void commitOnAnnotatedPrivateMethod() {
|
||||
void commitOnAnnotatedPrivateMethod() {
|
||||
assertThat(this.txManager.begun).isEqualTo(0);
|
||||
new JtaAnnotationPrivateAnnotatedMember().doInTransaction();
|
||||
assertThat(this.txManager.commits).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nonAnnotatedMethodCallingPrivateMethod() {
|
||||
void nonAnnotatedMethodCallingPrivateMethod() {
|
||||
assertThat(this.txManager.begun).isEqualTo(0);
|
||||
new JtaAnnotationPrivateAnnotatedMember().doSomething();
|
||||
assertThat(this.txManager.commits).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void notTransactional() {
|
||||
void notTransactional() {
|
||||
assertThat(this.txManager.begun).isEqualTo(0);
|
||||
new TransactionAspectTests.NotTransactional().noop();
|
||||
assertThat(this.txManager.begun).isEqualTo(0);
|
||||
|
||||
@@ -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.assertj.core.api.Assertions.assertThatRuntimeException;
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
public class TransactionAspectTests {
|
||||
class TransactionAspectTests {
|
||||
|
||||
private final CallCountingTransactionManager txManager = new CallCountingTransactionManager();
|
||||
|
||||
@@ -56,7 +56,7 @@ public class TransactionAspectTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void testCommitOnAnnotatedClass() throws Throwable {
|
||||
void testCommitOnAnnotatedClass() throws Throwable {
|
||||
txManager.clear();
|
||||
assertThat(txManager.begun).isEqualTo(0);
|
||||
annotationOnlyOnClassWithNoInterface.echo(null);
|
||||
@@ -64,7 +64,7 @@ public class TransactionAspectTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void commitOnAnnotatedProtectedMethod() throws Throwable {
|
||||
void commitOnAnnotatedProtectedMethod() {
|
||||
txManager.clear();
|
||||
assertThat(txManager.begun).isEqualTo(0);
|
||||
beanWithAnnotatedProtectedMethod.doInTransaction();
|
||||
@@ -72,7 +72,7 @@ public class TransactionAspectTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void commitOnAnnotatedPrivateMethod() throws Throwable {
|
||||
void commitOnAnnotatedPrivateMethod() {
|
||||
txManager.clear();
|
||||
assertThat(txManager.begun).isEqualTo(0);
|
||||
beanWithAnnotatedPrivateMethod.doSomething();
|
||||
@@ -80,7 +80,7 @@ public class TransactionAspectTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void commitOnNonAnnotatedNonPublicMethodInTransactionalType() throws Throwable {
|
||||
void commitOnNonAnnotatedNonPublicMethodInTransactionalType() {
|
||||
txManager.clear();
|
||||
assertThat(txManager.begun).isEqualTo(0);
|
||||
annotationOnlyOnClassWithNoInterface.nonTransactionalMethod();
|
||||
@@ -88,7 +88,7 @@ public class TransactionAspectTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void commitOnAnnotatedMethod() throws Throwable {
|
||||
void commitOnAnnotatedMethod() throws Throwable {
|
||||
txManager.clear();
|
||||
assertThat(txManager.begun).isEqualTo(0);
|
||||
methodAnnotationOnly.echo(null);
|
||||
@@ -96,7 +96,7 @@ public class TransactionAspectTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void notTransactional() throws Throwable {
|
||||
void notTransactional() {
|
||||
txManager.clear();
|
||||
assertThat(txManager.begun).isEqualTo(0);
|
||||
new NotTransactional().noop();
|
||||
@@ -104,7 +104,7 @@ public class TransactionAspectTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultCommitOnAnnotatedClass() throws Throwable {
|
||||
void defaultCommitOnAnnotatedClass() {
|
||||
Exception ex = new Exception();
|
||||
assertThatException()
|
||||
.isThrownBy(() -> testRollback(() -> annotationOnlyOnClassWithNoInterface.echo(ex), false))
|
||||
@@ -112,7 +112,7 @@ public class TransactionAspectTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultRollbackOnAnnotatedClass() throws Throwable {
|
||||
void defaultRollbackOnAnnotatedClass() {
|
||||
RuntimeException ex = new RuntimeException();
|
||||
assertThatRuntimeException()
|
||||
.isThrownBy(() -> testRollback(() -> annotationOnlyOnClassWithNoInterface.echo(ex), true))
|
||||
@@ -120,7 +120,7 @@ public class TransactionAspectTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultCommitOnSubclassOfAnnotatedClass() throws Throwable {
|
||||
void defaultCommitOnSubclassOfAnnotatedClass() {
|
||||
Exception ex = new Exception();
|
||||
assertThatException()
|
||||
.isThrownBy(() -> testRollback(() -> new SubclassOfClassWithTransactionalAnnotation().echo(ex), false))
|
||||
@@ -128,7 +128,7 @@ public class TransactionAspectTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultCommitOnSubclassOfClassWithTransactionalMethodAnnotated() throws Throwable {
|
||||
void defaultCommitOnSubclassOfClassWithTransactionalMethodAnnotated() {
|
||||
Exception ex = new Exception();
|
||||
assertThatException()
|
||||
.isThrownBy(() -> testRollback(() -> new SubclassOfClassWithTransactionalMethodAnnotation().echo(ex), false))
|
||||
@@ -136,13 +136,13 @@ public class TransactionAspectTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noCommitOnImplementationOfAnnotatedInterface() throws Throwable {
|
||||
void noCommitOnImplementationOfAnnotatedInterface() {
|
||||
Exception ex = new Exception();
|
||||
testNotTransactional(() -> new ImplementsAnnotatedInterface().echo(ex), ex);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noRollbackOnImplementationOfAnnotatedInterface() throws Throwable {
|
||||
void noRollbackOnImplementationOfAnnotatedInterface() {
|
||||
Exception rollbackProvokingException = new RuntimeException();
|
||||
testNotTransactional(() -> new ImplementsAnnotatedInterface().echo(rollbackProvokingException),
|
||||
rollbackProvokingException);
|
||||
@@ -164,7 +164,7 @@ public class TransactionAspectTests {
|
||||
}
|
||||
}
|
||||
|
||||
protected void testNotTransactional(TransactionOperationCallback toc, Throwable expected) throws Throwable {
|
||||
protected void testNotTransactional(TransactionOperationCallback toc, Throwable expected) {
|
||||
txManager.clear();
|
||||
assertThat(txManager.begun).isEqualTo(0);
|
||||
assertThatExceptionOfType(Throwable.class)
|
||||
|
||||
Reference in New Issue
Block a user