Browse Source

Merge branch '7.0.x'

dependabot/npm_and_yarn/framework-docs/fast-xml-parser-5.5.7
Sam Brannen 4 days ago
parent
commit
003d8b2f80
  1. 6
      integration-tests/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java
  2. 16
      integration-tests/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java
  3. 6
      integration-tests/src/test/java/org/springframework/beans/factory/xml/ComponentBeanDefinitionParserTests.java
  4. 20
      integration-tests/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java
  5. 80
      spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java
  6. 4
      spring-aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java
  7. 6
      spring-aop/src/test/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPointTests.java
  8. 10
      spring-aop/src/test/java/org/springframework/aop/aspectj/TrickyAspectJPointcutExpressionTests.java
  9. 6
      spring-aop/src/test/java/org/springframework/aop/aspectj/TypePatternClassFilterTests.java
  10. 8
      spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectJPointcutAdvisorTests.java
  11. 18
      spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java
  12. 8
      spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJNamespaceHandlerTests.java
  13. 18
      spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparatorTests.java
  14. 4
      spring-aop/src/test/java/org/springframework/aop/framework/MethodInvocationTests.java
  15. 4
      spring-aop/src/test/java/org/springframework/aop/framework/NullPrimitiveTests.java
  16. 4
      spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java
  17. 12
      spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java
  18. 4
      spring-aop/src/test/java/org/springframework/aop/interceptor/DebugInterceptorTests.java
  19. 4
      spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisorsTests.java
  20. 2
      spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java
  21. 6
      spring-aop/src/test/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptorTests.java
  22. 4
      spring-aop/src/test/java/org/springframework/aop/interceptor/SimpleTraceInterceptorTests.java
  23. 8
      spring-aop/src/test/java/org/springframework/aop/scope/DefaultScopedObjectTests.java
  24. 4
      spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java
  25. 10
      spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java
  26. 10
      spring-aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java
  27. 2
      spring-aop/src/test/java/org/springframework/aop/support/ControlFlowPointcutTests.java
  28. 20
      spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java
  29. 12
      spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java
  30. 14
      spring-aop/src/test/java/org/springframework/aop/support/PointcutsTests.java
  31. 6
      spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java
  32. 6
      spring-aop/src/test/java/org/springframework/aop/support/RootClassFilterTests.java
  33. 2
      spring-aop/src/test/java/org/springframework/aop/target/CommonsPool2TargetSourceProxyTests.java
  34. 10
      spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java
  35. 2
      spring-aop/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java
  36. 2
      spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java
  37. 2
      spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java
  38. 10
      spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java
  39. 8
      spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java
  40. 127
      spring-aspects/src/test/java/org/springframework/cache/aspectj/AbstractCacheAnnotationTests.java
  41. 2
      spring-aspects/src/test/java/org/springframework/cache/aspectj/AspectJCacheAnnotationTests.java
  42. 17
      spring-aspects/src/test/java/org/springframework/cache/aspectj/AspectJEnableCachingIsolatedTests.java
  43. 4
      spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationDrivenBeanDefinitionParserTests.java
  44. 4
      spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests.java
  45. 2
      spring-beans/src/test/java/org/springframework/beans/AbstractPropertyAccessorTests.java
  46. 30
      spring-beans/src/test/java/org/springframework/beans/BeanWrapperEnumTests.java
  47. 84
      spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java
  48. 4
      spring-beans/src/test/java/org/springframework/beans/ConcurrentBeanWrapperTests.java
  49. 10
      spring-beans/src/test/java/org/springframework/beans/MutablePropertyValuesTests.java
  50. 38
      spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java
  51. 12
      spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java
  52. 10
      spring-beans/src/test/java/org/springframework/beans/factory/annotation/AnnotationBeanWiringInfoResolverTests.java
  53. 2
      spring-beans/src/test/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurerTests.java
  54. 84
      spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java
  55. 20
      spring-beans/src/test/java/org/springframework/beans/factory/annotation/LookupAnnotationTests.java
  56. 4
      spring-beans/src/test/java/org/springframework/beans/factory/aot/DefaultBeanRegistrationCodeFragmentsTests.java
  57. 6
      spring-beans/src/test/java/org/springframework/beans/factory/config/CustomEditorConfigurerTests.java
  58. 14
      spring-beans/src/test/java/org/springframework/beans/factory/config/CustomScopeConfigurerTests.java
  59. 2
      spring-beans/src/test/java/org/springframework/beans/factory/config/DeprecatedBeanWarnerTests.java
  60. 20
      spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests.java
  61. 14
      spring-beans/src/test/java/org/springframework/beans/factory/config/MethodInvokingFactoryBeanTests.java
  62. 18
      spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java
  63. 14
      spring-beans/src/test/java/org/springframework/beans/factory/config/PropertiesFactoryBeanTests.java
  64. 12
      spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java
  65. 62
      spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java
  66. 24
      spring-beans/src/test/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBeanTests.java
  67. 2
      spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests.java
  68. 16
      spring-beans/src/test/java/org/springframework/beans/factory/config/YamlMapFactoryBeanTests.java
  69. 2
      spring-beans/src/test/java/org/springframework/beans/factory/parsing/ConstructorArgumentEntryTests.java
  70. 2
      spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java
  71. 4
      spring-beans/src/test/java/org/springframework/beans/factory/parsing/FailFastProblemReporterTests.java
  72. 4
      spring-beans/src/test/java/org/springframework/beans/factory/parsing/NullSourceExtractorTests.java
  73. 6
      spring-beans/src/test/java/org/springframework/beans/factory/parsing/ParseStateTests.java
  74. 4
      spring-beans/src/test/java/org/springframework/beans/factory/parsing/PassThroughSourceExtractorTests.java
  75. 6
      spring-beans/src/test/java/org/springframework/beans/factory/parsing/PropertyEntryTests.java
  76. 6
      spring-beans/src/test/java/org/springframework/beans/factory/serviceloader/ServiceLoaderTests.java
  77. 14
      spring-beans/src/test/java/org/springframework/beans/factory/support/LookupMethodTests.java
  78. 6
      spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedPropertiesTests.java
  79. 16
      spring-beans/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireBeanFactoryTests.java
  80. 10
      spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java
  81. 6
      spring-beans/src/test/java/org/springframework/beans/factory/xml/DelegatingEntityResolverTests.java
  82. 38
      spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethodTests.java
  83. 8
      spring-beans/src/test/java/org/springframework/beans/factory/xml/ProfileXmlBeanDefinitionTests.java
  84. 58
      spring-beans/src/test/java/org/springframework/beans/factory/xml/UtilNamespaceHandlerTests.java
  85. 68
      spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanCollectionTests.java
  86. 2
      spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlListableBeanFactoryTests.java
  87. 12
      spring-beans/src/test/java/org/springframework/beans/factory/xml/support/DefaultNamespaceHandlerResolverTests.java
  88. 2
      spring-beans/src/test/java/org/springframework/beans/propertyeditors/BeanInfoTests.java
  89. 12
      spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomCollectionEditorTests.java
  90. 14
      spring-beans/src/test/java/org/springframework/beans/propertyeditors/FileEditorTests.java
  91. 8
      spring-beans/src/test/java/org/springframework/beans/propertyeditors/InputStreamEditorTests.java
  92. 18
      spring-beans/src/test/java/org/springframework/beans/propertyeditors/PathEditorTests.java
  93. 8
      spring-beans/src/test/java/org/springframework/beans/propertyeditors/ReaderEditorTests.java
  94. 18
      spring-beans/src/test/java/org/springframework/beans/propertyeditors/ResourceBundleEditorTests.java
  95. 14
      spring-beans/src/test/java/org/springframework/beans/propertyeditors/URLEditorTests.java
  96. 2
      spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java
  97. 8
      spring-beans/src/test/java/org/springframework/beans/support/PropertyComparatorTests.java
  98. 8
      spring-context-support/src/test/java/org/springframework/cache/caffeine/CaffeineCacheTests.java
  99. 10
      spring-context-support/src/test/java/org/springframework/cache/jcache/JCacheEhCacheAnnotationTests.java
  100. 2
      spring-context-support/src/test/java/org/springframework/cache/jcache/JCacheEhCacheApiTests.java
  101. Some files were not shown because too many files have changed in this diff Show More

6
integration-tests/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java

@ -61,7 +61,7 @@ class AopNamespaceHandlerScopeIntegrationTests { @@ -61,7 +61,7 @@ class AopNamespaceHandlerScopeIntegrationTests {
@Test
void testSingletonScoping() throws Exception {
void singletonScoping() throws Exception {
assertThat(AopUtils.isAopProxy(singletonScoped)).as("Should be AOP proxy").isTrue();
boolean condition = singletonScoped instanceof TestBean;
assertThat(condition).as("Should be target class proxy").isTrue();
@ -75,7 +75,7 @@ class AopNamespaceHandlerScopeIntegrationTests { @@ -75,7 +75,7 @@ class AopNamespaceHandlerScopeIntegrationTests {
}
@Test
void testRequestScoping() {
void requestScoping() {
MockHttpServletRequest oldRequest = new MockHttpServletRequest();
MockHttpServletRequest newRequest = new MockHttpServletRequest();
@ -103,7 +103,7 @@ class AopNamespaceHandlerScopeIntegrationTests { @@ -103,7 +103,7 @@ class AopNamespaceHandlerScopeIntegrationTests {
}
@Test
void testSessionScoping() {
void sessionScoping() {
MockHttpSession oldSession = new MockHttpSession();
MockHttpSession newSession = new MockHttpSession();

16
integration-tests/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java

@ -65,7 +65,7 @@ class AdvisorAutoProxyCreatorIntegrationTests { @@ -65,7 +65,7 @@ class AdvisorAutoProxyCreatorIntegrationTests {
}
@Test
void testDefaultExclusionPrefix() {
void defaultExclusionPrefix() {
DefaultAdvisorAutoProxyCreator aapc = (DefaultAdvisorAutoProxyCreator) getBeanFactory().getBean(ADVISOR_APC_BEAN_NAME);
assertThat(aapc.getAdvisorBeanNamePrefix()).isEqualTo((ADVISOR_APC_BEAN_NAME + DefaultAdvisorAutoProxyCreator.SEPARATOR));
assertThat(aapc.isUsePrefix()).isFalse();
@ -75,21 +75,21 @@ class AdvisorAutoProxyCreatorIntegrationTests { @@ -75,21 +75,21 @@ class AdvisorAutoProxyCreatorIntegrationTests {
* If no pointcuts match (no attrs) there should be proxying.
*/
@Test
void testNoProxy() {
void noProxy() {
BeanFactory bf = getBeanFactory();
Object o = bf.getBean("noSetters");
assertThat(AopUtils.isAopProxy(o)).isFalse();
}
@Test
void testTxIsProxied() {
void txIsProxied() {
BeanFactory bf = getBeanFactory();
ITestBean test = (ITestBean) bf.getBean("test");
assertThat(AopUtils.isAopProxy(test)).isTrue();
}
@Test
void testRegexpApplied() {
void regexpApplied() {
BeanFactory bf = getBeanFactory();
ITestBean test = (ITestBean) bf.getBean("test");
MethodCounter counter = (MethodCounter) bf.getBean("countingAdvice");
@ -99,7 +99,7 @@ class AdvisorAutoProxyCreatorIntegrationTests { @@ -99,7 +99,7 @@ class AdvisorAutoProxyCreatorIntegrationTests {
}
@Test
void testTransactionAttributeOnMethod() {
void transactionAttributeOnMethod() {
BeanFactory bf = getBeanFactory();
ITestBean test = (ITestBean) bf.getBean("test");
@ -121,7 +121,7 @@ class AdvisorAutoProxyCreatorIntegrationTests { @@ -121,7 +121,7 @@ class AdvisorAutoProxyCreatorIntegrationTests {
* Should not roll back on servlet exception.
*/
@Test
void testRollbackRulesOnMethodCauseRollback() throws Exception {
void rollbackRulesOnMethodCauseRollback() throws Exception {
BeanFactory bf = getBeanFactory();
Rollback rb = (Rollback) bf.getBean("rollback");
@ -147,7 +147,7 @@ class AdvisorAutoProxyCreatorIntegrationTests { @@ -147,7 +147,7 @@ class AdvisorAutoProxyCreatorIntegrationTests {
}
@Test
void testRollbackRulesOnMethodPreventRollback() throws Exception {
void rollbackRulesOnMethodPreventRollback() throws Exception {
BeanFactory bf = getBeanFactory();
Rollback rb = (Rollback) bf.getBean("rollback");
@ -164,7 +164,7 @@ class AdvisorAutoProxyCreatorIntegrationTests { @@ -164,7 +164,7 @@ class AdvisorAutoProxyCreatorIntegrationTests {
}
@Test
void testProgrammaticRollback() {
void programmaticRollback() {
BeanFactory bf = getBeanFactory();
Object bean = bf.getBean(TXMANAGER_BEAN_NAME);

6
integration-tests/src/test/java/org/springframework/beans/factory/xml/ComponentBeanDefinitionParserTests.java

@ -50,13 +50,13 @@ class ComponentBeanDefinitionParserTests { @@ -50,13 +50,13 @@ class ComponentBeanDefinitionParserTests {
}
@Test
void testBionicBasic() {
void bionicBasic() {
Component cp = getBionicFamily();
assertThat(cp.getName()).isEqualTo("Bionic-1");
}
@Test
void testBionicFirstLevelChildren() {
void bionicFirstLevelChildren() {
Component cp = getBionicFamily();
List<Component> components = cp.getComponents();
assertThat(components).hasSize(2);
@ -65,7 +65,7 @@ class ComponentBeanDefinitionParserTests { @@ -65,7 +65,7 @@ class ComponentBeanDefinitionParserTests {
}
@Test
void testBionicSecondLevelChildren() {
void bionicSecondLevelChildren() {
Component cp = getBionicFamily();
List<Component> components = cp.getComponents().get(0).getComponents();
assertThat(components).hasSize(2);

20
integration-tests/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java

@ -83,7 +83,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests { @@ -83,7 +83,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
@Test
void testPrototype() {
void prototype() {
ApplicationContext context = createContext(ScopedProxyMode.NO);
ScopedTestBean bean = (ScopedTestBean) context.getBean("prototype");
assertThat(bean).isNotNull();
@ -92,7 +92,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests { @@ -92,7 +92,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
}
@Test
void testSingletonScopeWithNoProxy() {
void singletonScopeWithNoProxy() {
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
ApplicationContext context = createContext(ScopedProxyMode.NO);
ScopedTestBean bean = (ScopedTestBean) context.getBean("singleton");
@ -115,7 +115,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests { @@ -115,7 +115,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
}
@Test
void testSingletonScopeIgnoresProxyInterfaces() {
void singletonScopeIgnoresProxyInterfaces() {
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
ApplicationContext context = createContext(ScopedProxyMode.INTERFACES);
ScopedTestBean bean = (ScopedTestBean) context.getBean("singleton");
@ -136,7 +136,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests { @@ -136,7 +136,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
}
@Test
void testSingletonScopeIgnoresProxyTargetClass() {
void singletonScopeIgnoresProxyTargetClass() {
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
ApplicationContext context = createContext(ScopedProxyMode.TARGET_CLASS);
ScopedTestBean bean = (ScopedTestBean) context.getBean("singleton");
@ -157,7 +157,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests { @@ -157,7 +157,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
}
@Test
void testRequestScopeWithNoProxy() {
void requestScopeWithNoProxy() {
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
ApplicationContext context = createContext(ScopedProxyMode.NO);
ScopedTestBean bean = (ScopedTestBean) context.getBean("request");
@ -178,7 +178,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests { @@ -178,7 +178,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
}
@Test
void testRequestScopeWithProxiedInterfaces() {
void requestScopeWithProxiedInterfaces() {
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
ApplicationContext context = createContext(ScopedProxyMode.INTERFACES);
IScopedTestBean bean = (IScopedTestBean) context.getBean("request");
@ -200,7 +200,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests { @@ -200,7 +200,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
}
@Test
void testRequestScopeWithProxiedTargetClass() {
void requestScopeWithProxiedTargetClass() {
RequestContextHolder.setRequestAttributes(oldRequestAttributes);
ApplicationContext context = createContext(ScopedProxyMode.TARGET_CLASS);
IScopedTestBean bean = (IScopedTestBean) context.getBean("request");
@ -222,7 +222,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests { @@ -222,7 +222,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
}
@Test
void testSessionScopeWithNoProxy() {
void sessionScopeWithNoProxy() {
RequestContextHolder.setRequestAttributes(oldRequestAttributesWithSession);
ApplicationContext context = createContext(ScopedProxyMode.NO);
ScopedTestBean bean = (ScopedTestBean) context.getBean("session");
@ -243,7 +243,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests { @@ -243,7 +243,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
}
@Test
void testSessionScopeWithProxiedInterfaces() {
void sessionScopeWithProxiedInterfaces() {
RequestContextHolder.setRequestAttributes(oldRequestAttributesWithSession);
ApplicationContext context = createContext(ScopedProxyMode.INTERFACES);
IScopedTestBean bean = (IScopedTestBean) context.getBean("session");
@ -271,7 +271,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests { @@ -271,7 +271,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
}
@Test
void testSessionScopeWithProxiedTargetClass() {
void sessionScopeWithProxiedTargetClass() {
RequestContextHolder.setRequestAttributes(oldRequestAttributesWithSession);
ApplicationContext context = createContext(ScopedProxyMode.TARGET_CLASS);
IScopedTestBean bean = (IScopedTestBean) context.getBean("session");

80
spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java

@ -23,7 +23,6 @@ import java.util.Map; @@ -23,7 +23,6 @@ import java.util.Map;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import test.annotation.EmptySpringAnnotation;
import test.annotation.transaction.Tx;
@ -37,6 +36,7 @@ import org.springframework.beans.testfixture.beans.IOther; @@ -37,6 +36,7 @@ import org.springframework.beans.testfixture.beans.IOther;
import org.springframework.beans.testfixture.beans.ITestBean;
import org.springframework.beans.testfixture.beans.TestBean;
import org.springframework.beans.testfixture.beans.subpkg.DeepBean;
import org.springframework.util.ClassUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
@ -50,30 +50,22 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException; @@ -50,30 +50,22 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
*/
class AspectJExpressionPointcutTests {
private Method getAge;
private Method setAge;
private Method setSomeNumber;
private final Method getAge = ClassUtils.getMethod(TestBean.class, "getAge");
private final Method setAge = ClassUtils.getMethod(TestBean.class, "setAge", int.class);
private final Method setSomeNumber = ClassUtils.getMethod(TestBean.class, "setSomeNumber", Number.class);
private final Map<String, Method> methodsOnHasGeneric = new HashMap<>();
@BeforeEach
void setup() throws NoSuchMethodException {
getAge = TestBean.class.getMethod("getAge");
setAge = TestBean.class.getMethod("setAge", int.class);
setSomeNumber = TestBean.class.getMethod("setSomeNumber", Number.class);
AspectJExpressionPointcutTests() throws NoSuchMethodException {
// Assumes no overloading
for (Method method : HasGeneric.class.getMethods()) {
methodsOnHasGeneric.put(method.getName(), method);
this.methodsOnHasGeneric.put(method.getName(), method);
}
}
@Test
void testMatchExplicit() {
void matchExplicit() {
String expression = "execution(int org.springframework.beans.testfixture.beans.TestBean.getAge())";
Pointcut pointcut = getPointcut(expression);
@ -91,7 +83,7 @@ class AspectJExpressionPointcutTests { @@ -91,7 +83,7 @@ class AspectJExpressionPointcutTests {
}
@Test
void testMatchWithTypePattern() {
void matchWithTypePattern() {
String expression = "execution(* *..TestBean.*Age(..))";
Pointcut pointcut = getPointcut(expression);
@ -110,12 +102,12 @@ class AspectJExpressionPointcutTests { @@ -110,12 +102,12 @@ class AspectJExpressionPointcutTests {
@Test
void testThis() throws SecurityException, NoSuchMethodException{
void thisCase() throws SecurityException, NoSuchMethodException{
testThisOrTarget("this");
}
@Test
void testTarget() throws SecurityException, NoSuchMethodException {
void target() throws SecurityException, NoSuchMethodException {
testThisOrTarget("target");
}
@ -139,12 +131,12 @@ class AspectJExpressionPointcutTests { @@ -139,12 +131,12 @@ class AspectJExpressionPointcutTests {
}
@Test
void testWithinRootPackage() throws SecurityException, NoSuchMethodException {
void withinRootPackage() throws SecurityException, NoSuchMethodException {
testWithinPackage(false);
}
@Test
void testWithinRootAndSubpackages() throws SecurityException, NoSuchMethodException {
void withinRootAndSubpackages() throws SecurityException, NoSuchMethodException {
testWithinPackage(true);
}
@ -168,7 +160,7 @@ class AspectJExpressionPointcutTests { @@ -168,7 +160,7 @@ class AspectJExpressionPointcutTests {
}
@Test
void testFriendlyErrorOnNoLocationClassMatching() {
void friendlyErrorOnNoLocationClassMatching() {
AspectJExpressionPointcut pc = new AspectJExpressionPointcut();
assertThatIllegalStateException()
.isThrownBy(() -> pc.getClassFilter().matches(ITestBean.class))
@ -176,7 +168,7 @@ class AspectJExpressionPointcutTests { @@ -176,7 +168,7 @@ class AspectJExpressionPointcutTests {
}
@Test
void testFriendlyErrorOnNoLocation2ArgMatching() {
void friendlyErrorOnNoLocation2ArgMatching() {
AspectJExpressionPointcut pc = new AspectJExpressionPointcut();
assertThatIllegalStateException()
.isThrownBy(() -> pc.getMethodMatcher().matches(getAge, ITestBean.class))
@ -184,7 +176,7 @@ class AspectJExpressionPointcutTests { @@ -184,7 +176,7 @@ class AspectJExpressionPointcutTests {
}
@Test
void testFriendlyErrorOnNoLocation3ArgMatching() {
void friendlyErrorOnNoLocation3ArgMatching() {
AspectJExpressionPointcut pc = new AspectJExpressionPointcut();
assertThatIllegalStateException()
.isThrownBy(() -> pc.getMethodMatcher().matches(getAge, ITestBean.class, (Object[]) null))
@ -193,7 +185,7 @@ class AspectJExpressionPointcutTests { @@ -193,7 +185,7 @@ class AspectJExpressionPointcutTests {
@Test
void testMatchWithArgs() {
void matchWithArgs() {
String expression = "execution(void org.springframework.beans.testfixture.beans.TestBean.setSomeNumber(Number)) && args(Double)";
Pointcut pointcut = getPointcut(expression);
@ -214,7 +206,7 @@ class AspectJExpressionPointcutTests { @@ -214,7 +206,7 @@ class AspectJExpressionPointcutTests {
}
@Test
void testSimpleAdvice() {
void simpleAdvice() {
String expression = "execution(int org.springframework.beans.testfixture.beans.TestBean.getAge())";
CallCountingInterceptor interceptor = new CallCountingInterceptor();
TestBean testBean = getAdvisedProxy(expression, interceptor);
@ -227,7 +219,7 @@ class AspectJExpressionPointcutTests { @@ -227,7 +219,7 @@ class AspectJExpressionPointcutTests {
}
@Test
void testDynamicMatchingProxy() {
void dynamicMatchingProxy() {
String expression = "execution(void org.springframework.beans.testfixture.beans.TestBean.setSomeNumber(Number)) && args(Double)";
CallCountingInterceptor interceptor = new CallCountingInterceptor();
TestBean testBean = getAdvisedProxy(expression, interceptor);
@ -241,7 +233,7 @@ class AspectJExpressionPointcutTests { @@ -241,7 +233,7 @@ class AspectJExpressionPointcutTests {
}
@Test
void testInvalidExpression() {
void invalidExpression() {
String expression = "execution(void org.springframework.beans.testfixture.beans.TestBean.setSomeNumber(Number) && args(Double)";
assertThat(getPointcut(expression).getClassFilter().matches(Object.class)).isFalse();
}
@ -271,20 +263,20 @@ class AspectJExpressionPointcutTests { @@ -271,20 +263,20 @@ class AspectJExpressionPointcutTests {
}
@Test
void testWithUnsupportedPointcutPrimitive() {
void withUnsupportedPointcutPrimitive() {
String expression = "call(int org.springframework.beans.testfixture.beans.TestBean.getAge())";
assertThat(getPointcut(expression).getClassFilter().matches(Object.class)).isFalse();
}
@Test
void testAndSubstitution() {
void andSubstitution() {
AspectJExpressionPointcut pc = getPointcut("execution(* *(..)) and args(String)");
String expr = pc.getPointcutExpression().getPointcutExpression();
assertThat(expr).isEqualTo("execution(* *(..)) && args(String)");
}
@Test
void testMultipleAndSubstitutions() {
void multipleAndSubstitutions() {
AspectJExpressionPointcut pc = getPointcut("execution(* *(..)) and args(String) and this(Object)");
String expr = pc.getPointcutExpression().getPointcutExpression();
assertThat(expr).isEqualTo("execution(* *(..)) && args(String) && this(Object)");
@ -297,7 +289,7 @@ class AspectJExpressionPointcutTests { @@ -297,7 +289,7 @@ class AspectJExpressionPointcutTests {
}
@Test
void testMatchGenericArgument() {
void matchGenericArgument() {
String expression = "execution(* set*(java.util.List<org.springframework.beans.testfixture.beans.TestBean>) )";
AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
ajexp.setExpression(expression);
@ -316,7 +308,7 @@ class AspectJExpressionPointcutTests { @@ -316,7 +308,7 @@ class AspectJExpressionPointcutTests {
}
@Test
void testMatchVarargs() throws Exception {
void matchVarargs() throws Exception {
@SuppressWarnings("unused")
class MyTemplate {
@ -342,19 +334,19 @@ class AspectJExpressionPointcutTests { @@ -342,19 +334,19 @@ class AspectJExpressionPointcutTests {
}
@Test
void testMatchAnnotationOnClassWithAtWithin() throws Exception {
void matchAnnotationOnClassWithAtWithin() throws Exception {
String expression = "@within(test.annotation.transaction.Tx)";
testMatchAnnotationOnClass(expression);
}
@Test
void testMatchAnnotationOnClassWithoutBinding() throws Exception {
void matchAnnotationOnClassWithoutBinding() throws Exception {
String expression = "within(@test.annotation.transaction.Tx *)";
testMatchAnnotationOnClass(expression);
}
@Test
void testMatchAnnotationOnClassWithSubpackageWildcard() throws Exception {
void matchAnnotationOnClassWithSubpackageWildcard() throws Exception {
String expression = "within(@(test.annotation..*) *)";
AspectJExpressionPointcut springAnnotatedPc = testMatchAnnotationOnClass(expression);
assertThat(springAnnotatedPc.matches(TestBean.class.getMethod("setName", String.class), TestBean.class)).isFalse();
@ -366,7 +358,7 @@ class AspectJExpressionPointcutTests { @@ -366,7 +358,7 @@ class AspectJExpressionPointcutTests {
}
@Test
void testMatchAnnotationOnClassWithExactPackageWildcard() throws Exception {
void matchAnnotationOnClassWithExactPackageWildcard() throws Exception {
String expression = "within(@(test.annotation.transaction.*) *)";
testMatchAnnotationOnClass(expression);
}
@ -384,7 +376,7 @@ class AspectJExpressionPointcutTests { @@ -384,7 +376,7 @@ class AspectJExpressionPointcutTests {
}
@Test
void testAnnotationOnMethodWithFQN() throws Exception {
void annotationOnMethodWithFQN() throws Exception {
String expression = "@annotation(test.annotation.transaction.Tx)";
AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
ajexp.setExpression(expression);
@ -398,7 +390,7 @@ class AspectJExpressionPointcutTests { @@ -398,7 +390,7 @@ class AspectJExpressionPointcutTests {
}
@Test
void testAnnotationOnCglibProxyMethod() throws Exception {
void annotationOnCglibProxyMethod() throws Exception {
String expression = "@annotation(test.annotation.transaction.Tx)";
AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
ajexp.setExpression(expression);
@ -410,7 +402,7 @@ class AspectJExpressionPointcutTests { @@ -410,7 +402,7 @@ class AspectJExpressionPointcutTests {
}
@Test
void testNotAnnotationOnCglibProxyMethod() throws Exception {
void notAnnotationOnCglibProxyMethod() throws Exception {
String expression = "!@annotation(test.annotation.transaction.Tx)";
AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
ajexp.setExpression(expression);
@ -422,7 +414,7 @@ class AspectJExpressionPointcutTests { @@ -422,7 +414,7 @@ class AspectJExpressionPointcutTests {
}
@Test
void testAnnotationOnDynamicProxyMethod() throws Exception {
void annotationOnDynamicProxyMethod() throws Exception {
String expression = "@annotation(test.annotation.transaction.Tx)";
AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
ajexp.setExpression(expression);
@ -434,7 +426,7 @@ class AspectJExpressionPointcutTests { @@ -434,7 +426,7 @@ class AspectJExpressionPointcutTests {
}
@Test
void testNotAnnotationOnDynamicProxyMethod() throws Exception {
void notAnnotationOnDynamicProxyMethod() throws Exception {
String expression = "!@annotation(test.annotation.transaction.Tx)";
AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
ajexp.setExpression(expression);
@ -446,7 +438,7 @@ class AspectJExpressionPointcutTests { @@ -446,7 +438,7 @@ class AspectJExpressionPointcutTests {
}
@Test
void testAnnotationOnMethodWithWildcard() throws Exception {
void annotationOnMethodWithWildcard() throws Exception {
String expression = "execution(@(test.annotation..*) * *(..))";
AspectJExpressionPointcut anySpringMethodAnnotation = new AspectJExpressionPointcut();
anySpringMethodAnnotation.setExpression(expression);
@ -462,7 +454,7 @@ class AspectJExpressionPointcutTests { @@ -462,7 +454,7 @@ class AspectJExpressionPointcutTests {
}
@Test
void testAnnotationOnMethodArgumentsWithFQN() throws Exception {
void annotationOnMethodArgumentsWithFQN() throws Exception {
String expression = "@args(*, test.annotation.EmptySpringAnnotation))";
AspectJExpressionPointcut takesSpringAnnotatedArgument2 = new AspectJExpressionPointcut();
takesSpringAnnotatedArgument2.setExpression(expression);
@ -491,7 +483,7 @@ class AspectJExpressionPointcutTests { @@ -491,7 +483,7 @@ class AspectJExpressionPointcutTests {
}
@Test
void testAnnotationOnMethodArgumentsWithWildcards() throws Exception {
void annotationOnMethodArgumentsWithWildcards() throws Exception {
String expression = "execution(* *(*, @(test..*) *))";
AspectJExpressionPointcut takesSpringAnnotatedArgument2 = new AspectJExpressionPointcut();
takesSpringAnnotatedArgument2.setExpression(expression);

4
spring-aop/src/test/java/org/springframework/aop/aspectj/BeanNamePointcutMatchingTests.java

@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class BeanNamePointcutMatchingTests {
@Test
void testMatchingPointcuts() {
void matchingPointcuts() {
assertMatch("someName", "bean(someName)");
// Spring bean names are less restrictive compared to AspectJ names (methods, types etc.)
@ -66,7 +66,7 @@ class BeanNamePointcutMatchingTests { @@ -66,7 +66,7 @@ class BeanNamePointcutMatchingTests {
}
@Test
void testNonMatchingPointcuts() {
void nonMatchingPointcuts() {
assertMisMatch("someName", "bean(someNamex)");
assertMisMatch("someName", "bean(someX*Name)");

6
spring-aop/src/test/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPointTests.java

@ -59,7 +59,7 @@ class MethodInvocationProceedingJoinPointTests { @@ -59,7 +59,7 @@ class MethodInvocationProceedingJoinPointTests {
}
@Test
void testCanGetMethodSignatureFromJoinPoint() {
void canGetMethodSignatureFromJoinPoint() {
final Object raw = new TestBean();
// Will be set by advice during a method call
final int newAge = 23;
@ -118,7 +118,7 @@ class MethodInvocationProceedingJoinPointTests { @@ -118,7 +118,7 @@ class MethodInvocationProceedingJoinPointTests {
}
@Test
void testCanGetSourceLocationFromJoinPoint() {
void canGetSourceLocationFromJoinPoint() {
final Object raw = new TestBean();
ProxyFactory pf = new ProxyFactory(raw);
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
@ -135,7 +135,7 @@ class MethodInvocationProceedingJoinPointTests { @@ -135,7 +135,7 @@ class MethodInvocationProceedingJoinPointTests {
}
@Test
void testCanGetStaticPartFromJoinPoint() {
void canGetStaticPartFromJoinPoint() {
final Object raw = new TestBean();
ProxyFactory pf = new ProxyFactory(raw);
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);

10
spring-aop/src/test/java/org/springframework/aop/aspectj/TrickyAspectJPointcutExpressionTests.java

@ -43,14 +43,14 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -43,14 +43,14 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
class TrickyAspectJPointcutExpressionTests {
@Test
void testManualProxyJavaWithUnconditionalPointcut() {
void manualProxyJavaWithUnconditionalPointcut() {
TestService target = new TestServiceImpl();
LogUserAdvice logAdvice = new LogUserAdvice();
testAdvice(new DefaultPointcutAdvisor(logAdvice), logAdvice, target, "TestServiceImpl");
}
@Test
void testManualProxyJavaWithStaticPointcut() {
void manualProxyJavaWithStaticPointcut() {
TestService target = new TestServiceImpl();
LogUserAdvice logAdvice = new LogUserAdvice();
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
@ -59,7 +59,7 @@ class TrickyAspectJPointcutExpressionTests { @@ -59,7 +59,7 @@ class TrickyAspectJPointcutExpressionTests {
}
@Test
void testManualProxyJavaWithDynamicPointcut() {
void manualProxyJavaWithDynamicPointcut() {
TestService target = new TestServiceImpl();
LogUserAdvice logAdvice = new LogUserAdvice();
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
@ -68,7 +68,7 @@ class TrickyAspectJPointcutExpressionTests { @@ -68,7 +68,7 @@ class TrickyAspectJPointcutExpressionTests {
}
@Test
void testManualProxyJavaWithDynamicPointcutAndProxyTargetClass() {
void manualProxyJavaWithDynamicPointcutAndProxyTargetClass() {
TestService target = new TestServiceImpl();
LogUserAdvice logAdvice = new LogUserAdvice();
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
@ -77,7 +77,7 @@ class TrickyAspectJPointcutExpressionTests { @@ -77,7 +77,7 @@ class TrickyAspectJPointcutExpressionTests {
}
@Test
void testManualProxyJavaWithStaticPointcutAndTwoClassLoaders() throws Exception {
void manualProxyJavaWithStaticPointcutAndTwoClassLoaders() throws Exception {
LogUserAdvice logAdvice = new LogUserAdvice();
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();

6
spring-aop/src/test/java/org/springframework/aop/aspectj/TypePatternClassFilterTests.java

@ -97,7 +97,7 @@ class TypePatternClassFilterTests { @@ -97,7 +97,7 @@ class TypePatternClassFilterTests {
}
@Test
void testEquals() {
void equals() {
TypePatternClassFilter filter1 = new TypePatternClassFilter("org.springframework.beans.testfixture.beans.*");
TypePatternClassFilter filter2 = new TypePatternClassFilter("org.springframework.beans.testfixture.beans.*");
TypePatternClassFilter filter3 = new TypePatternClassFilter("org.springframework.tests.*");
@ -107,7 +107,7 @@ class TypePatternClassFilterTests { @@ -107,7 +107,7 @@ class TypePatternClassFilterTests {
}
@Test
void testHashCode() {
void hashCodeBehavior() {
TypePatternClassFilter filter1 = new TypePatternClassFilter("org.springframework.beans.testfixture.beans.*");
TypePatternClassFilter filter2 = new TypePatternClassFilter("org.springframework.beans.testfixture.beans.*");
TypePatternClassFilter filter3 = new TypePatternClassFilter("org.springframework.tests.*");
@ -117,7 +117,7 @@ class TypePatternClassFilterTests { @@ -117,7 +117,7 @@ class TypePatternClassFilterTests {
}
@Test
void testToString() {
void toStringOutput() {
TypePatternClassFilter filter1 = new TypePatternClassFilter("org.springframework.beans.testfixture.beans.*");
TypePatternClassFilter filter2 = new TypePatternClassFilter("org.springframework.beans.testfixture.beans.*");

8
spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectJPointcutAdvisorTests.java

@ -39,7 +39,7 @@ class AspectJPointcutAdvisorTests { @@ -39,7 +39,7 @@ class AspectJPointcutAdvisorTests {
@Test
void testSingleton() throws SecurityException, NoSuchMethodException {
void singleton() throws SecurityException, NoSuchMethodException {
AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
ajexp.setExpression(CommonExpressions.MATCH_ALL_METHODS);
@ -53,7 +53,7 @@ class AspectJPointcutAdvisorTests { @@ -53,7 +53,7 @@ class AspectJPointcutAdvisorTests {
}
@Test
void testPerTarget() throws SecurityException, NoSuchMethodException {
void perTarget() throws SecurityException, NoSuchMethodException {
AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
ajexp.setExpression(CommonExpressions.MATCH_ALL_METHODS);
@ -76,13 +76,13 @@ class AspectJPointcutAdvisorTests { @@ -76,13 +76,13 @@ class AspectJPointcutAdvisorTests {
}
@Test
void testPerCflowTarget() {
void perCflowTarget() {
assertThatExceptionOfType(AopConfigException.class).isThrownBy(() ->
testIllegalInstantiationModel(AbstractAspectJAdvisorFactoryTests.PerCflowAspect.class));
}
@Test
void testPerCflowBelowTarget() {
void perCflowBelowTarget() {
assertThatExceptionOfType(AopConfigException.class).isThrownBy(() ->
testIllegalInstantiationModel(AbstractAspectJAdvisorFactoryTests.PerCflowBelowAspect.class));
}

18
spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java

@ -39,13 +39,13 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException @@ -39,13 +39,13 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class AspectProxyFactoryTests {
@Test
void testWithNonAspect() {
void withNonAspect() {
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(new TestBean());
assertThatIllegalArgumentException().isThrownBy(() -> proxyFactory.addAspect(TestBean.class));
}
@Test
void testWithSimpleAspect() {
void withSimpleAspect() {
TestBean bean = new TestBean();
bean.setAge(2);
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(bean);
@ -55,7 +55,7 @@ class AspectProxyFactoryTests { @@ -55,7 +55,7 @@ class AspectProxyFactoryTests {
}
@Test
void testWithPerThisAspect() {
void withPerThisAspect() {
TestBean bean1 = new TestBean();
TestBean bean2 = new TestBean();
@ -75,14 +75,14 @@ class AspectProxyFactoryTests { @@ -75,14 +75,14 @@ class AspectProxyFactoryTests {
}
@Test
void testWithInstanceWithNonAspect() {
void withInstanceWithNonAspect() {
AspectJProxyFactory pf = new AspectJProxyFactory();
assertThatIllegalArgumentException().isThrownBy(() -> pf.addAspect(new TestBean()));
}
@Test
@SuppressWarnings("unchecked")
void testSerializable() throws Exception {
void serializable() throws Exception {
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(new TestBean());
proxyFactory.addAspect(LoggingAspectOnVarargs.class);
ITestBean proxy = proxyFactory.getProxy();
@ -92,7 +92,7 @@ class AspectProxyFactoryTests { @@ -92,7 +92,7 @@ class AspectProxyFactoryTests {
}
@Test
void testWithInstance() throws Exception {
void withInstance() throws Exception {
MultiplyReturnValue aspect = new MultiplyReturnValue();
int multiple = 3;
aspect.setMultiple(multiple);
@ -111,14 +111,14 @@ class AspectProxyFactoryTests { @@ -111,14 +111,14 @@ class AspectProxyFactoryTests {
}
@Test
void testWithNonSingletonAspectInstance() {
void withNonSingletonAspectInstance() {
AspectJProxyFactory pf = new AspectJProxyFactory();
assertThatIllegalArgumentException().isThrownBy(() -> pf.addAspect(new PerThisAspect()));
}
@Test // SPR-13328
@SuppressWarnings("unchecked")
public void testProxiedVarargsWithEnumArray() {
void proxiedVarargsWithEnumArray() {
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(new TestBean());
proxyFactory.addAspect(LoggingAspectOnVarargs.class);
ITestBean proxy = proxyFactory.getProxy();
@ -127,7 +127,7 @@ class AspectProxyFactoryTests { @@ -127,7 +127,7 @@ class AspectProxyFactoryTests {
@Test // SPR-13328
@SuppressWarnings("unchecked")
public void testUnproxiedVarargsWithEnumArray() {
void unproxiedVarargsWithEnumArray() {
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(new TestBean());
proxyFactory.addAspect(LoggingAspectOnSetter.class);
ITestBean proxy = proxyFactory.getProxy();

8
spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJNamespaceHandlerTests.java

@ -56,7 +56,7 @@ class AspectJNamespaceHandlerTests { @@ -56,7 +56,7 @@ class AspectJNamespaceHandlerTests {
}
@Test
void testRegisterAutoProxyCreator() {
void registerAutoProxyCreator() {
AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(this.parserContext, null);
assertThat(registry.getBeanDefinitionCount()).as("Incorrect number of definitions registered").isEqualTo(1);
@ -65,7 +65,7 @@ class AspectJNamespaceHandlerTests { @@ -65,7 +65,7 @@ class AspectJNamespaceHandlerTests {
}
@Test
void testRegisterAspectJAutoProxyCreator() {
void registerAspectJAutoProxyCreator() {
AopNamespaceUtils.registerAspectJAutoProxyCreatorIfNecessary(this.parserContext, null);
assertThat(registry.getBeanDefinitionCount()).as("Incorrect number of definitions registered").isEqualTo(1);
@ -77,7 +77,7 @@ class AspectJNamespaceHandlerTests { @@ -77,7 +77,7 @@ class AspectJNamespaceHandlerTests {
}
@Test
void testRegisterAspectJAutoProxyCreatorWithExistingAutoProxyCreator() {
void registerAspectJAutoProxyCreatorWithExistingAutoProxyCreator() {
AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(this.parserContext, null);
assertThat(registry.getBeanDefinitionCount()).isEqualTo(1);
@ -89,7 +89,7 @@ class AspectJNamespaceHandlerTests { @@ -89,7 +89,7 @@ class AspectJNamespaceHandlerTests {
}
@Test
void testRegisterAutoProxyCreatorWhenAspectJAutoProxyCreatorAlreadyExists() {
void registerAutoProxyCreatorWhenAspectJAutoProxyCreatorAlreadyExists() {
AopNamespaceUtils.registerAspectJAutoProxyCreatorIfNecessary(this.parserContext, null);
assertThat(registry.getBeanDefinitionCount()).isEqualTo(1);

18
spring-aop/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJPrecedenceComparatorTests.java

@ -65,7 +65,7 @@ class AspectJPrecedenceComparatorTests { @@ -65,7 +65,7 @@ class AspectJPrecedenceComparatorTests {
@Test
void testSameAspectNoAfterAdvice() {
void sameAspectNoAfterAdvice() {
Advisor advisor1 = createAspectJBeforeAdvice(HIGH_PRECEDENCE_ADVISOR_ORDER, EARLY_ADVICE_DECLARATION_ORDER, "someAspect");
Advisor advisor2 = createAspectJBeforeAdvice(HIGH_PRECEDENCE_ADVISOR_ORDER, LATE_ADVICE_DECLARATION_ORDER, "someAspect");
assertThat(this.comparator.compare(advisor1, advisor2)).as("advisor1 sorted before advisor2").isEqualTo(-1);
@ -76,7 +76,7 @@ class AspectJPrecedenceComparatorTests { @@ -76,7 +76,7 @@ class AspectJPrecedenceComparatorTests {
}
@Test
void testSameAspectAfterAdvice() {
void sameAspectAfterAdvice() {
Advisor advisor1 = createAspectJAfterAdvice(HIGH_PRECEDENCE_ADVISOR_ORDER, EARLY_ADVICE_DECLARATION_ORDER, "someAspect");
Advisor advisor2 = createAspectJAroundAdvice(HIGH_PRECEDENCE_ADVISOR_ORDER, LATE_ADVICE_DECLARATION_ORDER, "someAspect");
assertThat(this.comparator.compare(advisor1, advisor2)).as("advisor2 sorted before advisor1").isEqualTo(1);
@ -87,14 +87,14 @@ class AspectJPrecedenceComparatorTests { @@ -87,14 +87,14 @@ class AspectJPrecedenceComparatorTests {
}
@Test
void testSameAspectOneOfEach() {
void sameAspectOneOfEach() {
Advisor advisor1 = createAspectJAfterAdvice(HIGH_PRECEDENCE_ADVISOR_ORDER, EARLY_ADVICE_DECLARATION_ORDER, "someAspect");
Advisor advisor2 = createAspectJBeforeAdvice(HIGH_PRECEDENCE_ADVISOR_ORDER, LATE_ADVICE_DECLARATION_ORDER, "someAspect");
assertThat(this.comparator.compare(advisor1, advisor2)).as("advisor1 and advisor2 not comparable").isEqualTo(1);
}
@Test
void testSameAdvisorPrecedenceDifferentAspectNoAfterAdvice() {
void sameAdvisorPrecedenceDifferentAspectNoAfterAdvice() {
Advisor advisor1 = createAspectJBeforeAdvice(HIGH_PRECEDENCE_ADVISOR_ORDER, EARLY_ADVICE_DECLARATION_ORDER, "someAspect");
Advisor advisor2 = createAspectJBeforeAdvice(HIGH_PRECEDENCE_ADVISOR_ORDER, LATE_ADVICE_DECLARATION_ORDER, "someOtherAspect");
assertThat(this.comparator.compare(advisor1, advisor2)).as("nothing to say about order here").isEqualTo(0);
@ -105,7 +105,7 @@ class AspectJPrecedenceComparatorTests { @@ -105,7 +105,7 @@ class AspectJPrecedenceComparatorTests {
}
@Test
void testSameAdvisorPrecedenceDifferentAspectAfterAdvice() {
void sameAdvisorPrecedenceDifferentAspectAfterAdvice() {
Advisor advisor1 = createAspectJAfterAdvice(HIGH_PRECEDENCE_ADVISOR_ORDER, EARLY_ADVICE_DECLARATION_ORDER, "someAspect");
Advisor advisor2 = createAspectJAroundAdvice(HIGH_PRECEDENCE_ADVISOR_ORDER, LATE_ADVICE_DECLARATION_ORDER, "someOtherAspect");
assertThat(this.comparator.compare(advisor1, advisor2)).as("nothing to say about order here").isEqualTo(0);
@ -116,7 +116,7 @@ class AspectJPrecedenceComparatorTests { @@ -116,7 +116,7 @@ class AspectJPrecedenceComparatorTests {
}
@Test
void testHigherAdvisorPrecedenceNoAfterAdvice() {
void higherAdvisorPrecedenceNoAfterAdvice() {
Advisor advisor1 = createSpringAOPBeforeAdvice(HIGH_PRECEDENCE_ADVISOR_ORDER);
Advisor advisor2 = createAspectJBeforeAdvice(LOW_PRECEDENCE_ADVISOR_ORDER, EARLY_ADVICE_DECLARATION_ORDER, "someOtherAspect");
assertThat(this.comparator.compare(advisor1, advisor2)).as("advisor1 sorted before advisor2").isEqualTo(-1);
@ -127,7 +127,7 @@ class AspectJPrecedenceComparatorTests { @@ -127,7 +127,7 @@ class AspectJPrecedenceComparatorTests {
}
@Test
void testHigherAdvisorPrecedenceAfterAdvice() {
void higherAdvisorPrecedenceAfterAdvice() {
Advisor advisor1 = createAspectJAfterAdvice(HIGH_PRECEDENCE_ADVISOR_ORDER, EARLY_ADVICE_DECLARATION_ORDER, "someAspect");
Advisor advisor2 = createAspectJAroundAdvice(LOW_PRECEDENCE_ADVISOR_ORDER, LATE_ADVICE_DECLARATION_ORDER, "someOtherAspect");
assertThat(this.comparator.compare(advisor1, advisor2)).as("advisor1 sorted before advisor2").isEqualTo(-1);
@ -138,7 +138,7 @@ class AspectJPrecedenceComparatorTests { @@ -138,7 +138,7 @@ class AspectJPrecedenceComparatorTests {
}
@Test
void testLowerAdvisorPrecedenceNoAfterAdvice() {
void lowerAdvisorPrecedenceNoAfterAdvice() {
Advisor advisor1 = createAspectJBeforeAdvice(LOW_PRECEDENCE_ADVISOR_ORDER, EARLY_ADVICE_DECLARATION_ORDER, "someAspect");
Advisor advisor2 = createAspectJBeforeAdvice(HIGH_PRECEDENCE_ADVISOR_ORDER, EARLY_ADVICE_DECLARATION_ORDER, "someOtherAspect");
assertThat(this.comparator.compare(advisor1, advisor2)).as("advisor1 sorted after advisor2").isEqualTo(1);
@ -149,7 +149,7 @@ class AspectJPrecedenceComparatorTests { @@ -149,7 +149,7 @@ class AspectJPrecedenceComparatorTests {
}
@Test
void testLowerAdvisorPrecedenceAfterAdvice() {
void lowerAdvisorPrecedenceAfterAdvice() {
Advisor advisor1 = createAspectJAfterAdvice(LOW_PRECEDENCE_ADVISOR_ORDER, EARLY_ADVICE_DECLARATION_ORDER, "someAspect");
Advisor advisor2 = createAspectJAroundAdvice(HIGH_PRECEDENCE_ADVISOR_ORDER, LATE_ADVICE_DECLARATION_ORDER, "someOtherAspect");
assertThat(this.comparator.compare(advisor1, advisor2)).as("advisor1 sorted after advisor2").isEqualTo(1);

4
spring-aop/src/test/java/org/springframework/aop/framework/MethodInvocationTests.java

@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class MethodInvocationTests {
@Test
void testValidInvocation() throws Throwable {
void validInvocation() throws Throwable {
Method method = Object.class.getMethod("hashCode");
Object proxy = new Object();
Object returnValue = new Object();
@ -49,7 +49,7 @@ class MethodInvocationTests { @@ -49,7 +49,7 @@ class MethodInvocationTests {
* toString on target can cause failure.
*/
@Test
void testToStringDoesntHitTarget() throws Throwable {
void toStringDoesntHitTarget() throws Throwable {
Object target = new TestBean() {
@Override
public String toString() {

4
spring-aop/src/test/java/org/springframework/aop/framework/NullPrimitiveTests.java

@ -36,7 +36,7 @@ class NullPrimitiveTests { @@ -36,7 +36,7 @@ class NullPrimitiveTests {
}
@Test
void testNullPrimitiveWithJdkProxy() {
void nullPrimitiveWithJdkProxy() {
class SimpleFoo implements Foo {
@Override
@ -62,7 +62,7 @@ class NullPrimitiveTests { @@ -62,7 +62,7 @@ class NullPrimitiveTests {
}
@Test
void testNullPrimitiveWithCglibProxy() {
void nullPrimitiveWithCglibProxy() {
Bar target = new Bar();
ProxyFactory factory = new ProxyFactory(target);

4
spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java

@ -38,7 +38,7 @@ class PrototypeTargetTests { @@ -38,7 +38,7 @@ class PrototypeTargetTests {
@Test
void testPrototypeProxyWithPrototypeTarget() {
void prototypeProxyWithPrototypeTarget() {
TestBeanImpl.constructionCount = 0;
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(CONTEXT);
@ -52,7 +52,7 @@ class PrototypeTargetTests { @@ -52,7 +52,7 @@ class PrototypeTargetTests {
}
@Test
void testSingletonProxyWithPrototypeTarget() {
void singletonProxyWithPrototypeTarget() {
TestBeanImpl.constructionCount = 0;
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(CONTEXT);

12
spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java

@ -40,14 +40,14 @@ import static org.mockito.Mockito.mock; @@ -40,14 +40,14 @@ import static org.mockito.Mockito.mock;
class ThrowsAdviceInterceptorTests {
@Test
void testNoHandlerMethods() {
void noHandlerMethods() {
// should require one handler method at least
assertThatExceptionOfType(AopConfigException.class).isThrownBy(() ->
new ThrowsAdviceInterceptor(new Object()));
}
@Test
void testNotInvoked() throws Throwable {
void notInvoked() throws Throwable {
MyThrowsHandler th = new MyThrowsHandler();
ThrowsAdviceInterceptor ti = new ThrowsAdviceInterceptor(th);
Object ret = new Object();
@ -58,7 +58,7 @@ class ThrowsAdviceInterceptorTests { @@ -58,7 +58,7 @@ class ThrowsAdviceInterceptorTests {
}
@Test
void testNoHandlerMethodForThrowable() throws Throwable {
void noHandlerMethodForThrowable() throws Throwable {
MyThrowsHandler th = new MyThrowsHandler();
ThrowsAdviceInterceptor ti = new ThrowsAdviceInterceptor(th);
assertThat(ti.getHandlerMethodCount()).isEqualTo(2);
@ -70,7 +70,7 @@ class ThrowsAdviceInterceptorTests { @@ -70,7 +70,7 @@ class ThrowsAdviceInterceptorTests {
}
@Test
void testCorrectHandlerUsed() throws Throwable {
void correctHandlerUsed() throws Throwable {
MyThrowsHandler th = new MyThrowsHandler();
ThrowsAdviceInterceptor ti = new ThrowsAdviceInterceptor(th);
FileNotFoundException ex = new FileNotFoundException();
@ -84,7 +84,7 @@ class ThrowsAdviceInterceptorTests { @@ -84,7 +84,7 @@ class ThrowsAdviceInterceptorTests {
}
@Test
void testCorrectHandlerUsedForSubclass() throws Throwable {
void correctHandlerUsedForSubclass() throws Throwable {
MyThrowsHandler th = new MyThrowsHandler();
ThrowsAdviceInterceptor ti = new ThrowsAdviceInterceptor(th);
// Extends RemoteException
@ -97,7 +97,7 @@ class ThrowsAdviceInterceptorTests { @@ -97,7 +97,7 @@ class ThrowsAdviceInterceptorTests {
}
@Test
void testHandlerMethodThrowsException() throws Throwable {
void handlerMethodThrowsException() throws Throwable {
final Throwable t = new Throwable();
MyThrowsHandler th = new MyThrowsHandler() {

4
spring-aop/src/test/java/org/springframework/aop/interceptor/DebugInterceptorTests.java

@ -38,7 +38,7 @@ import static org.mockito.Mockito.verify; @@ -38,7 +38,7 @@ import static org.mockito.Mockito.verify;
class DebugInterceptorTests {
@Test
void testSunnyDayPathLogsCorrectly() throws Throwable {
void sunnyDayPathLogsCorrectly() throws Throwable {
MethodInvocation methodInvocation = mock();
Log log = mock();
@ -52,7 +52,7 @@ class DebugInterceptorTests { @@ -52,7 +52,7 @@ class DebugInterceptorTests {
}
@Test
void testExceptionPathStillLogsCorrectly() throws Throwable {
void exceptionPathStillLogsCorrectly() throws Throwable {
MethodInvocation methodInvocation = mock();
IllegalArgumentException exception = new IllegalArgumentException();

4
spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeBeanNameAdvisorsTests.java

@ -46,7 +46,7 @@ class ExposeBeanNameAdvisorsTests { @@ -46,7 +46,7 @@ class ExposeBeanNameAdvisorsTests {
}
@Test
void testNoIntroduction() {
void noIntroduction() {
String beanName = "foo";
TestBean target = new RequiresBeanNameBoundTestBean(beanName);
ProxyFactory pf = new ProxyFactory(target);
@ -61,7 +61,7 @@ class ExposeBeanNameAdvisorsTests { @@ -61,7 +61,7 @@ class ExposeBeanNameAdvisorsTests {
}
@Test
void testWithIntroduction() {
void withIntroduction() {
String beanName = "foo";
TestBean target = new RequiresBeanNameBoundTestBean(beanName);
ProxyFactory pf = new ProxyFactory(target);

2
spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java

@ -34,7 +34,7 @@ import static org.springframework.core.testfixture.io.ResourceTestUtils.qualifie @@ -34,7 +34,7 @@ import static org.springframework.core.testfixture.io.ResourceTestUtils.qualifie
class ExposeInvocationInterceptorTests {
@Test
void testXmlConfig() {
void xmlConfig() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
qualifiedResource(ExposeInvocationInterceptorTests.class, "context.xml"));

6
spring-aop/src/test/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptorTests.java

@ -35,7 +35,7 @@ import static org.mockito.Mockito.verify; @@ -35,7 +35,7 @@ import static org.mockito.Mockito.verify;
class PerformanceMonitorInterceptorTests {
@Test
void testSuffixAndPrefixAssignment() {
void suffixAndPrefixAssignment() {
PerformanceMonitorInterceptor interceptor = new PerformanceMonitorInterceptor();
assertThat(interceptor.getPrefix()).isNotNull();
@ -49,7 +49,7 @@ class PerformanceMonitorInterceptorTests { @@ -49,7 +49,7 @@ class PerformanceMonitorInterceptorTests {
}
@Test
void testSunnyDayPathLogsPerformanceMetricsCorrectly() throws Throwable {
void sunnyDayPathLogsPerformanceMetricsCorrectly() throws Throwable {
MethodInvocation mi = mock();
given(mi.getMethod()).willReturn(String.class.getMethod("toString"));
@ -62,7 +62,7 @@ class PerformanceMonitorInterceptorTests { @@ -62,7 +62,7 @@ class PerformanceMonitorInterceptorTests {
}
@Test
void testExceptionPathStillLogsPerformanceMetricsCorrectly() throws Throwable {
void exceptionPathStillLogsPerformanceMetricsCorrectly() throws Throwable {
MethodInvocation mi = mock();
given(mi.getMethod()).willReturn(String.class.getMethod("toString"));

4
spring-aop/src/test/java/org/springframework/aop/interceptor/SimpleTraceInterceptorTests.java

@ -37,7 +37,7 @@ import static org.mockito.Mockito.verify; @@ -37,7 +37,7 @@ import static org.mockito.Mockito.verify;
class SimpleTraceInterceptorTests {
@Test
void testSunnyDayPathLogsCorrectly() throws Throwable {
void sunnyDayPathLogsCorrectly() throws Throwable {
MethodInvocation mi = mock();
given(mi.getMethod()).willReturn(String.class.getMethod("toString"));
given(mi.getThis()).willReturn(this);
@ -51,7 +51,7 @@ class SimpleTraceInterceptorTests { @@ -51,7 +51,7 @@ class SimpleTraceInterceptorTests {
}
@Test
void testExceptionPathStillLogsCorrectly() throws Throwable {
void exceptionPathStillLogsCorrectly() throws Throwable {
MethodInvocation mi = mock();
given(mi.getMethod()).willReturn(String.class.getMethod("toString"));
given(mi.getThis()).willReturn(this);

8
spring-aop/src/test/java/org/springframework/aop/scope/DefaultScopedObjectTests.java

@ -35,25 +35,25 @@ class DefaultScopedObjectTests { @@ -35,25 +35,25 @@ class DefaultScopedObjectTests {
@Test
void testCtorWithNullBeanFactory() {
void ctorWithNullBeanFactory() {
assertThatIllegalArgumentException().isThrownBy(() ->
new DefaultScopedObject(null, GOOD_BEAN_NAME));
}
@Test
void testCtorWithNullTargetBeanName() {
void ctorWithNullTargetBeanName() {
assertThatIllegalArgumentException().isThrownBy(() ->
testBadTargetBeanName(null));
}
@Test
void testCtorWithEmptyTargetBeanName() {
void ctorWithEmptyTargetBeanName() {
assertThatIllegalArgumentException().isThrownBy(() ->
testBadTargetBeanName(""));
}
@Test
void testCtorWithJustWhitespacedTargetBeanName() {
void ctorWithJustWhitespacedTargetBeanName() {
assertThatIllegalArgumentException().isThrownBy(() ->
testBadTargetBeanName(" "));
}

4
spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java

@ -34,7 +34,7 @@ import static org.springframework.core.testfixture.io.ResourceTestUtils.qualifie @@ -34,7 +34,7 @@ import static org.springframework.core.testfixture.io.ResourceTestUtils.qualifie
class ScopedProxyAutowireTests {
@Test
void testScopedProxyInheritsAutowireCandidateFalse() {
void scopedProxyInheritsAutowireCandidateFalse() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
qualifiedResource(ScopedProxyAutowireTests.class, "scopedAutowireFalse.xml"));
@ -48,7 +48,7 @@ class ScopedProxyAutowireTests { @@ -48,7 +48,7 @@ class ScopedProxyAutowireTests {
}
@Test
void testScopedProxyReplacesAutowireCandidateTrue() {
void scopedProxyReplacesAutowireCandidateTrue() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
qualifiedResource(ScopedProxyAutowireTests.class, "scopedAutowireTrue.xml"));

10
spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java

@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class AopUtilsTests {
@Test
void testPointcutCanNeverApply() {
void pointcutCanNeverApply() {
class TestPointcut extends StaticMethodMatcherPointcut {
@Override
public boolean matches(Method method, @Nullable Class<?> clazzy) {
@ -58,13 +58,13 @@ class AopUtilsTests { @@ -58,13 +58,13 @@ class AopUtilsTests {
}
@Test
void testPointcutAlwaysApplies() {
void pointcutAlwaysApplies() {
assertThat(AopUtils.canApply(new DefaultPointcutAdvisor(new NopInterceptor()), Object.class)).isTrue();
assertThat(AopUtils.canApply(new DefaultPointcutAdvisor(new NopInterceptor()), TestBean.class)).isTrue();
}
@Test
void testPointcutAppliesToOneMethodOnObject() {
void pointcutAppliesToOneMethodOnObject() {
class TestPointcut extends StaticMethodMatcherPointcut {
@Override
public boolean matches(Method method, @Nullable Class<?> clazz) {
@ -84,7 +84,7 @@ class AopUtilsTests { @@ -84,7 +84,7 @@ class AopUtilsTests {
* that's subverted the singleton construction limitation.
*/
@Test
void testCanonicalFrameworkClassesStillCanonicalOnDeserialization() throws Exception {
void canonicalFrameworkClassesStillCanonicalOnDeserialization() throws Exception {
assertThat(SerializationTestUtils.serializeAndDeserialize(MethodMatcher.TRUE)).isSameAs(MethodMatcher.TRUE);
assertThat(SerializationTestUtils.serializeAndDeserialize(ClassFilter.TRUE)).isSameAs(ClassFilter.TRUE);
assertThat(SerializationTestUtils.serializeAndDeserialize(Pointcut.TRUE)).isSameAs(Pointcut.TRUE);
@ -95,7 +95,7 @@ class AopUtilsTests { @@ -95,7 +95,7 @@ class AopUtilsTests {
}
@Test
void testInvokeJoinpointUsingReflection() throws Throwable {
void invokeJoinpointUsingReflection() throws Throwable {
String name = "foo";
TestBean testBean = new TestBean(name);
Method method = ReflectionUtils.findMethod(TestBean.class, "getName");

10
spring-aop/src/test/java/org/springframework/aop/support/ComposablePointcutTests.java

@ -58,14 +58,14 @@ class ComposablePointcutTests { @@ -58,14 +58,14 @@ class ComposablePointcutTests {
@Test
void testMatchAll() throws NoSuchMethodException {
void matchAll() throws NoSuchMethodException {
Pointcut pc = new ComposablePointcut();
assertThat(pc.getClassFilter().matches(Object.class)).isTrue();
assertThat(pc.getMethodMatcher().matches(Object.class.getMethod("hashCode"), Exception.class)).isTrue();
}
@Test
void testFilterByClass() {
void filterByClass() {
ComposablePointcut pc = new ComposablePointcut();
assertThat(pc.getClassFilter().matches(Object.class)).isTrue();
@ -85,7 +85,7 @@ class ComposablePointcutTests { @@ -85,7 +85,7 @@ class ComposablePointcutTests {
}
@Test
void testUnionMethodMatcher() {
void unionMethodMatcher() {
// Matches the getAge() method in any class
ComposablePointcut pc = new ComposablePointcut(ClassFilter.TRUE, GET_AGE_METHOD_MATCHER);
assertThat(Pointcuts.matches(pc, PointcutsTests.TEST_BEAN_ABSQUATULATE, TestBean.class)).isFalse();
@ -108,7 +108,7 @@ class ComposablePointcutTests { @@ -108,7 +108,7 @@ class ComposablePointcutTests {
}
@Test
void testIntersectionMethodMatcher() {
void intersectionMethodMatcher() {
ComposablePointcut pc = new ComposablePointcut();
assertThat(pc.getMethodMatcher().matches(PointcutsTests.TEST_BEAN_ABSQUATULATE, TestBean.class)).isTrue();
assertThat(pc.getMethodMatcher().matches(PointcutsTests.TEST_BEAN_GET_AGE, TestBean.class)).isTrue();
@ -125,7 +125,7 @@ class ComposablePointcutTests { @@ -125,7 +125,7 @@ class ComposablePointcutTests {
}
@Test
void testEqualsAndHashCode() {
void equalsAndHashCode() {
ComposablePointcut pc1 = new ComposablePointcut();
ComposablePointcut pc2 = new ComposablePointcut();

2
spring-aop/src/test/java/org/springframework/aop/support/ControlFlowPointcutTests.java

@ -152,7 +152,7 @@ class ControlFlowPointcutTests { @@ -152,7 +152,7 @@ class ControlFlowPointcutTests {
}
@Test
void testToString() {
void toStringOutput() {
String pointcutType = ControlFlowPointcut.class.getName();
String componentType = MyComponent.class.getName();

20
spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java

@ -47,14 +47,14 @@ import static org.mockito.Mockito.mock; @@ -47,14 +47,14 @@ import static org.mockito.Mockito.mock;
class DelegatingIntroductionInterceptorTests {
@Test
void testNullTarget() {
void nullTarget() {
// Shouldn't accept null target
assertThatIllegalArgumentException().isThrownBy(() ->
new DelegatingIntroductionInterceptor(null));
}
@Test
void testIntroductionInterceptorWithDelegation() {
void introductionInterceptorWithDelegation() {
TestBean raw = new TestBean();
assertThat(raw).isNotInstanceOf(TimeStamped.class);
ProxyFactory factory = new ProxyFactory(raw);
@ -70,7 +70,7 @@ class DelegatingIntroductionInterceptorTests { @@ -70,7 +70,7 @@ class DelegatingIntroductionInterceptorTests {
}
@Test
void testIntroductionInterceptorWithInterfaceHierarchy() {
void introductionInterceptorWithInterfaceHierarchy() {
TestBean raw = new TestBean();
assertThat(raw).isNotInstanceOf(SubTimeStamped.class);
ProxyFactory factory = new ProxyFactory(raw);
@ -86,7 +86,7 @@ class DelegatingIntroductionInterceptorTests { @@ -86,7 +86,7 @@ class DelegatingIntroductionInterceptorTests {
}
@Test
void testIntroductionInterceptorWithSuperInterface() {
void introductionInterceptorWithSuperInterface() {
TestBean raw = new TestBean();
assertThat(raw).isNotInstanceOf(TimeStamped.class);
ProxyFactory factory = new ProxyFactory(raw);
@ -103,7 +103,7 @@ class DelegatingIntroductionInterceptorTests { @@ -103,7 +103,7 @@ class DelegatingIntroductionInterceptorTests {
}
@Test
void testAutomaticInterfaceRecognitionInDelegate() throws Exception {
void automaticInterfaceRecognitionInDelegate() throws Exception {
final long t = 1001L;
class Tester implements TimeStamped, ITester {
@Override
@ -133,7 +133,7 @@ class DelegatingIntroductionInterceptorTests { @@ -133,7 +133,7 @@ class DelegatingIntroductionInterceptorTests {
@Test
void testAutomaticInterfaceRecognitionInSubclass() throws Exception {
void automaticInterfaceRecognitionInSubclass() throws Exception {
final long t = 1001L;
@SuppressWarnings("serial")
class TestII extends DelegatingIntroductionInterceptor implements TimeStamped, ITester {
@ -178,7 +178,7 @@ class DelegatingIntroductionInterceptorTests { @@ -178,7 +178,7 @@ class DelegatingIntroductionInterceptorTests {
}
@Test
void testIntroductionInterceptorDoesNotReplaceToString() {
void introductionInterceptorDoesNotReplaceToString() {
TestBean raw = new TestBean();
assertThat(raw).isNotInstanceOf(TimeStamped.class);
ProxyFactory factory = new ProxyFactory(raw);
@ -199,7 +199,7 @@ class DelegatingIntroductionInterceptorTests { @@ -199,7 +199,7 @@ class DelegatingIntroductionInterceptorTests {
}
@Test
void testDelegateReturnsThisIsMassagedToReturnProxy() {
void delegateReturnsThisIsMassagedToReturnProxy() {
NestedTestBean target = new NestedTestBean();
String company = "Interface21";
target.setCompany(company);
@ -220,7 +220,7 @@ class DelegatingIntroductionInterceptorTests { @@ -220,7 +220,7 @@ class DelegatingIntroductionInterceptorTests {
}
@Test
void testSerializableDelegatingIntroductionInterceptorSerializable() throws Exception {
void serializableDelegatingIntroductionInterceptorSerializable() throws Exception {
SerializablePerson serializableTarget = new SerializablePerson();
String name = "Tony";
serializableTarget.setName("Tony");
@ -245,7 +245,7 @@ class DelegatingIntroductionInterceptorTests { @@ -245,7 +245,7 @@ class DelegatingIntroductionInterceptorTests {
// Test when target implements the interface: should get interceptor by preference.
@Test
void testIntroductionMasksTargetImplementation() {
void introductionMasksTargetImplementation() {
final long t = 1001L;
@SuppressWarnings("serial")
class TestII extends DelegatingIntroductionInterceptor implements TimeStamped {

12
spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java

@ -56,19 +56,19 @@ class MethodMatchersTests { @@ -56,19 +56,19 @@ class MethodMatchersTests {
@Test
void testDefaultMatchesAll() {
void defaultMatchesAll() {
MethodMatcher defaultMm = MethodMatcher.TRUE;
assertThat(defaultMm.matches(EXCEPTION_GETMESSAGE, Exception.class)).isTrue();
assertThat(defaultMm.matches(ITESTBEAN_SETAGE, TestBean.class)).isTrue();
}
@Test
void testMethodMatcherTrueSerializable() throws Exception {
void methodMatcherTrueSerializable() throws Exception {
assertThat(MethodMatcher.TRUE).isSameAs(SerializationTestUtils.serializeAndDeserialize(MethodMatcher.TRUE));
}
@Test
void testSingle() {
void single() {
MethodMatcher defaultMm = MethodMatcher.TRUE;
assertThat(defaultMm.matches(EXCEPTION_GETMESSAGE, Exception.class)).isTrue();
assertThat(defaultMm.matches(ITESTBEAN_SETAGE, TestBean.class)).isTrue();
@ -80,7 +80,7 @@ class MethodMatchersTests { @@ -80,7 +80,7 @@ class MethodMatchersTests {
@Test
void testDynamicAndStaticMethodMatcherIntersection() {
void dynamicAndStaticMethodMatcherIntersection() {
MethodMatcher mm1 = MethodMatcher.TRUE;
MethodMatcher mm2 = new TestDynamicMethodMatcherWhichMatches();
MethodMatcher intersection = MethodMatchers.intersection(mm1, mm2);
@ -95,7 +95,7 @@ class MethodMatchersTests { @@ -95,7 +95,7 @@ class MethodMatchersTests {
}
@Test
void testStaticMethodMatcherUnion() {
void staticMethodMatcherUnion() {
MethodMatcher getterMatcher = new StartsWithMatcher("get");
MethodMatcher setterMatcher = new StartsWithMatcher("set");
MethodMatcher union = MethodMatchers.union(getterMatcher, setterMatcher);
@ -107,7 +107,7 @@ class MethodMatchersTests { @@ -107,7 +107,7 @@ class MethodMatchersTests {
}
@Test
void testUnionEquals() {
void unionEquals() {
MethodMatcher first = MethodMatchers.union(MethodMatcher.TRUE, MethodMatcher.TRUE);
MethodMatcher second = new ComposablePointcut(MethodMatcher.TRUE).union(new ComposablePointcut(MethodMatcher.TRUE)).getMethodMatcher();
assertThat(first).isEqualTo(second);

14
spring-aop/src/test/java/org/springframework/aop/support/PointcutsTests.java

@ -120,7 +120,7 @@ class PointcutsTests { @@ -120,7 +120,7 @@ class PointcutsTests {
@Test
void testTrue() {
void trueCase() {
assertThat(Pointcuts.matches(Pointcut.TRUE, TEST_BEAN_SET_AGE, TestBean.class, 6)).isTrue();
assertThat(Pointcuts.matches(Pointcut.TRUE, TEST_BEAN_GET_AGE, TestBean.class)).isTrue();
assertThat(Pointcuts.matches(Pointcut.TRUE, TEST_BEAN_ABSQUATULATE, TestBean.class)).isTrue();
@ -130,7 +130,7 @@ class PointcutsTests { @@ -130,7 +130,7 @@ class PointcutsTests {
}
@Test
void testMatches() {
void matches() {
assertThat(Pointcuts.matches(allClassSetterPointcut, TEST_BEAN_SET_AGE, TestBean.class, 6)).isTrue();
assertThat(Pointcuts.matches(allClassSetterPointcut, TEST_BEAN_GET_AGE, TestBean.class)).isFalse();
assertThat(Pointcuts.matches(allClassSetterPointcut, TEST_BEAN_ABSQUATULATE, TestBean.class)).isFalse();
@ -143,7 +143,7 @@ class PointcutsTests { @@ -143,7 +143,7 @@ class PointcutsTests {
* Should match all setters and getters on any class
*/
@Test
void testUnionOfSettersAndGetters() {
void unionOfSettersAndGetters() {
Pointcut union = Pointcuts.union(allClassGetterPointcut, allClassSetterPointcut);
assertThat(Pointcuts.matches(union, TEST_BEAN_SET_AGE, TestBean.class, 6)).isTrue();
assertThat(Pointcuts.matches(union, TEST_BEAN_GET_AGE, TestBean.class)).isTrue();
@ -151,7 +151,7 @@ class PointcutsTests { @@ -151,7 +151,7 @@ class PointcutsTests {
}
@Test
void testUnionOfSpecificGetters() {
void unionOfSpecificGetters() {
Pointcut union = Pointcuts.union(allClassGetAgePointcut, allClassGetNamePointcut);
assertThat(Pointcuts.matches(union, TEST_BEAN_SET_AGE, TestBean.class, 6)).isFalse();
assertThat(Pointcuts.matches(union, TEST_BEAN_GET_AGE, TestBean.class)).isTrue();
@ -175,7 +175,7 @@ class PointcutsTests { @@ -175,7 +175,7 @@ class PointcutsTests {
* Second one matches all getters in the MyTestBean class. TestBean getters shouldn't pass.
*/
@Test
void testUnionOfAllSettersAndSubclassSetters() {
void unionOfAllSettersAndSubclassSetters() {
assertThat(Pointcuts.matches(myTestBeanSetterPointcut, TEST_BEAN_SET_AGE, TestBean.class, 6)).isFalse();
assertThat(Pointcuts.matches(myTestBeanSetterPointcut, TEST_BEAN_SET_AGE, MyTestBean.class, 6)).isTrue();
assertThat(Pointcuts.matches(myTestBeanSetterPointcut, TEST_BEAN_GET_AGE, TestBean.class)).isFalse();
@ -193,7 +193,7 @@ class PointcutsTests { @@ -193,7 +193,7 @@ class PointcutsTests {
* it's the union of allClassGetAge and subclass getters
*/
@Test
void testIntersectionOfSpecificGettersAndSubclassGetters() {
void intersectionOfSpecificGettersAndSubclassGetters() {
assertThat(Pointcuts.matches(allClassGetAgePointcut, TEST_BEAN_GET_AGE, TestBean.class)).isTrue();
assertThat(Pointcuts.matches(allClassGetAgePointcut, TEST_BEAN_GET_AGE, MyTestBean.class)).isTrue();
assertThat(Pointcuts.matches(myTestBeanGetterPointcut, TEST_BEAN_GET_NAME, TestBean.class)).isFalse();
@ -239,7 +239,7 @@ class PointcutsTests { @@ -239,7 +239,7 @@ class PointcutsTests {
* The intersection of these two pointcuts leaves nothing.
*/
@Test
void testSimpleIntersection() {
void simpleIntersection() {
Pointcut intersection = Pointcuts.intersection(allClassGetterPointcut, allClassSetterPointcut);
assertThat(Pointcuts.matches(intersection, TEST_BEAN_SET_AGE, TestBean.class, 6)).isFalse();
assertThat(Pointcuts.matches(intersection, TEST_BEAN_GET_AGE, TestBean.class)).isFalse();

6
spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java

@ -43,7 +43,7 @@ class RegexpMethodPointcutAdvisorIntegrationTests { @@ -43,7 +43,7 @@ class RegexpMethodPointcutAdvisorIntegrationTests {
@Test
void testSinglePattern() throws Throwable {
void singlePattern() throws Throwable {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(CONTEXT);
ITestBean advised = (ITestBean) bf.getBean("settersAdvised");
@ -62,7 +62,7 @@ class RegexpMethodPointcutAdvisorIntegrationTests { @@ -62,7 +62,7 @@ class RegexpMethodPointcutAdvisorIntegrationTests {
}
@Test
void testMultiplePatterns() throws Throwable {
void multiplePatterns() throws Throwable {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(CONTEXT);
// This is a CGLIB proxy, so we can proxy it to the target class
@ -86,7 +86,7 @@ class RegexpMethodPointcutAdvisorIntegrationTests { @@ -86,7 +86,7 @@ class RegexpMethodPointcutAdvisorIntegrationTests {
}
@Test
void testSerialization() throws Throwable {
void serialization() throws Throwable {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(CONTEXT);
// This is a CGLIB proxy, so we can proxy it to the target class

6
spring-aop/src/test/java/org/springframework/aop/support/RootClassFilterTests.java

@ -44,19 +44,19 @@ class RootClassFilterTests { @@ -44,19 +44,19 @@ class RootClassFilterTests {
}
@Test
void testEquals() {
void equals() {
assertThat(filter1).isEqualTo(filter2);
assertThat(filter1).isNotEqualTo(filter3);
}
@Test
void testHashCode() {
void hashCodeBehavior() {
assertThat(filter1.hashCode()).isEqualTo(filter2.hashCode());
assertThat(filter1.hashCode()).isNotEqualTo(filter3.hashCode());
}
@Test
void testToString() {
void toStringOutput() {
assertThat(filter1.toString()).isEqualTo("org.springframework.aop.support.RootClassFilter: java.lang.Exception");
assertThat(filter1.toString()).isEqualTo(filter2.toString());
}

2
spring-aop/src/test/java/org/springframework/aop/target/CommonsPool2TargetSourceProxyTests.java

@ -36,7 +36,7 @@ class CommonsPool2TargetSourceProxyTests { @@ -36,7 +36,7 @@ class CommonsPool2TargetSourceProxyTests {
qualifiedResource(CommonsPool2TargetSourceProxyTests.class, "context.xml");
@Test
void testProxy() {
void proxy() {
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);
reader.loadBeanDefinitions(CONTEXT);

10
spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java

@ -68,7 +68,7 @@ class HotSwappableTargetSourceTests { @@ -68,7 +68,7 @@ class HotSwappableTargetSourceTests {
* Check it works like a normal invoker
*/
@Test
void testBasicFunctionality() {
void basicFunctionality() {
SideEffectBean proxied = (SideEffectBean) beanFactory.getBean("swappable");
assertThat(proxied.getCount()).isEqualTo(INITIAL_COUNT);
proxied.doWork();
@ -80,7 +80,7 @@ class HotSwappableTargetSourceTests { @@ -80,7 +80,7 @@ class HotSwappableTargetSourceTests {
}
@Test
void testValidSwaps() {
void validSwaps() {
SideEffectBean target1 = (SideEffectBean) beanFactory.getBean("target1");
SideEffectBean target2 = (SideEffectBean) beanFactory.getBean("target2");
@ -107,17 +107,17 @@ class HotSwappableTargetSourceTests { @@ -107,17 +107,17 @@ class HotSwappableTargetSourceTests {
}
@Test
void testRejectsSwapToNull() {
void rejectsSwapToNull() {
HotSwappableTargetSource swapper = (HotSwappableTargetSource) beanFactory.getBean("swapper");
assertThatIllegalArgumentException().as("Shouldn't be able to swap to invalid value").isThrownBy(() ->
swapper.swap(null))
.withMessageContaining("null");
// It shouldn't be corrupted, it should still work
testBasicFunctionality();
basicFunctionality();
}
@Test
void testSerialization() throws Exception {
void serialization() throws Exception {
SerializablePerson sp1 = new SerializablePerson();
sp1.setName("Tony");
SerializablePerson sp2 = new SerializablePerson();

2
spring-aop/src/test/java/org/springframework/aop/target/LazyCreationTargetSourceTests.java

@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class LazyCreationTargetSourceTests {
@Test
void testCreateLazy() {
void createLazy() {
TargetSource targetSource = new AbstractLazyCreationTargetSource() {
@Override
protected Object createObject() {

2
spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java

@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class PrototypeBasedTargetSourceTests {
@Test
void testSerializability() throws Exception {
void serializability() throws Exception {
MutablePropertyValues tsPvs = new MutablePropertyValues();
tsPvs.add("targetBeanName", "person");
RootBeanDefinition tsBd = new RootBeanDefinition(TestTargetSource.class);

2
spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java

@ -52,7 +52,7 @@ class PrototypeTargetSourceTests { @@ -52,7 +52,7 @@ class PrototypeTargetSourceTests {
* With the singleton, there will be change.
*/
@Test
void testPrototypeAndSingletonBehaveDifferently() {
void prototypeAndSingletonBehaveDifferently() {
SideEffectBean singleton = (SideEffectBean) beanFactory.getBean("singleton");
assertThat(singleton.getCount()).isEqualTo(INITIAL_COUNT);
singleton.doWork();

10
spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java

@ -60,7 +60,7 @@ class ThreadLocalTargetSourceTests { @@ -60,7 +60,7 @@ class ThreadLocalTargetSourceTests {
* with one another.
*/
@Test
void testUseDifferentManagedInstancesInSameThread() {
void useDifferentManagedInstancesInSameThread() {
SideEffectBean apartment = (SideEffectBean) beanFactory.getBean("apartment");
assertThat(apartment.getCount()).isEqualTo(INITIAL_COUNT);
apartment.doWork();
@ -72,7 +72,7 @@ class ThreadLocalTargetSourceTests { @@ -72,7 +72,7 @@ class ThreadLocalTargetSourceTests {
}
@Test
void testReuseInSameThread() {
void reuseInSameThread() {
SideEffectBean apartment = (SideEffectBean) beanFactory.getBean("apartment");
assertThat(apartment.getCount()).isEqualTo(INITIAL_COUNT);
apartment.doWork();
@ -86,7 +86,7 @@ class ThreadLocalTargetSourceTests { @@ -86,7 +86,7 @@ class ThreadLocalTargetSourceTests {
* Relies on introduction.
*/
@Test
void testCanGetStatsViaMixin() {
void canGetStatsViaMixin() {
ThreadLocalTargetSourceStats stats = (ThreadLocalTargetSourceStats) beanFactory.getBean("apartment");
// +1 because creating target for stats call counts
assertThat(stats.getInvocationCount()).isEqualTo(1);
@ -104,7 +104,7 @@ class ThreadLocalTargetSourceTests { @@ -104,7 +104,7 @@ class ThreadLocalTargetSourceTests {
}
@Test
void testNewThreadHasOwnInstance() throws InterruptedException {
void newThreadHasOwnInstance() throws InterruptedException {
SideEffectBean apartment = (SideEffectBean) beanFactory.getBean("apartment");
assertThat(apartment.getCount()).isEqualTo(INITIAL_COUNT);
apartment.doWork();
@ -144,7 +144,7 @@ class ThreadLocalTargetSourceTests { @@ -144,7 +144,7 @@ class ThreadLocalTargetSourceTests {
* Test for SPR-1442. Destroyed target should re-associated with thread and not throw NPE.
*/
@Test
void testReuseDestroyedTarget() {
void reuseDestroyedTarget() {
ThreadLocalTargetSource source = (ThreadLocalTargetSource)this.beanFactory.getBean("threadLocalTs");
// try first time

8
spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java

@ -33,7 +33,7 @@ class RefreshableTargetSourceTests { @@ -33,7 +33,7 @@ class RefreshableTargetSourceTests {
* Test what happens when checking for refresh but not refreshing object.
*/
@Test
void testRefreshCheckWithNonRefresh() throws Exception {
void refreshCheckWithNonRefresh() throws Exception {
CountingRefreshableTargetSource ts = new CountingRefreshableTargetSource();
ts.setRefreshCheckDelay(0);
@ -49,7 +49,7 @@ class RefreshableTargetSourceTests { @@ -49,7 +49,7 @@ class RefreshableTargetSourceTests {
* Test what happens when checking for refresh and refresh occurs.
*/
@Test
void testRefreshCheckWithRefresh() throws Exception {
void refreshCheckWithRefresh() throws Exception {
CountingRefreshableTargetSource ts = new CountingRefreshableTargetSource(true);
ts.setRefreshCheckDelay(0);
@ -65,7 +65,7 @@ class RefreshableTargetSourceTests { @@ -65,7 +65,7 @@ class RefreshableTargetSourceTests {
* Test what happens when no refresh occurs.
*/
@Test
void testWithNoRefreshCheck() {
void withNoRefreshCheck() {
CountingRefreshableTargetSource ts = new CountingRefreshableTargetSource(true);
ts.setRefreshCheckDelay(-1);
@ -78,7 +78,7 @@ class RefreshableTargetSourceTests { @@ -78,7 +78,7 @@ class RefreshableTargetSourceTests {
@Test
@EnabledForTestGroups(LONG_RUNNING)
public void testRefreshOverTime() throws Exception {
void refreshOverTime() throws Exception {
CountingRefreshableTargetSource ts = new CountingRefreshableTargetSource(true);
ts.setRefreshCheckDelay(100);

127
spring-aspects/src/test/java/org/springframework/cache/aspectj/AbstractCacheAnnotationTests.java vendored

@ -49,7 +49,7 @@ import static org.assertj.core.api.Assertions.assertThatIOException; @@ -49,7 +49,7 @@ import static org.assertj.core.api.Assertions.assertThatIOException;
* @author Phillip Webb
* @author Stephane Nicoll
*/
public abstract class AbstractCacheAnnotationTests {
abstract class AbstractCacheAnnotationTests {
protected ConfigurableApplicationContext ctx;
@ -67,7 +67,7 @@ public abstract class AbstractCacheAnnotationTests { @@ -67,7 +67,7 @@ public abstract class AbstractCacheAnnotationTests {
@BeforeEach
public void setup() {
void setup() {
this.ctx = getApplicationContext();
this.cs = ctx.getBean("service", CacheableService.class);
this.ccs = ctx.getBean("classService", CacheableService.class);
@ -78,7 +78,7 @@ public abstract class AbstractCacheAnnotationTests { @@ -78,7 +78,7 @@ public abstract class AbstractCacheAnnotationTests {
}
@AfterEach
public void close() {
void close() {
if (this.ctx != null) {
this.ctx.close();
}
@ -555,133 +555,134 @@ public abstract class AbstractCacheAnnotationTests { @@ -555,133 +555,134 @@ public abstract class AbstractCacheAnnotationTests {
assertThat(secondary.get(key2)).isNull();
}
@Test
void testCacheable() {
void cacheable() {
testCacheable(this.cs);
}
@Test
void testCacheableNull() {
void cacheableNull() {
testCacheableNull(this.cs);
}
@Test
void testCacheableSync() {
void cacheableSync() {
testCacheableSync(this.cs);
}
@Test
void testCacheableSyncNull() {
void cacheableSyncNull() {
testCacheableSyncNull(this.cs);
}
@Test
void testEvict() {
void evict() {
testEvict(this.cs, true);
}
@Test
void testEvictEarly() {
void evictEarly() {
testEvictEarly(this.cs);
}
@Test
void testEvictWithException() {
void evictWithException() {
testEvictException(this.cs);
}
@Test
void testEvictAll() {
void evictAll() {
testEvictAll(this.cs, true);
}
@Test
void testEvictAllEarly() {
void evictAllEarly() {
testEvictAllEarly(this.cs);
}
@Test
void testEvictWithKey() {
void evictWithKey() {
testEvictWithKey(this.cs);
}
@Test
void testEvictWithKeyEarly() {
void evictWithKeyEarly() {
testEvictWithKeyEarly(this.cs);
}
@Test
void testConditionalExpression() {
void conditionalExpression() {
testConditionalExpression(this.cs);
}
@Test
void testConditionalExpressionSync() {
void conditionalExpressionSync() {
testConditionalExpressionSync(this.cs);
}
@Test
void testUnlessExpression() {
void unlessExpression() {
testUnlessExpression(this.cs);
}
@Test
void testClassCacheUnlessExpression() {
void classCacheUnlessExpression() {
testUnlessExpression(this.cs);
}
@Test
void testKeyExpression() {
void keyExpression() {
testKeyExpression(this.cs);
}
@Test
void testVarArgsKey() {
void varArgsKey() {
testVarArgsKey(this.cs);
}
@Test
void testClassCacheCacheable() {
void classCacheCacheable() {
testCacheable(this.ccs);
}
@Test
void testClassCacheEvict() {
void classCacheEvict() {
testEvict(this.ccs, true);
}
@Test
void testClassEvictEarly() {
void classEvictEarly() {
testEvictEarly(this.ccs);
}
@Test
void testClassEvictAll() {
void classEvictAll() {
testEvictAll(this.ccs, true);
}
@Test
void testClassEvictWithException() {
void classEvictWithException() {
testEvictException(this.ccs);
}
@Test
void testClassCacheEvictWithWKey() {
void classCacheEvictWithWKey() {
testEvictWithKey(this.ccs);
}
@Test
void testClassEvictWithKeyEarly() {
void classEvictWithKeyEarly() {
testEvictWithKeyEarly(this.ccs);
}
@Test
void testNullValue() {
void nullValue() {
testNullValue(this.cs);
}
@Test
void testClassNullValue() {
void classNullValue() {
Object key = new Object();
assertThat(this.ccs.nullValue(key)).isNull();
int nr = this.ccs.nullInvocations().intValue();
@ -694,27 +695,27 @@ public abstract class AbstractCacheAnnotationTests { @@ -694,27 +695,27 @@ public abstract class AbstractCacheAnnotationTests {
}
@Test
void testMethodName() {
void methodName() {
testMethodName(this.cs, "name");
}
@Test
void testClassMethodName() {
void classMethodName() {
testMethodName(this.ccs, "nametestCache");
}
@Test
void testRootVars() {
void rootVars() {
testRootVars(this.cs);
}
@Test
void testClassRootVars() {
void classRootVars() {
testRootVars(this.ccs);
}
@Test
void testCustomKeyGenerator() {
void customKeyGenerator() {
Object param = new Object();
Object r1 = this.cs.customKeyGenerator(param);
assertThat(this.cs.customKeyGenerator(param)).isSameAs(r1);
@ -725,14 +726,14 @@ public abstract class AbstractCacheAnnotationTests { @@ -725,14 +726,14 @@ public abstract class AbstractCacheAnnotationTests {
}
@Test
void testUnknownCustomKeyGenerator() {
void unknownCustomKeyGenerator() {
Object param = new Object();
assertThatExceptionOfType(NoSuchBeanDefinitionException.class).isThrownBy(() ->
this.cs.unknownCustomKeyGenerator(param));
}
@Test
void testCustomCacheManager() {
void customCacheManager() {
CacheManager customCm = this.ctx.getBean("customCacheManager", CacheManager.class);
Object key = new Object();
Object r1 = this.cs.customCacheManager(key);
@ -743,139 +744,139 @@ public abstract class AbstractCacheAnnotationTests { @@ -743,139 +744,139 @@ public abstract class AbstractCacheAnnotationTests {
}
@Test
void testUnknownCustomCacheManager() {
void unknownCustomCacheManager() {
Object param = new Object();
assertThatExceptionOfType(NoSuchBeanDefinitionException.class).isThrownBy(() ->
this.cs.unknownCustomCacheManager(param));
}
@Test
void testNullArg() {
void nullArg() {
testNullArg(this.cs);
}
@Test
void testClassNullArg() {
void classNullArg() {
testNullArg(this.ccs);
}
@Test
void testCheckedException() {
void checkedException() {
testCheckedThrowable(this.cs);
}
@Test
void testClassCheckedException() {
void classCheckedException() {
testCheckedThrowable(this.ccs);
}
@Test
void testCheckedExceptionSync() {
void checkedExceptionSync() {
testCheckedThrowableSync(this.cs);
}
@Test
void testClassCheckedExceptionSync() {
void classCheckedExceptionSync() {
testCheckedThrowableSync(this.ccs);
}
@Test
void testUncheckedException() {
void uncheckedException() {
testUncheckedThrowable(this.cs);
}
@Test
void testClassUncheckedException() {
void classUncheckedException() {
testUncheckedThrowable(this.ccs);
}
@Test
void testUncheckedExceptionSync() {
void uncheckedExceptionSync() {
testUncheckedThrowableSync(this.cs);
}
@Test
void testClassUncheckedExceptionSync() {
void classUncheckedExceptionSync() {
testUncheckedThrowableSync(this.ccs);
}
@Test
void testUpdate() {
void update() {
testCacheUpdate(this.cs);
}
@Test
void testClassUpdate() {
void classUpdate() {
testCacheUpdate(this.ccs);
}
@Test
void testConditionalUpdate() {
void conditionalUpdate() {
testConditionalCacheUpdate(this.cs);
}
@Test
void testClassConditionalUpdate() {
void classConditionalUpdate() {
testConditionalCacheUpdate(this.ccs);
}
@Test
void testMultiCache() {
void multiCache() {
testMultiCache(this.cs);
}
@Test
void testClassMultiCache() {
void classMultiCache() {
testMultiCache(this.ccs);
}
@Test
void testMultiEvict() {
void multiEvict() {
testMultiEvict(this.cs);
}
@Test
void testClassMultiEvict() {
void classMultiEvict() {
testMultiEvict(this.ccs);
}
@Test
void testMultiPut() {
void multiPut() {
testMultiPut(this.cs);
}
@Test
void testClassMultiPut() {
void classMultiPut() {
testMultiPut(this.ccs);
}
@Test
void testPutRefersToResult() {
void putRefersToResult() {
testPutRefersToResult(this.cs);
}
@Test
void testClassPutRefersToResult() {
void classPutRefersToResult() {
testPutRefersToResult(this.ccs);
}
@Test
void testMultiCacheAndEvict() {
void multiCacheAndEvict() {
testMultiCacheAndEvict(this.cs);
}
@Test
void testClassMultiCacheAndEvict() {
void classMultiCacheAndEvict() {
testMultiCacheAndEvict(this.ccs);
}
@Test
void testMultiConditionalCacheAndEvict() {
void multiConditionalCacheAndEvict() {
testMultiConditionalCacheAndEvict(this.cs);
}
@Test
void testClassMultiConditionalCacheAndEvict() {
void classMultiConditionalCacheAndEvict() {
testMultiConditionalCacheAndEvict(this.ccs);
}

2
spring-aspects/src/test/java/org/springframework/cache/aspectj/AspectJCacheAnnotationTests.java vendored

@ -37,7 +37,7 @@ class AspectJCacheAnnotationTests extends AbstractCacheAnnotationTests { @@ -37,7 +37,7 @@ class AspectJCacheAnnotationTests extends AbstractCacheAnnotationTests {
}
@Test
void testKeyStrategy() {
void keyStrategy() {
AnnotationCacheAspect aspect = ctx.getBean(
"org.springframework.cache.config.internalCacheAspect", AnnotationCacheAspect.class);
assertThat(aspect.getKeyGenerator()).isSameAs(ctx.getBean("keyGenerator"));

17
spring-aspects/src/test/java/org/springframework/cache/aspectj/AspectJEnableCachingIsolatedTests.java vendored

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.cache.aspectj;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.AutoClose;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@ -51,6 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -51,6 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
class AspectJEnableCachingIsolatedTests {
@AutoClose
private ConfigurableApplicationContext ctx;
@ -58,23 +59,16 @@ class AspectJEnableCachingIsolatedTests { @@ -58,23 +59,16 @@ class AspectJEnableCachingIsolatedTests {
this.ctx = new AnnotationConfigApplicationContext(config);
}
@AfterEach
public void closeContext() {
if (this.ctx != null) {
this.ctx.close();
}
}
@Test
void testKeyStrategy() {
void keyStrategy() {
load(EnableCachingConfig.class);
AnnotationCacheAspect aspect = this.ctx.getBean(AnnotationCacheAspect.class);
assertThat(aspect.getKeyGenerator()).isSameAs(this.ctx.getBean("keyGenerator", KeyGenerator.class));
}
@Test
void testCacheErrorHandler() {
void cacheErrorHandler() {
load(EnableCachingConfig.class);
AnnotationCacheAspect aspect = this.ctx.getBean(AnnotationCacheAspect.class);
assertThat(aspect.getErrorHandler()).isSameAs(this.ctx.getBean("errorHandler", CacheErrorHandler.class));
@ -129,7 +123,7 @@ class AspectJEnableCachingIsolatedTests { @@ -129,7 +123,7 @@ class AspectJEnableCachingIsolatedTests {
@Test
@Disabled("AspectJ has some sort of caching that makes this one fail")
public void emptyConfigSupport() {
void emptyConfigSupport() {
load(EmptyConfigSupportConfig.class);
AnnotationCacheAspect aspect = this.ctx.getBean(AnnotationCacheAspect.class);
assertThat(aspect.getCacheResolver()).isNotNull();
@ -284,4 +278,5 @@ class AspectJEnableCachingIsolatedTests { @@ -284,4 +278,5 @@ class AspectJEnableCachingIsolatedTests {
return new NamedCacheResolver(cacheManager(), "foo");
}
}
}

4
spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationDrivenBeanDefinitionParserTests.java

@ -56,7 +56,7 @@ class AnnotationDrivenBeanDefinitionParserTests { @@ -56,7 +56,7 @@ class AnnotationDrivenBeanDefinitionParserTests {
@Test
@SuppressWarnings("rawtypes")
public void asyncPostProcessorExecutorReference() {
void asyncPostProcessorExecutorReference() {
Object executor = context.getBean("testExecutor");
Object aspect = context.getBean(TaskManagementConfigUtils.ASYNC_EXECUTION_ASPECT_BEAN_NAME);
assertThat(((Supplier) new DirectFieldAccessor(aspect).getPropertyValue("defaultExecutor")).get()).isSameAs(executor);
@ -64,7 +64,7 @@ class AnnotationDrivenBeanDefinitionParserTests { @@ -64,7 +64,7 @@ class AnnotationDrivenBeanDefinitionParserTests {
@Test
@SuppressWarnings("rawtypes")
public void asyncPostProcessorExceptionHandlerReference() {
void asyncPostProcessorExceptionHandlerReference() {
Object exceptionHandler = context.getBean("testExceptionHandler");
Object aspect = context.getBean(TaskManagementConfigUtils.ASYNC_EXECUTION_ASPECT_BEAN_NAME);
assertThat(((Supplier) new DirectFieldAccessor(aspect).getPropertyValue("exceptionHandler")).get()).isSameAs(exceptionHandler);

4
spring-aspects/src/test/java/org/springframework/transaction/aspectj/TransactionAspectTests.java

@ -50,13 +50,13 @@ class TransactionAspectTests { @@ -50,13 +50,13 @@ class TransactionAspectTests {
@BeforeEach
public void initContext() {
void initContext() {
AnnotationTransactionAspect.aspectOf().setTransactionManager(txManager);
}
@Test
void testCommitOnAnnotatedClass() throws Throwable {
void commitOnAnnotatedClass() throws Throwable {
txManager.clear();
assertThat(txManager.begun).isEqualTo(0);
annotationOnlyOnClassWithNoInterface.echo(null);

2
spring-beans/src/test/java/org/springframework/beans/AbstractPropertyAccessorTests.java

@ -375,7 +375,7 @@ abstract class AbstractPropertyAccessorTests { @@ -375,7 +375,7 @@ abstract class AbstractPropertyAccessorTests {
}
@Test
void testErrorMessageOfNestedProperty() {
void errorMessageOfNestedProperty() {
ITestBean target = new TestBean();
ITestBean child = new DifferentTestBean();
child.setName("test");

30
spring-beans/src/test/java/org/springframework/beans/BeanWrapperEnumTests.java

@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class BeanWrapperEnumTests {
@Test
void testCustomEnum() {
void customEnum() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnum", "VALUE_1");
@ -42,7 +42,7 @@ class BeanWrapperEnumTests { @@ -42,7 +42,7 @@ class BeanWrapperEnumTests {
}
@Test
void testCustomEnumWithNull() {
void customEnumWithNull() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnum", null);
@ -50,7 +50,7 @@ class BeanWrapperEnumTests { @@ -50,7 +50,7 @@ class BeanWrapperEnumTests {
}
@Test
void testCustomEnumWithEmptyString() {
void customEnumWithEmptyString() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnum", "");
@ -58,7 +58,7 @@ class BeanWrapperEnumTests { @@ -58,7 +58,7 @@ class BeanWrapperEnumTests {
}
@Test
void testCustomEnumArrayWithSingleValue() {
void customEnumArrayWithSingleValue() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumArray", "VALUE_1");
@ -67,7 +67,7 @@ class BeanWrapperEnumTests { @@ -67,7 +67,7 @@ class BeanWrapperEnumTests {
}
@Test
void testCustomEnumArrayWithMultipleValues() {
void customEnumArrayWithMultipleValues() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumArray", new String[] {"VALUE_1", "VALUE_2"});
@ -77,7 +77,7 @@ class BeanWrapperEnumTests { @@ -77,7 +77,7 @@ class BeanWrapperEnumTests {
}
@Test
void testCustomEnumArrayWithMultipleValuesAsCsv() {
void customEnumArrayWithMultipleValuesAsCsv() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumArray", "VALUE_1,VALUE_2");
@ -87,7 +87,7 @@ class BeanWrapperEnumTests { @@ -87,7 +87,7 @@ class BeanWrapperEnumTests {
}
@Test
void testCustomEnumSetWithSingleValue() {
void customEnumSetWithSingleValue() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumSet", "VALUE_1");
@ -96,7 +96,7 @@ class BeanWrapperEnumTests { @@ -96,7 +96,7 @@ class BeanWrapperEnumTests {
}
@Test
void testCustomEnumSetWithMultipleValues() {
void customEnumSetWithMultipleValues() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumSet", new String[] {"VALUE_1", "VALUE_2"});
@ -106,7 +106,7 @@ class BeanWrapperEnumTests { @@ -106,7 +106,7 @@ class BeanWrapperEnumTests {
}
@Test
void testCustomEnumSetWithMultipleValuesAsCsv() {
void customEnumSetWithMultipleValuesAsCsv() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumSet", "VALUE_1,VALUE_2");
@ -116,7 +116,7 @@ class BeanWrapperEnumTests { @@ -116,7 +116,7 @@ class BeanWrapperEnumTests {
}
@Test
void testCustomEnumSetWithGetterSetterMismatch() {
void customEnumSetWithGetterSetterMismatch() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumSetMismatch", new String[] {"VALUE_1", "VALUE_2"});
@ -126,7 +126,7 @@ class BeanWrapperEnumTests { @@ -126,7 +126,7 @@ class BeanWrapperEnumTests {
}
@Test
void testStandardEnumSetWithMultipleValues() {
void standardEnumSetWithMultipleValues() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setConversionService(new DefaultConversionService());
@ -138,7 +138,7 @@ class BeanWrapperEnumTests { @@ -138,7 +138,7 @@ class BeanWrapperEnumTests {
}
@Test
void testStandardEnumSetWithAutoGrowing() {
void standardEnumSetWithAutoGrowing() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setAutoGrowNestedPaths(true);
@ -148,7 +148,7 @@ class BeanWrapperEnumTests { @@ -148,7 +148,7 @@ class BeanWrapperEnumTests {
}
@Test
void testStandardEnumMapWithMultipleValues() {
void standardEnumMapWithMultipleValues() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setConversionService(new DefaultConversionService());
@ -163,7 +163,7 @@ class BeanWrapperEnumTests { @@ -163,7 +163,7 @@ class BeanWrapperEnumTests {
}
@Test
void testStandardEnumMapWithAutoGrowing() {
void standardEnumMapWithAutoGrowing() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setAutoGrowNestedPaths(true);
@ -174,7 +174,7 @@ class BeanWrapperEnumTests { @@ -174,7 +174,7 @@ class BeanWrapperEnumTests {
}
@Test
void testNonPublicEnum() {
void nonPublicEnum() {
NonPublicEnumHolder holder = new NonPublicEnumHolder();
BeanWrapper bw = new BeanWrapperImpl(holder);
bw.setPropertyValue("nonPublicEnum", "VALUE_1");

84
spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java

@ -52,7 +52,7 @@ import static org.assertj.core.api.InstanceOfAssertFactories.LIST; @@ -52,7 +52,7 @@ import static org.assertj.core.api.InstanceOfAssertFactories.LIST;
class BeanWrapperGenericsTests {
@Test
void testGenericSet() {
void genericSet() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
Set<String> input = new HashSet<>();
@ -64,7 +64,7 @@ class BeanWrapperGenericsTests { @@ -64,7 +64,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericLowerBoundedSet() {
void genericLowerBoundedSet() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, true));
@ -77,7 +77,7 @@ class BeanWrapperGenericsTests { @@ -77,7 +77,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericSetWithConversionFailure() {
void genericSetWithConversionFailure() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
Set<TestBean> input = new HashSet<>();
@ -88,7 +88,7 @@ class BeanWrapperGenericsTests { @@ -88,7 +88,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericList() throws Exception {
void genericList() throws Exception {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
List<String> input = new ArrayList<>();
@ -100,7 +100,7 @@ class BeanWrapperGenericsTests { @@ -100,7 +100,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericListElement() throws Exception {
void genericListElement() throws Exception {
GenericBean<?> gb = new GenericBean<>();
gb.setResourceList(new ArrayList<>());
BeanWrapper bw = new BeanWrapperImpl(gb);
@ -109,7 +109,7 @@ class BeanWrapperGenericsTests { @@ -109,7 +109,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMap() {
void genericMap() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
Map<String, String> input = new HashMap<>();
@ -121,7 +121,7 @@ class BeanWrapperGenericsTests { @@ -121,7 +121,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapElement() {
void genericMapElement() {
GenericBean<?> gb = new GenericBean<>();
gb.setShortMap(new HashMap<>());
BeanWrapper bw = new BeanWrapperImpl(gb);
@ -131,7 +131,7 @@ class BeanWrapperGenericsTests { @@ -131,7 +131,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapWithKeyType() {
void genericMapWithKeyType() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
Map<String, String> input = new HashMap<>();
@ -143,7 +143,7 @@ class BeanWrapperGenericsTests { @@ -143,7 +143,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapElementWithKeyType() {
void genericMapElementWithKeyType() {
GenericBean<?> gb = new GenericBean<>();
gb.setLongMap(new HashMap<>());
BeanWrapper bw = new BeanWrapperImpl(gb);
@ -153,7 +153,7 @@ class BeanWrapperGenericsTests { @@ -153,7 +153,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapWithCollectionValue() {
void genericMapWithCollectionValue() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false));
@ -170,7 +170,7 @@ class BeanWrapperGenericsTests { @@ -170,7 +170,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapElementWithCollectionValue() {
void genericMapElementWithCollectionValue() {
GenericBean<?> gb = new GenericBean<>();
gb.setCollectionMap(new HashMap<>());
BeanWrapper bw = new BeanWrapperImpl(gb);
@ -182,7 +182,7 @@ class BeanWrapperGenericsTests { @@ -182,7 +182,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapFromProperties() {
void genericMapFromProperties() {
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
Properties input = new Properties();
@ -194,7 +194,7 @@ class BeanWrapperGenericsTests { @@ -194,7 +194,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericListOfLists() {
void genericListOfLists() {
GenericBean<String> gb = new GenericBean<>();
List<List<Integer>> list = new ArrayList<>();
list.add(new ArrayList<>());
@ -206,7 +206,7 @@ class BeanWrapperGenericsTests { @@ -206,7 +206,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericListOfListsWithElementConversion() {
void genericListOfListsWithElementConversion() {
GenericBean<String> gb = new GenericBean<>();
List<List<Integer>> list = new ArrayList<>();
list.add(new ArrayList<>());
@ -218,7 +218,7 @@ class BeanWrapperGenericsTests { @@ -218,7 +218,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericListOfArrays() {
void genericListOfArrays() {
GenericBean<String> gb = new GenericBean<>();
ArrayList<String[]> list = new ArrayList<>();
list.add(new String[] {"str1", "str2"});
@ -230,7 +230,7 @@ class BeanWrapperGenericsTests { @@ -230,7 +230,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericListOfArraysWithElementConversion() {
void genericListOfArraysWithElementConversion() {
GenericBean<String> gb = new GenericBean<>();
ArrayList<String[]> list = new ArrayList<>();
list.add(new String[] {"str1", "str2"});
@ -243,7 +243,7 @@ class BeanWrapperGenericsTests { @@ -243,7 +243,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericListOfMaps() {
void genericListOfMaps() {
GenericBean<String> gb = new GenericBean<>();
List<Map<Integer, Long>> list = new ArrayList<>();
list.add(new HashMap<>());
@ -255,7 +255,7 @@ class BeanWrapperGenericsTests { @@ -255,7 +255,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericListOfMapsWithElementConversion() {
void genericListOfMapsWithElementConversion() {
GenericBean<String> gb = new GenericBean<>();
List<Map<Integer, Long>> list = new ArrayList<>();
list.add(new HashMap<>());
@ -267,7 +267,7 @@ class BeanWrapperGenericsTests { @@ -267,7 +267,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapOfMaps() {
void genericMapOfMaps() {
GenericBean<String> gb = new GenericBean<>();
Map<String, Map<Integer, Long>> map = new HashMap<>();
map.put("mykey", new HashMap<>());
@ -279,7 +279,7 @@ class BeanWrapperGenericsTests { @@ -279,7 +279,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapOfMapsWithElementConversion() {
void genericMapOfMapsWithElementConversion() {
GenericBean<String> gb = new GenericBean<>();
Map<String, Map<Integer, Long>> map = new HashMap<>();
map.put("mykey", new HashMap<>());
@ -291,7 +291,7 @@ class BeanWrapperGenericsTests { @@ -291,7 +291,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapOfLists() {
void genericMapOfLists() {
GenericBean<String> gb = new GenericBean<>();
Map<Integer, List<Integer>> map = new HashMap<>();
map.put(1, new ArrayList<>());
@ -303,7 +303,7 @@ class BeanWrapperGenericsTests { @@ -303,7 +303,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericMapOfListsWithElementConversion() {
void genericMapOfListsWithElementConversion() {
GenericBean<String> gb = new GenericBean<>();
Map<Integer, List<Integer>> map = new HashMap<>();
map.put(1, new ArrayList<>());
@ -315,7 +315,7 @@ class BeanWrapperGenericsTests { @@ -315,7 +315,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericTypeNestingMapOfInteger() {
void genericTypeNestingMapOfInteger() {
Map<String, String> map = new HashMap<>();
map.put("testKey", "100");
@ -328,7 +328,7 @@ class BeanWrapperGenericsTests { @@ -328,7 +328,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericTypeNestingMapOfListOfInteger() {
void genericTypeNestingMapOfListOfInteger() {
Map<String, List<String>> map = new HashMap<>();
List<String> list = Arrays.asList("1", "2", "3");
map.put("testKey", list);
@ -343,7 +343,7 @@ class BeanWrapperGenericsTests { @@ -343,7 +343,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericTypeNestingListOfMapOfInteger() {
void genericTypeNestingListOfMapOfInteger() {
List<Map<String, String>> list = new ArrayList<>();
Map<String, String> map = new HashMap<>();
map.put("testKey", "5");
@ -359,7 +359,7 @@ class BeanWrapperGenericsTests { @@ -359,7 +359,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericTypeNestingMapOfListOfListOfInteger() {
void genericTypeNestingMapOfListOfListOfInteger() {
Map<String, List<List<String>>> map = new HashMap<>();
List<String> list = Arrays.asList("1", "2", "3");
map.put("testKey", Collections.singletonList(list));
@ -374,7 +374,7 @@ class BeanWrapperGenericsTests { @@ -374,7 +374,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexGenericMap() {
void complexGenericMap() {
Map<List<String>, List<String>> inputMap = new HashMap<>();
List<String> inputKey = new ArrayList<>();
inputKey.add("1");
@ -390,7 +390,7 @@ class BeanWrapperGenericsTests { @@ -390,7 +390,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexGenericMapWithCollectionConversion() {
void complexGenericMapWithCollectionConversion() {
Map<Set<String>, Set<String>> inputMap = new HashMap<>();
Set<String> inputKey = new HashSet<>();
inputKey.add("1");
@ -406,7 +406,7 @@ class BeanWrapperGenericsTests { @@ -406,7 +406,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexGenericIndexedMapEntry() {
void complexGenericIndexedMapEntry() {
List<String> inputValue = new ArrayList<>();
inputValue.add("10");
@ -418,7 +418,7 @@ class BeanWrapperGenericsTests { @@ -418,7 +418,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexGenericIndexedMapEntryWithCollectionConversion() {
void complexGenericIndexedMapEntryWithCollectionConversion() {
Set<String> inputValue = new HashSet<>();
inputValue.add("10");
@ -430,7 +430,7 @@ class BeanWrapperGenericsTests { @@ -430,7 +430,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexGenericIndexedMapEntryWithPlainValue() {
void complexGenericIndexedMapEntryWithPlainValue() {
String inputValue = "10";
ComplexMapHolder holder = new ComplexMapHolder();
@ -441,7 +441,7 @@ class BeanWrapperGenericsTests { @@ -441,7 +441,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexDerivedIndexedMapEntry() {
void complexDerivedIndexedMapEntry() {
List<String> inputValue = new ArrayList<>();
inputValue.add("10");
@ -453,7 +453,7 @@ class BeanWrapperGenericsTests { @@ -453,7 +453,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexDerivedIndexedMapEntryWithCollectionConversion() {
void complexDerivedIndexedMapEntryWithCollectionConversion() {
Set<String> inputValue = new HashSet<>();
inputValue.add("10");
@ -465,7 +465,7 @@ class BeanWrapperGenericsTests { @@ -465,7 +465,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexDerivedIndexedMapEntryWithPlainValue() {
void complexDerivedIndexedMapEntryWithPlainValue() {
String inputValue = "10";
ComplexMapHolder holder = new ComplexMapHolder();
@ -476,7 +476,7 @@ class BeanWrapperGenericsTests { @@ -476,7 +476,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexMultiValueMapEntry() {
void complexMultiValueMapEntry() {
List<String> inputValue = new ArrayList<>();
inputValue.add("10");
@ -488,7 +488,7 @@ class BeanWrapperGenericsTests { @@ -488,7 +488,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexMultiValueMapEntryWithCollectionConversion() {
void complexMultiValueMapEntryWithCollectionConversion() {
Set<String> inputValue = new HashSet<>();
inputValue.add("10");
@ -500,7 +500,7 @@ class BeanWrapperGenericsTests { @@ -500,7 +500,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testComplexMultiValueMapEntryWithPlainValue() {
void complexMultiValueMapEntryWithPlainValue() {
String inputValue = "10";
ComplexMapHolder holder = new ComplexMapHolder();
@ -511,7 +511,7 @@ class BeanWrapperGenericsTests { @@ -511,7 +511,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericallyTypedIntegerBean() {
void genericallyTypedIntegerBean() {
GenericIntegerBean gb = new GenericIntegerBean();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("genericProperty", "10");
@ -521,7 +521,7 @@ class BeanWrapperGenericsTests { @@ -521,7 +521,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testGenericallyTypedSetOfIntegerBean() {
void genericallyTypedSetOfIntegerBean() {
GenericSetOfIntegerBean gb = new GenericSetOfIntegerBean();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("genericProperty", "10");
@ -532,7 +532,7 @@ class BeanWrapperGenericsTests { @@ -532,7 +532,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testSettingGenericPropertyWithReadOnlyInterface() {
void settingGenericPropertyWithReadOnlyInterface() {
Bar bar = new Bar();
BeanWrapper bw = new BeanWrapperImpl(bar);
bw.setPropertyValue("version", "10");
@ -540,7 +540,7 @@ class BeanWrapperGenericsTests { @@ -540,7 +540,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testSettingLongPropertyWithGenericInterface() {
void settingLongPropertyWithGenericInterface() {
Promotion bean = new Promotion();
BeanWrapper bw = new BeanWrapperImpl(bean);
bw.setPropertyValue("id", "10");
@ -548,7 +548,7 @@ class BeanWrapperGenericsTests { @@ -548,7 +548,7 @@ class BeanWrapperGenericsTests {
}
@Test
void testUntypedPropertyWithMapAtRuntime() {
void untypedPropertyWithMapAtRuntime() {
class Holder<D> {
private final D data;
public Holder(D data) {

4
spring-beans/src/test/java/org/springframework/beans/ConcurrentBeanWrapperTests.java

@ -45,12 +45,12 @@ class ConcurrentBeanWrapperTests { @@ -45,12 +45,12 @@ class ConcurrentBeanWrapperTests {
private Throwable ex = null;
@RepeatedTest(100)
void testSingleThread() {
void singleThread() {
performSet();
}
@Test
void testConcurrent() {
void concurrent() {
for (int i = 0; i < 10; i++) {
TestRun run = new TestRun(this);
set.add(run);

10
spring-beans/src/test/java/org/springframework/beans/MutablePropertyValuesTests.java

@ -40,12 +40,12 @@ class MutablePropertyValuesTests { @@ -40,12 +40,12 @@ class MutablePropertyValuesTests {
pvs.addPropertyValue(new PropertyValue("forname", "Tony"));
pvs.addPropertyValue(new PropertyValue("surname", "Blair"));
pvs.addPropertyValue(new PropertyValue("age", "50"));
doTestTony(pvs);
assertPropertyValuesForTony(pvs);
MutablePropertyValues deepCopy = new MutablePropertyValues(pvs);
doTestTony(deepCopy);
assertPropertyValuesForTony(deepCopy);
deepCopy.setPropertyValueAt(new PropertyValue("name", "Gordon"), 0);
doTestTony(pvs);
assertPropertyValuesForTony(pvs);
assertThat(deepCopy.getPropertyValue("name").getValue()).isEqualTo("Gordon");
}
@ -55,7 +55,7 @@ class MutablePropertyValuesTests { @@ -55,7 +55,7 @@ class MutablePropertyValuesTests {
pvs.addPropertyValue(new PropertyValue("forname", "Tony"));
pvs.addPropertyValue(new PropertyValue("surname", "Blair"));
pvs.addPropertyValue(new PropertyValue("age", "50"));
doTestTony(pvs);
assertPropertyValuesForTony(pvs);
PropertyValue addedPv = new PropertyValue("rod", "Rod");
pvs.addPropertyValue(addedPv);
assertThat(pvs.getPropertyValue("rod")).isEqualTo(addedPv);
@ -149,7 +149,7 @@ class MutablePropertyValuesTests { @@ -149,7 +149,7 @@ class MutablePropertyValuesTests {
/**
* Must contain: forname=Tony surname=Blair age=50
*/
protected void doTestTony(PropertyValues pvs) {
private static void assertPropertyValuesForTony(PropertyValues pvs) {
PropertyValue[] propertyValues = pvs.getPropertyValues();
assertThat(propertyValues).hasSize(3);

38
spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java

@ -85,7 +85,7 @@ class BeanFactoryUtilsTests { @@ -85,7 +85,7 @@ class BeanFactoryUtilsTests {
@Test
void testHierarchicalCountBeansWithNonHierarchicalFactory() {
void hierarchicalCountBeansWithNonHierarchicalFactory() {
StaticListableBeanFactory lbf = new StaticListableBeanFactory();
lbf.addBean("t1", new TestBean());
lbf.addBean("t2", new TestBean());
@ -96,7 +96,7 @@ class BeanFactoryUtilsTests { @@ -96,7 +96,7 @@ class BeanFactoryUtilsTests {
* Check that override doesn't count as two separate beans.
*/
@Test
void testHierarchicalCountBeansWithOverride() {
void hierarchicalCountBeansWithOverride() {
// Leaf count
assertThat(this.listableBeanFactory.getBeanDefinitionCount()).isEqualTo(1);
// Count minus duplicate
@ -105,14 +105,14 @@ class BeanFactoryUtilsTests { @@ -105,14 +105,14 @@ class BeanFactoryUtilsTests {
}
@Test
void testHierarchicalNamesWithNoMatch() {
void hierarchicalNamesWithNoMatch() {
List<String> names = Arrays.asList(
BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.listableBeanFactory, NoOp.class));
assertThat(names).isEmpty();
}
@Test
void testHierarchicalNamesWithMatchOnlyInRoot() {
void hierarchicalNamesWithMatchOnlyInRoot() {
List<String> names = Arrays.asList(
BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.listableBeanFactory, IndexedTestBean.class));
assertThat(names).hasSize(1);
@ -122,7 +122,7 @@ class BeanFactoryUtilsTests { @@ -122,7 +122,7 @@ class BeanFactoryUtilsTests {
}
@Test
void testGetBeanNamesForTypeWithOverride() {
void getBeanNamesForTypeWithOverride() {
List<String> names = Arrays.asList(
BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.listableBeanFactory, ITestBean.class));
// includes 2 TestBeans from FactoryBeans (DummyFactory definitions)
@ -134,7 +134,7 @@ class BeanFactoryUtilsTests { @@ -134,7 +134,7 @@ class BeanFactoryUtilsTests {
}
@Test
void testNoBeansOfType() {
void noBeansOfType() {
StaticListableBeanFactory lbf = new StaticListableBeanFactory();
lbf.addBean("foo", new Object());
Map<String, ?> beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(lbf, ITestBean.class, true, false);
@ -142,7 +142,7 @@ class BeanFactoryUtilsTests { @@ -142,7 +142,7 @@ class BeanFactoryUtilsTests {
}
@Test
void testFindsBeansOfTypeWithStaticFactory() {
void findsBeansOfTypeWithStaticFactory() {
StaticListableBeanFactory lbf = new StaticListableBeanFactory();
TestBean t1 = new TestBean();
TestBean t2 = new TestBean();
@ -173,7 +173,7 @@ class BeanFactoryUtilsTests { @@ -173,7 +173,7 @@ class BeanFactoryUtilsTests {
}
@Test
void testFindsBeansOfTypeWithDefaultFactory() {
void findsBeansOfTypeWithDefaultFactory() {
Object test3 = this.listableBeanFactory.getBean("test3");
Object test = this.listableBeanFactory.getBean("test");
@ -236,7 +236,7 @@ class BeanFactoryUtilsTests { @@ -236,7 +236,7 @@ class BeanFactoryUtilsTests {
}
@Test
void testHierarchicalResolutionWithOverride() {
void hierarchicalResolutionWithOverride() {
Object test3 = this.listableBeanFactory.getBean("test3");
Object test = this.listableBeanFactory.getBean("test");
@ -275,14 +275,14 @@ class BeanFactoryUtilsTests { @@ -275,14 +275,14 @@ class BeanFactoryUtilsTests {
}
@Test
void testHierarchicalNamesForAnnotationWithNoMatch() {
void hierarchicalNamesForAnnotationWithNoMatch() {
List<String> names = Arrays.asList(
BeanFactoryUtils.beanNamesForAnnotationIncludingAncestors(this.listableBeanFactory, Override.class));
assertThat(names).isEmpty();
}
@Test
void testHierarchicalNamesForAnnotationWithMatchOnlyInRoot() {
void hierarchicalNamesForAnnotationWithMatchOnlyInRoot() {
List<String> names = Arrays.asList(
BeanFactoryUtils.beanNamesForAnnotationIncludingAncestors(this.listableBeanFactory, TestAnnotation.class));
assertThat(names).hasSize(1);
@ -292,7 +292,7 @@ class BeanFactoryUtilsTests { @@ -292,7 +292,7 @@ class BeanFactoryUtilsTests {
}
@Test
void testGetBeanNamesForAnnotationWithOverride() {
void getBeanNamesForAnnotationWithOverride() {
AnnotatedBean annotatedBean = new AnnotatedBean();
this.listableBeanFactory.registerSingleton("anotherAnnotatedBean", annotatedBean);
List<String> names = Arrays.asList(
@ -303,25 +303,25 @@ class BeanFactoryUtilsTests { @@ -303,25 +303,25 @@ class BeanFactoryUtilsTests {
}
@Test
void testADependencies() {
void aDependencies() {
String[] deps = this.dependentBeansFactory.getDependentBeans("a");
assertThat(ObjectUtils.isEmpty(deps)).isTrue();
}
@Test
void testBDependencies() {
void bDependencies() {
String[] deps = this.dependentBeansFactory.getDependentBeans("b");
assertThat(Arrays.equals(new String[] { "c" }, deps)).isTrue();
}
@Test
void testCDependencies() {
void cDependencies() {
String[] deps = this.dependentBeansFactory.getDependentBeans("c");
assertThat(Arrays.equals(new String[] { "int", "long" }, deps)).isTrue();
}
@Test
void testIntDependencies() {
void intDependencies() {
String[] deps = this.dependentBeansFactory.getDependentBeans("int");
assertThat(Arrays.equals(new String[] { "buffer" }, deps)).isTrue();
}
@ -334,7 +334,7 @@ class BeanFactoryUtilsTests { @@ -334,7 +334,7 @@ class BeanFactoryUtilsTests {
}
@Test // gh-25520
public void findAnnotationOnBeanWithStaticFactory() {
void findAnnotationOnBeanWithStaticFactory() {
StaticListableBeanFactory lbf = new StaticListableBeanFactory();
lbf.addBean("controllerAdvice", new ControllerAdviceClass());
lbf.addBean("restControllerAdvice", new RestControllerAdviceClass());
@ -401,7 +401,7 @@ class BeanFactoryUtilsTests { @@ -401,7 +401,7 @@ class BeanFactoryUtilsTests {
testIsSingletonAndIsPrototype(lbf);
}
void testIsSingletonAndIsPrototype(ListableBeanFactory lbf) {
private static void testIsSingletonAndIsPrototype(ListableBeanFactory lbf) {
Map<String, ?> beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(lbf, ITestBean.class);
assertThat(beans).hasSize(7);
assertThat(beans.get("bean")).isSameAs(lbf.getBean("bean"));
@ -520,7 +520,7 @@ class BeanFactoryUtilsTests { @@ -520,7 +520,7 @@ class BeanFactoryUtilsTests {
testSupportsMultipleTypes(lbf);
}
void testSupportsMultipleTypes(ListableBeanFactory lbf) {
private static void testSupportsMultipleTypes(ListableBeanFactory lbf) {
List<ITestBean> testBeanList = lbf.getBeanProvider(ITestBean.class).stream().toList();
assertThat(testBeanList).hasSize(5);
assertThat(testBeanList.get(0)).isSameAs(lbf.getBean("bean", TestBean.class));

12
spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java

@ -48,7 +48,7 @@ class FactoryBeanTests { @@ -48,7 +48,7 @@ class FactoryBeanTests {
@Test
void testFactoryBeanReturnsNull() {
void factoryBeanReturnsNull() {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(RETURNS_NULL_CONTEXT);
@ -56,7 +56,7 @@ class FactoryBeanTests { @@ -56,7 +56,7 @@ class FactoryBeanTests {
}
@Test
void testFactoryBeansWithAutowiring() {
void factoryBeansWithAutowiring() {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(WITH_AUTOWIRING_CONTEXT);
@ -77,7 +77,7 @@ class FactoryBeanTests { @@ -77,7 +77,7 @@ class FactoryBeanTests {
}
@Test
void testFactoryBeansWithIntermediateFactoryBeanAutowiringFailure() {
void factoryBeansWithIntermediateFactoryBeanAutowiringFailure() {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(WITH_AUTOWIRING_CONTEXT);
@ -92,21 +92,21 @@ class FactoryBeanTests { @@ -92,21 +92,21 @@ class FactoryBeanTests {
}
@Test
void testAbstractFactoryBeanViaAnnotation() {
void abstractFactoryBeanViaAnnotation() {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(ABSTRACT_CONTEXT);
factory.getBeansWithAnnotation(Component.class);
}
@Test
void testAbstractFactoryBeanViaType() {
void abstractFactoryBeanViaType() {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(ABSTRACT_CONTEXT);
factory.getBeansOfType(AbstractFactoryBean.class);
}
@Test
void testCircularReferenceWithPostProcessor() {
void circularReferenceWithPostProcessor() {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(CIRCULAR_CONTEXT);

10
spring-beans/src/test/java/org/springframework/beans/factory/annotation/AnnotationBeanWiringInfoResolverTests.java

@ -30,27 +30,27 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException @@ -30,27 +30,27 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class AnnotationBeanWiringInfoResolverTests {
@Test
void testResolveWiringInfo() {
void resolveWiringInfo() {
assertThatIllegalArgumentException().isThrownBy(() ->
new AnnotationBeanWiringInfoResolver().resolveWiringInfo(null));
}
@Test
void testResolveWiringInfoWithAnInstanceOfANonAnnotatedClass() {
void resolveWiringInfoWithAnInstanceOfANonAnnotatedClass() {
AnnotationBeanWiringInfoResolver resolver = new AnnotationBeanWiringInfoResolver();
BeanWiringInfo info = resolver.resolveWiringInfo("java.lang.String is not @Configurable");
assertThat(info).as("Must be returning null for a non-@Configurable class instance").isNull();
}
@Test
void testResolveWiringInfoWithAnInstanceOfAnAnnotatedClass() {
void resolveWiringInfoWithAnInstanceOfAnAnnotatedClass() {
AnnotationBeanWiringInfoResolver resolver = new AnnotationBeanWiringInfoResolver();
BeanWiringInfo info = resolver.resolveWiringInfo(new Soap());
assertThat(info).as("Must *not* be returning null for a non-@Configurable class instance").isNotNull();
}
@Test
void testResolveWiringInfoWithAnInstanceOfAnAnnotatedClassWithAutowiringTurnedOffExplicitly() {
void resolveWiringInfoWithAnInstanceOfAnAnnotatedClassWithAutowiringTurnedOffExplicitly() {
AnnotationBeanWiringInfoResolver resolver = new AnnotationBeanWiringInfoResolver();
BeanWiringInfo info = resolver.resolveWiringInfo(new WirelessSoap());
assertThat(info).as("Must *not* be returning null for an @Configurable class instance even when autowiring is NO").isNotNull();
@ -59,7 +59,7 @@ class AnnotationBeanWiringInfoResolverTests { @@ -59,7 +59,7 @@ class AnnotationBeanWiringInfoResolverTests {
}
@Test
void testResolveWiringInfoWithAnInstanceOfAnAnnotatedClassWithAutowiringTurnedOffExplicitlyAndCustomBeanName() {
void resolveWiringInfoWithAnInstanceOfAnAnnotatedClassWithAutowiringTurnedOffExplicitlyAndCustomBeanName() {
AnnotationBeanWiringInfoResolver resolver = new AnnotationBeanWiringInfoResolver();
BeanWiringInfo info = resolver.resolveWiringInfo(new NamedWirelessSoap());
assertThat(info).as("Must *not* be returning null for an @Configurable class instance even when autowiring is NO").isNotNull();

2
spring-beans/src/test/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurerTests.java

@ -37,7 +37,7 @@ import static org.springframework.core.testfixture.io.ResourceTestUtils.qualifie @@ -37,7 +37,7 @@ import static org.springframework.core.testfixture.io.ResourceTestUtils.qualifie
class CustomAutowireConfigurerTests {
@Test
void testCustomResolver() {
void customResolver() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
qualifiedResource(CustomAutowireConfigurerTests.class, "context.xml"));

84
spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java

@ -80,7 +80,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -80,7 +80,7 @@ class InjectAnnotationBeanPostProcessorTests {
@Test
void testIncompleteBeanDefinition() {
void incompleteBeanDefinition() {
bf.registerBeanDefinition("testBean", new GenericBeanDefinition());
try {
bf.getBean("testBean");
@ -91,7 +91,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -91,7 +91,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testResourceInjection() {
void resourceInjection() {
RootBeanDefinition bd = new RootBeanDefinition(ResourceInjectionBean.class);
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
bf.registerBeanDefinition("annotatedBean", bd);
@ -108,7 +108,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -108,7 +108,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testExtendedResourceInjection() {
void extendedResourceInjection() {
RootBeanDefinition bd = new RootBeanDefinition(TypedExtendedResourceInjectionBean.class);
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
bf.registerBeanDefinition("annotatedBean", bd);
@ -135,7 +135,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -135,7 +135,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testExtendedResourceInjectionWithOverriding() {
void extendedResourceInjectionWithOverriding() {
RootBeanDefinition annotatedBd = new RootBeanDefinition(TypedExtendedResourceInjectionBean.class);
TestBean tb2 = new TestBean();
annotatedBd.getPropertyValues().add("testBean2", tb2);
@ -155,7 +155,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -155,7 +155,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testConstructorResourceInjection() {
void constructorResourceInjection() {
RootBeanDefinition bd = new RootBeanDefinition(ConstructorResourceInjectionBean.class);
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
bf.registerBeanDefinition("annotatedBean", bd);
@ -182,7 +182,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -182,7 +182,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testConstructorResourceInjectionWithMultipleCandidatesAsCollection() {
void constructorResourceInjectionWithMultipleCandidatesAsCollection() {
bf.registerBeanDefinition("annotatedBean",
new RootBeanDefinition(ConstructorsCollectionResourceInjectionBean.class));
TestBean tb = new TestBean();
@ -199,7 +199,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -199,7 +199,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testConstructorResourceInjectionWithMultipleCandidatesAndFallback() {
void constructorResourceInjectionWithMultipleCandidatesAndFallback() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ConstructorsResourceInjectionBean.class));
TestBean tb = new TestBean();
bf.registerSingleton("testBean", tb);
@ -210,7 +210,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -210,7 +210,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testConstructorInjectionWithMap() {
void constructorInjectionWithMap() {
RootBeanDefinition bd = new RootBeanDefinition(MapConstructorInjectionBean.class);
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
bf.registerBeanDefinition("annotatedBean", bd);
@ -235,7 +235,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -235,7 +235,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testFieldInjectionWithMap() {
void fieldInjectionWithMap() {
RootBeanDefinition bd = new RootBeanDefinition(MapFieldInjectionBean.class);
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
bf.registerBeanDefinition("annotatedBean", bd);
@ -260,7 +260,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -260,7 +260,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testMethodInjectionWithMap() {
void methodInjectionWithMap() {
RootBeanDefinition bd = new RootBeanDefinition(MapMethodInjectionBean.class);
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
bf.registerBeanDefinition("annotatedBean", bd);
@ -281,7 +281,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -281,7 +281,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testMethodInjectionWithMapAndMultipleMatches() {
void methodInjectionWithMapAndMultipleMatches() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(MapMethodInjectionBean.class));
bf.registerBeanDefinition("testBean1", new RootBeanDefinition(TestBean.class));
bf.registerBeanDefinition("testBean2", new RootBeanDefinition(TestBean.class));
@ -290,7 +290,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -290,7 +290,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testMethodInjectionWithMapAndMultipleMatchesButOnlyOneAutowireCandidate() {
void methodInjectionWithMapAndMultipleMatchesButOnlyOneAutowireCandidate() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(MapMethodInjectionBean.class));
bf.registerBeanDefinition("testBean1", new RootBeanDefinition(TestBean.class));
RootBeanDefinition rbd2 = new RootBeanDefinition(TestBean.class);
@ -306,7 +306,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -306,7 +306,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryInjection() {
void objectFactoryInjection() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryQualifierFieldInjectionBean.class));
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
bd.addQualifier(new AutowireCandidateQualifier(Qualifier.class, "testBean"));
@ -318,7 +318,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -318,7 +318,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryQualifierInjection() {
void objectFactoryQualifierInjection() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryQualifierFieldInjectionBean.class));
RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
bd.addQualifier(new AutowireCandidateQualifier(Qualifier.class, "testBean"));
@ -329,7 +329,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -329,7 +329,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryFieldInjectionIntoPrototypeBean() {
void objectFactoryFieldInjectionIntoPrototypeBean() {
RootBeanDefinition annotatedBeanDefinition = new RootBeanDefinition(ObjectFactoryQualifierFieldInjectionBean.class);
annotatedBeanDefinition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
bf.registerBeanDefinition("annotatedBean", annotatedBeanDefinition);
@ -346,7 +346,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -346,7 +346,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryMethodInjectionIntoPrototypeBean() {
void objectFactoryMethodInjectionIntoPrototypeBean() {
RootBeanDefinition annotatedBeanDefinition = new RootBeanDefinition(ObjectFactoryQualifierMethodInjectionBean.class);
annotatedBeanDefinition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
bf.registerBeanDefinition("annotatedBean", annotatedBeanDefinition);
@ -363,7 +363,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -363,7 +363,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryWithBeanField() throws Exception {
void objectFactoryWithBeanField() throws Exception {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryFieldInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
bf.setSerializationId("test");
@ -377,7 +377,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -377,7 +377,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryWithBeanFieldAgainstFrozen() throws Exception {
void objectFactoryWithBeanFieldAgainstFrozen() throws Exception {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryFieldInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
bf.setSerializationId("test");
@ -392,7 +392,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -392,7 +392,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryWithBeanMethod() throws Exception {
void objectFactoryWithBeanMethod() throws Exception {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryMethodInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
bf.setSerializationId("test");
@ -406,7 +406,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -406,7 +406,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryWithBeanMethodAgainstFrozen() throws Exception {
void objectFactoryWithBeanMethodAgainstFrozen() throws Exception {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryMethodInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
bf.setSerializationId("test");
@ -421,7 +421,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -421,7 +421,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryWithTypedListField() throws Exception {
void objectFactoryWithTypedListField() throws Exception {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryListFieldInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
bf.setSerializationId("test");
@ -433,7 +433,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -433,7 +433,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryWithTypedListMethod() throws Exception {
void objectFactoryWithTypedListMethod() throws Exception {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryListMethodInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
bf.setSerializationId("test");
@ -445,7 +445,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -445,7 +445,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryWithTypedMapField() throws Exception {
void objectFactoryWithTypedMapField() throws Exception {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryMapFieldInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
bf.setSerializationId("test");
@ -457,7 +457,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -457,7 +457,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testObjectFactoryWithTypedMapMethod() throws Exception {
void objectFactoryWithTypedMapMethod() throws Exception {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryMapMethodInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
bf.setSerializationId("test");
@ -474,7 +474,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -474,7 +474,7 @@ class InjectAnnotationBeanPostProcessorTests {
* specifically addressing SPR-4040.
*/
@Test
void testBeanAutowiredWithFactoryBean() {
void beanAutowiredWithFactoryBean() {
bf.registerBeanDefinition("factoryBeanDependentBean", new RootBeanDefinition(FactoryBeanDependentBean.class));
bf.registerSingleton("stringFactoryBean", new StringFactoryBean());
@ -487,7 +487,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -487,7 +487,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testNullableFieldInjectionWithBeanAvailable() {
void nullableFieldInjectionWithBeanAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(NullableFieldInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
@ -497,7 +497,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -497,7 +497,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testNullableFieldInjectionWithBeanNotAvailable() {
void nullableFieldInjectionWithBeanNotAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(NullableFieldInjectionBean.class));
NullableFieldInjectionBean bean = (NullableFieldInjectionBean) bf.getBean("annotatedBean");
@ -505,7 +505,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -505,7 +505,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testNullableMethodInjectionWithBeanAvailable() {
void nullableMethodInjectionWithBeanAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(NullableMethodInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
@ -515,7 +515,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -515,7 +515,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testNullableMethodInjectionWithBeanNotAvailable() {
void nullableMethodInjectionWithBeanNotAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(NullableMethodInjectionBean.class));
NullableMethodInjectionBean bean = (NullableMethodInjectionBean) bf.getBean("annotatedBean");
@ -523,7 +523,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -523,7 +523,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testOptionalFieldInjectionWithBeanAvailable() {
void optionalFieldInjectionWithBeanAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(OptionalFieldInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
@ -534,7 +534,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -534,7 +534,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testOptionalFieldInjectionWithBeanNotAvailable() {
void optionalFieldInjectionWithBeanNotAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(OptionalFieldInjectionBean.class));
OptionalFieldInjectionBean bean = (OptionalFieldInjectionBean) bf.getBean("annotatedBean");
@ -542,7 +542,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -542,7 +542,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testOptionalMethodInjectionWithBeanAvailable() {
void optionalMethodInjectionWithBeanAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(OptionalMethodInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
@ -553,7 +553,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -553,7 +553,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testOptionalMethodInjectionWithBeanNotAvailable() {
void optionalMethodInjectionWithBeanNotAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(OptionalMethodInjectionBean.class));
OptionalMethodInjectionBean bean = (OptionalMethodInjectionBean) bf.getBean("annotatedBean");
@ -561,7 +561,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -561,7 +561,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testOptionalListFieldInjectionWithBeanAvailable() {
void optionalListFieldInjectionWithBeanAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(OptionalListFieldInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
@ -572,7 +572,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -572,7 +572,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testOptionalListFieldInjectionWithBeanNotAvailable() {
void optionalListFieldInjectionWithBeanNotAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(OptionalListFieldInjectionBean.class));
OptionalListFieldInjectionBean bean = (OptionalListFieldInjectionBean) bf.getBean("annotatedBean");
@ -580,7 +580,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -580,7 +580,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testOptionalListMethodInjectionWithBeanAvailable() {
void optionalListMethodInjectionWithBeanAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(OptionalListMethodInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
@ -591,7 +591,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -591,7 +591,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testOptionalListMethodInjectionWithBeanNotAvailable() {
void optionalListMethodInjectionWithBeanNotAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(OptionalListMethodInjectionBean.class));
OptionalListMethodInjectionBean bean = (OptionalListMethodInjectionBean) bf.getBean("annotatedBean");
@ -599,7 +599,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -599,7 +599,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testProviderOfOptionalFieldInjectionWithBeanAvailable() {
void providerOfOptionalFieldInjectionWithBeanAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ProviderOfOptionalFieldInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
@ -610,7 +610,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -610,7 +610,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testProviderOfOptionalFieldInjectionWithBeanNotAvailable() {
void providerOfOptionalFieldInjectionWithBeanNotAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ProviderOfOptionalFieldInjectionBean.class));
ProviderOfOptionalFieldInjectionBean bean = (ProviderOfOptionalFieldInjectionBean) bf.getBean("annotatedBean");
@ -618,7 +618,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -618,7 +618,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testProviderOfOptionalMethodInjectionWithBeanAvailable() {
void providerOfOptionalMethodInjectionWithBeanAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ProviderOfOptionalMethodInjectionBean.class));
bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
@ -629,7 +629,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -629,7 +629,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testProviderOfOptionalMethodInjectionWithBeanNotAvailable() {
void providerOfOptionalMethodInjectionWithBeanNotAvailable() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ProviderOfOptionalMethodInjectionBean.class));
ProviderOfOptionalMethodInjectionBean bean = (ProviderOfOptionalMethodInjectionBean) bf.getBean("annotatedBean");
@ -637,7 +637,7 @@ class InjectAnnotationBeanPostProcessorTests { @@ -637,7 +637,7 @@ class InjectAnnotationBeanPostProcessorTests {
}
@Test
void testAnnotatedDefaultConstructor() {
void annotatedDefaultConstructor() {
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(AnnotatedDefaultConstructorBean.class));
assertThat(bf.getBean("annotatedBean")).isNotNull();

20
spring-beans/src/test/java/org/springframework/beans/factory/annotation/LookupAnnotationTests.java

@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
class LookupAnnotationTests {
@Test
void testWithoutConstructorArg() {
void withoutConstructorArg() {
DefaultListableBeanFactory beanFactory = configureBeanFactory();
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
Object expected = bean.get();
@ -42,7 +42,7 @@ class LookupAnnotationTests { @@ -42,7 +42,7 @@ class LookupAnnotationTests {
}
@Test
void testWithOverloadedArg() {
void withOverloadedArg() {
DefaultListableBeanFactory beanFactory = configureBeanFactory();
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
TestBean expected = bean.get("haha");
@ -52,7 +52,7 @@ class LookupAnnotationTests { @@ -52,7 +52,7 @@ class LookupAnnotationTests {
}
@Test
void testWithOneConstructorArg() {
void withOneConstructorArg() {
DefaultListableBeanFactory beanFactory = configureBeanFactory();
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
TestBean expected = bean.getOneArgument("haha");
@ -62,7 +62,7 @@ class LookupAnnotationTests { @@ -62,7 +62,7 @@ class LookupAnnotationTests {
}
@Test
void testWithTwoConstructorArg() {
void withTwoConstructorArg() {
DefaultListableBeanFactory beanFactory = configureBeanFactory();
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
TestBean expected = bean.getTwoArguments("haha", 72);
@ -73,7 +73,7 @@ class LookupAnnotationTests { @@ -73,7 +73,7 @@ class LookupAnnotationTests {
}
@Test
void testWithThreeArgsShouldFail() {
void withThreeArgsShouldFail() {
DefaultListableBeanFactory beanFactory = configureBeanFactory();
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
assertThatExceptionOfType(AbstractMethodError.class).as("TestBean has no three arg constructor").isThrownBy(() ->
@ -82,7 +82,7 @@ class LookupAnnotationTests { @@ -82,7 +82,7 @@ class LookupAnnotationTests {
}
@Test
void testWithEarlyInjection() {
void withEarlyInjection() {
DefaultListableBeanFactory beanFactory = configureBeanFactory();
AbstractBean bean = beanFactory.getBean("beanConsumer", BeanConsumer.class).abstractBean;
Object expected = bean.get();
@ -91,7 +91,7 @@ class LookupAnnotationTests { @@ -91,7 +91,7 @@ class LookupAnnotationTests {
}
@Test // gh-25806
public void testWithNullBean() {
void withNullBean() {
RootBeanDefinition tbd = new RootBeanDefinition(TestBean.class, () -> null);
tbd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
DefaultListableBeanFactory beanFactory = configureBeanFactory(tbd);
@ -103,7 +103,7 @@ class LookupAnnotationTests { @@ -103,7 +103,7 @@ class LookupAnnotationTests {
}
@Test
void testWithGenericBean() {
void withGenericBean() {
DefaultListableBeanFactory beanFactory = configureBeanFactory();
beanFactory.registerBeanDefinition("numberBean", new RootBeanDefinition(NumberBean.class));
beanFactory.registerBeanDefinition("doubleStore", new RootBeanDefinition(DoubleStore.class));
@ -115,7 +115,7 @@ class LookupAnnotationTests { @@ -115,7 +115,7 @@ class LookupAnnotationTests {
}
@Test
void testSingletonWithoutMetadataCaching() {
void singletonWithoutMetadataCaching() {
DefaultListableBeanFactory beanFactory = configureBeanFactory();
beanFactory.setCacheBeanMetadata(false);
@ -129,7 +129,7 @@ class LookupAnnotationTests { @@ -129,7 +129,7 @@ class LookupAnnotationTests {
}
@Test
void testPrototypeWithoutMetadataCaching() {
void prototypeWithoutMetadataCaching() {
DefaultListableBeanFactory beanFactory = configureBeanFactory();
beanFactory.setCacheBeanMetadata(false);

4
spring-beans/src/test/java/org/springframework/beans/factory/aot/DefaultBeanRegistrationCodeFragmentsTests.java

@ -67,7 +67,7 @@ class DefaultBeanRegistrationCodeFragmentsTests { @@ -67,7 +67,7 @@ class DefaultBeanRegistrationCodeFragmentsTests {
private final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
@Test
public void getTargetWithInstanceSupplier() {
void getTargetWithInstanceSupplier() {
RootBeanDefinition beanDefinition = new RootBeanDefinition(SimpleBean.class);
beanDefinition.setInstanceSupplier(SimpleBean::new);
RegisteredBean registeredBean = registerTestBean(beanDefinition);
@ -78,7 +78,7 @@ class DefaultBeanRegistrationCodeFragmentsTests { @@ -78,7 +78,7 @@ class DefaultBeanRegistrationCodeFragmentsTests {
}
@Test
public void getTargetWithInstanceSupplierAndResourceDescription() {
void getTargetWithInstanceSupplierAndResourceDescription() {
RootBeanDefinition beanDefinition = new RootBeanDefinition(SimpleBean.class);
beanDefinition.setInstanceSupplier(SimpleBean::new);
beanDefinition.setResourceDescription("my test resource");

6
spring-beans/src/test/java/org/springframework/beans/factory/config/CustomEditorConfigurerTests.java

@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class CustomEditorConfigurerTests {
@Test
void testCustomEditorConfigurerWithPropertyEditorRegistrar() throws ParseException {
void customEditorConfigurerWithPropertyEditorRegistrar() throws ParseException {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CustomEditorConfigurer cec = new CustomEditorConfigurer();
final DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMAN);
@ -70,7 +70,7 @@ class CustomEditorConfigurerTests { @@ -70,7 +70,7 @@ class CustomEditorConfigurerTests {
}
@Test
void testCustomEditorConfigurerWithEditorAsClass() throws ParseException {
void customEditorConfigurerWithEditorAsClass() throws ParseException {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CustomEditorConfigurer cec = new CustomEditorConfigurer();
Map<Class<?>, Class<? extends PropertyEditor>> editors = new HashMap<>();
@ -90,7 +90,7 @@ class CustomEditorConfigurerTests { @@ -90,7 +90,7 @@ class CustomEditorConfigurerTests {
}
@Test
void testCustomEditorConfigurerWithRequiredTypeArray() {
void customEditorConfigurerWithRequiredTypeArray() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CustomEditorConfigurer cec = new CustomEditorConfigurer();
Map<Class<?>, Class<? extends PropertyEditor>> editors = new HashMap<>();

14
spring-beans/src/test/java/org/springframework/beans/factory/config/CustomScopeConfigurerTests.java

@ -43,13 +43,13 @@ class CustomScopeConfigurerTests { @@ -43,13 +43,13 @@ class CustomScopeConfigurerTests {
@Test
void testWithNoScopes() {
void withNoScopes() {
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
figurer.postProcessBeanFactory(factory);
}
@Test
void testSunnyDayWithBonaFideScopeInstance() {
void sunnyDayWithBonaFideScopeInstance() {
Scope scope = mock();
factory.registerScope(FOO_SCOPE, scope);
Map<String, Object> scopes = new HashMap<>();
@ -60,7 +60,7 @@ class CustomScopeConfigurerTests { @@ -60,7 +60,7 @@ class CustomScopeConfigurerTests {
}
@Test
void testSunnyDayWithBonaFideScopeClass() {
void sunnyDayWithBonaFideScopeClass() {
Map<String, Object> scopes = new HashMap<>();
scopes.put(FOO_SCOPE, NoOpScope.class);
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
@ -70,7 +70,7 @@ class CustomScopeConfigurerTests { @@ -70,7 +70,7 @@ class CustomScopeConfigurerTests {
}
@Test
void testSunnyDayWithBonaFideScopeClassName() {
void sunnyDayWithBonaFideScopeClassName() {
Map<String, Object> scopes = new HashMap<>();
scopes.put(FOO_SCOPE, NoOpScope.class.getName());
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
@ -80,7 +80,7 @@ class CustomScopeConfigurerTests { @@ -80,7 +80,7 @@ class CustomScopeConfigurerTests {
}
@Test
void testWhereScopeMapHasNullScopeValueInEntrySet() {
void whereScopeMapHasNullScopeValueInEntrySet() {
Map<String, Object> scopes = new HashMap<>();
scopes.put(FOO_SCOPE, null);
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
@ -90,7 +90,7 @@ class CustomScopeConfigurerTests { @@ -90,7 +90,7 @@ class CustomScopeConfigurerTests {
}
@Test
void testWhereScopeMapHasNonScopeInstanceInEntrySet() {
void whereScopeMapHasNonScopeInstanceInEntrySet() {
Map<String, Object> scopes = new HashMap<>();
scopes.put(FOO_SCOPE, this); // <-- not a valid value...
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
@ -101,7 +101,7 @@ class CustomScopeConfigurerTests { @@ -101,7 +101,7 @@ class CustomScopeConfigurerTests {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
void testWhereScopeMapHasNonStringTypedScopeNameInKeySet() {
void whereScopeMapHasNonStringTypedScopeNameInKeySet() {
Map scopes = new HashMap();
scopes.put(this, new NoOpScope()); // <-- not a valid value (the key)...
CustomScopeConfigurer figurer = new CustomScopeConfigurer();

2
spring-beans/src/test/java/org/springframework/beans/factory/config/DeprecatedBeanWarnerTests.java

@ -35,7 +35,7 @@ class DeprecatedBeanWarnerTests { @@ -35,7 +35,7 @@ class DeprecatedBeanWarnerTests {
@Test
@SuppressWarnings("deprecation")
public void postProcess() {
void postProcess() {
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
BeanDefinition def = new RootBeanDefinition(MyDeprecatedBean.class);
String beanName = "deprecated";

20
spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests.java

@ -37,7 +37,7 @@ import static org.springframework.core.testfixture.io.ResourceTestUtils.qualifie @@ -37,7 +37,7 @@ import static org.springframework.core.testfixture.io.ResourceTestUtils.qualifie
class FieldRetrievingFactoryBeanTests {
@Test
void testStaticField() throws Exception {
void staticField() throws Exception {
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
fr.setStaticField("java.sql.Connection.TRANSACTION_SERIALIZABLE");
fr.afterPropertiesSet();
@ -45,7 +45,7 @@ class FieldRetrievingFactoryBeanTests { @@ -45,7 +45,7 @@ class FieldRetrievingFactoryBeanTests {
}
@Test
void testStaticFieldWithWhitespace() throws Exception {
void staticFieldWithWhitespace() throws Exception {
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
fr.setStaticField(" java.sql.Connection.TRANSACTION_SERIALIZABLE ");
fr.afterPropertiesSet();
@ -53,7 +53,7 @@ class FieldRetrievingFactoryBeanTests { @@ -53,7 +53,7 @@ class FieldRetrievingFactoryBeanTests {
}
@Test
void testStaticFieldViaClassAndFieldName() throws Exception {
void staticFieldViaClassAndFieldName() throws Exception {
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
fr.setTargetClass(Connection.class);
fr.setTargetField("TRANSACTION_SERIALIZABLE");
@ -62,7 +62,7 @@ class FieldRetrievingFactoryBeanTests { @@ -62,7 +62,7 @@ class FieldRetrievingFactoryBeanTests {
}
@Test
void testNonStaticField() throws Exception {
void nonStaticField() throws Exception {
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
PublicFieldHolder target = new PublicFieldHolder();
fr.setTargetObject(target);
@ -72,7 +72,7 @@ class FieldRetrievingFactoryBeanTests { @@ -72,7 +72,7 @@ class FieldRetrievingFactoryBeanTests {
}
@Test
void testNothingButBeanName() throws Exception {
void nothingButBeanName() throws Exception {
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
fr.setBeanName("java.sql.Connection.TRANSACTION_SERIALIZABLE");
fr.afterPropertiesSet();
@ -80,7 +80,7 @@ class FieldRetrievingFactoryBeanTests { @@ -80,7 +80,7 @@ class FieldRetrievingFactoryBeanTests {
}
@Test
void testJustTargetField() throws Exception {
void justTargetField() throws Exception {
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
fr.setTargetField("TRANSACTION_SERIALIZABLE");
try {
@ -91,7 +91,7 @@ class FieldRetrievingFactoryBeanTests { @@ -91,7 +91,7 @@ class FieldRetrievingFactoryBeanTests {
}
@Test
void testJustTargetClass() throws Exception {
void justTargetClass() throws Exception {
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
fr.setTargetClass(Connection.class);
try {
@ -102,7 +102,7 @@ class FieldRetrievingFactoryBeanTests { @@ -102,7 +102,7 @@ class FieldRetrievingFactoryBeanTests {
}
@Test
void testJustTargetObject() throws Exception {
void justTargetObject() throws Exception {
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
fr.setTargetObject(new PublicFieldHolder());
try {
@ -113,7 +113,7 @@ class FieldRetrievingFactoryBeanTests { @@ -113,7 +113,7 @@ class FieldRetrievingFactoryBeanTests {
}
@Test
void testWithConstantOnClassWithPackageLevelVisibility() throws Exception {
void withConstantOnClassWithPackageLevelVisibility() throws Exception {
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
fr.setBeanName("org.springframework.beans.testfixture.beans.PackageLevelVisibleBean.CONSTANT");
fr.afterPropertiesSet();
@ -121,7 +121,7 @@ class FieldRetrievingFactoryBeanTests { @@ -121,7 +121,7 @@ class FieldRetrievingFactoryBeanTests {
}
@Test
void testBeanNameSyntaxWithBeanFactory() {
void beanNameSyntaxWithBeanFactory() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
qualifiedResource(FieldRetrievingFactoryBeanTests.class, "context.xml"));

14
spring-beans/src/test/java/org/springframework/beans/factory/config/MethodInvokingFactoryBeanTests.java

@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException @@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class MethodInvokingFactoryBeanTests {
@Test
void testParameterValidation() throws Exception {
void parameterValidation() throws Exception {
// assert that only static OR non-static are set, but not both or none
MethodInvokingFactoryBean mcfb = new MethodInvokingFactoryBean();
@ -91,7 +91,7 @@ class MethodInvokingFactoryBeanTests { @@ -91,7 +91,7 @@ class MethodInvokingFactoryBeanTests {
}
@Test
void testGetObjectType() throws Exception {
void getObjectType() throws Exception {
TestClass1 tc1 = new TestClass1();
MethodInvokingFactoryBean mcfb = new MethodInvokingFactoryBean();
mcfb = new MethodInvokingFactoryBean();
@ -127,7 +127,7 @@ class MethodInvokingFactoryBeanTests { @@ -127,7 +127,7 @@ class MethodInvokingFactoryBeanTests {
}
@Test
void testGetObject() throws Exception {
void getObject() throws Exception {
// singleton, non-static
TestClass1 tc1 = new TestClass1();
MethodInvokingFactoryBean mcfb = new MethodInvokingFactoryBean();
@ -190,7 +190,7 @@ class MethodInvokingFactoryBeanTests { @@ -190,7 +190,7 @@ class MethodInvokingFactoryBeanTests {
}
@Test
void testArgumentConversion() throws Exception {
void argumentConversion() throws Exception {
MethodInvokingFactoryBean mcfb = new MethodInvokingFactoryBean();
mcfb.setTargetClass(TestClass1.class);
mcfb.setTargetMethod("supertypes");
@ -224,7 +224,7 @@ class MethodInvokingFactoryBeanTests { @@ -224,7 +224,7 @@ class MethodInvokingFactoryBeanTests {
}
@Test
void testInvokeWithNullArgument() throws Exception {
void invokeWithNullArgument() throws Exception {
MethodInvoker methodInvoker = new MethodInvoker();
methodInvoker.setTargetClass(TestClass1.class);
methodInvoker.setTargetMethod("nullArgument");
@ -234,7 +234,7 @@ class MethodInvokingFactoryBeanTests { @@ -234,7 +234,7 @@ class MethodInvokingFactoryBeanTests {
}
@Test
void testInvokeWithIntArgument() throws Exception {
void invokeWithIntArgument() throws Exception {
ArgumentConvertingMethodInvoker methodInvoker = new ArgumentConvertingMethodInvoker();
methodInvoker.setTargetClass(TestClass1.class);
methodInvoker.setTargetMethod("intArgument");
@ -251,7 +251,7 @@ class MethodInvokingFactoryBeanTests { @@ -251,7 +251,7 @@ class MethodInvokingFactoryBeanTests {
}
@Test
void testInvokeWithIntArguments() throws Exception {
void invokeWithIntArguments() throws Exception {
MethodInvokingBean methodInvoker = new MethodInvokingBean();
methodInvoker.setTargetClass(TestClass1.class);
methodInvoker.setTargetMethod("intArguments");

18
spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java

@ -61,7 +61,7 @@ class ObjectFactoryCreatingFactoryBeanTests { @@ -61,7 +61,7 @@ class ObjectFactoryCreatingFactoryBeanTests {
@Test
void testFactoryOperation() {
void factoryOperation() {
FactoryTestBean testBean = beanFactory.getBean("factoryTestBean", FactoryTestBean.class);
ObjectFactory<?> objectFactory = testBean.getObjectFactory();
@ -71,7 +71,7 @@ class ObjectFactoryCreatingFactoryBeanTests { @@ -71,7 +71,7 @@ class ObjectFactoryCreatingFactoryBeanTests {
}
@Test
void testFactorySerialization() throws Exception {
void factorySerialization() throws Exception {
FactoryTestBean testBean = beanFactory.getBean("factoryTestBean", FactoryTestBean.class);
ObjectFactory<?> objectFactory = testBean.getObjectFactory();
@ -83,7 +83,7 @@ class ObjectFactoryCreatingFactoryBeanTests { @@ -83,7 +83,7 @@ class ObjectFactoryCreatingFactoryBeanTests {
}
@Test
void testProviderOperation() {
void providerOperation() {
ProviderTestBean testBean = beanFactory.getBean("providerTestBean", ProviderTestBean.class);
Provider<?> provider = testBean.getProvider();
@ -93,7 +93,7 @@ class ObjectFactoryCreatingFactoryBeanTests { @@ -93,7 +93,7 @@ class ObjectFactoryCreatingFactoryBeanTests {
}
@Test
void testProviderSerialization() throws Exception {
void providerSerialization() throws Exception {
ProviderTestBean testBean = beanFactory.getBean("providerTestBean", ProviderTestBean.class);
Provider<?> provider = testBean.getProvider();
@ -105,7 +105,7 @@ class ObjectFactoryCreatingFactoryBeanTests { @@ -105,7 +105,7 @@ class ObjectFactoryCreatingFactoryBeanTests {
}
@Test
void testDoesNotComplainWhenTargetBeanNameRefersToSingleton() throws Exception {
void doesNotComplainWhenTargetBeanNameRefersToSingleton() throws Exception {
final String targetBeanName = "singleton";
final String expectedSingleton = "Alicia Keys";
@ -122,14 +122,14 @@ class ObjectFactoryCreatingFactoryBeanTests { @@ -122,14 +122,14 @@ class ObjectFactoryCreatingFactoryBeanTests {
}
@Test
void testWhenTargetBeanNameIsNull() {
void whenTargetBeanNameIsNull() {
assertThatIllegalArgumentException().as(
"'targetBeanName' property not set").isThrownBy(
new ObjectFactoryCreatingFactoryBean()::afterPropertiesSet);
}
@Test
void testWhenTargetBeanNameIsEmptyString() {
void whenTargetBeanNameIsEmptyString() {
ObjectFactoryCreatingFactoryBean factory = new ObjectFactoryCreatingFactoryBean();
factory.setTargetBeanName("");
assertThatIllegalArgumentException().as(
@ -138,7 +138,7 @@ class ObjectFactoryCreatingFactoryBeanTests { @@ -138,7 +138,7 @@ class ObjectFactoryCreatingFactoryBeanTests {
}
@Test
void testWhenTargetBeanNameIsWhitespacedString() {
void whenTargetBeanNameIsWhitespacedString() {
ObjectFactoryCreatingFactoryBean factory = new ObjectFactoryCreatingFactoryBean();
factory.setTargetBeanName(" \t");
assertThatIllegalArgumentException().as(
@ -147,7 +147,7 @@ class ObjectFactoryCreatingFactoryBeanTests { @@ -147,7 +147,7 @@ class ObjectFactoryCreatingFactoryBeanTests {
}
@Test
void testEnsureOFBFBReportsThatItActuallyCreatesObjectFactoryInstances() {
void ensureOFBFBReportsThatItActuallyCreatesObjectFactoryInstances() {
assertThat(new ObjectFactoryCreatingFactoryBean().getObjectType()).as("Must be reporting that it creates ObjectFactory instances (as per class contract).").isEqualTo(ObjectFactory.class);
}

14
spring-beans/src/test/java/org/springframework/beans/factory/config/PropertiesFactoryBeanTests.java

@ -39,7 +39,7 @@ class PropertiesFactoryBeanTests { @@ -39,7 +39,7 @@ class PropertiesFactoryBeanTests {
private static final Resource TEST_PROPS_XML = qualifiedResource(CLASS, "test.properties.xml");
@Test
void testWithPropertiesFile() throws Exception {
void withPropertiesFile() throws Exception {
PropertiesFactoryBean pfb = new PropertiesFactoryBean();
pfb.setLocation(TEST_PROPS);
pfb.afterPropertiesSet();
@ -48,7 +48,7 @@ class PropertiesFactoryBeanTests { @@ -48,7 +48,7 @@ class PropertiesFactoryBeanTests {
}
@Test
void testWithPropertiesXmlFile() throws Exception {
void withPropertiesXmlFile() throws Exception {
PropertiesFactoryBean pfb = new PropertiesFactoryBean();
pfb.setLocation(TEST_PROPS_XML);
pfb.afterPropertiesSet();
@ -57,7 +57,7 @@ class PropertiesFactoryBeanTests { @@ -57,7 +57,7 @@ class PropertiesFactoryBeanTests {
}
@Test
void testWithLocalProperties() throws Exception {
void withLocalProperties() throws Exception {
PropertiesFactoryBean pfb = new PropertiesFactoryBean();
Properties localProps = new Properties();
localProps.setProperty("key2", "value2");
@ -68,7 +68,7 @@ class PropertiesFactoryBeanTests { @@ -68,7 +68,7 @@ class PropertiesFactoryBeanTests {
}
@Test
void testWithPropertiesFileAndLocalProperties() throws Exception {
void withPropertiesFileAndLocalProperties() throws Exception {
PropertiesFactoryBean pfb = new PropertiesFactoryBean();
pfb.setLocation(TEST_PROPS);
Properties localProps = new Properties();
@ -82,7 +82,7 @@ class PropertiesFactoryBeanTests { @@ -82,7 +82,7 @@ class PropertiesFactoryBeanTests {
}
@Test
void testWithPropertiesFileAndMultipleLocalProperties() throws Exception {
void withPropertiesFileAndMultipleLocalProperties() throws Exception {
PropertiesFactoryBean pfb = new PropertiesFactoryBean();
pfb.setLocation(TEST_PROPS);
@ -111,7 +111,7 @@ class PropertiesFactoryBeanTests { @@ -111,7 +111,7 @@ class PropertiesFactoryBeanTests {
}
@Test
void testWithPropertiesFileAndLocalPropertiesAndLocalOverride() throws Exception {
void withPropertiesFileAndLocalPropertiesAndLocalOverride() throws Exception {
PropertiesFactoryBean pfb = new PropertiesFactoryBean();
pfb.setLocation(TEST_PROPS);
Properties localProps = new Properties();
@ -126,7 +126,7 @@ class PropertiesFactoryBeanTests { @@ -126,7 +126,7 @@ class PropertiesFactoryBeanTests {
}
@Test
void testWithPrototype() throws Exception {
void withPrototype() throws Exception {
PropertiesFactoryBean pfb = new PropertiesFactoryBean();
pfb.setSingleton(false);
pfb.setLocation(TEST_PROPS);

12
spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java

@ -40,7 +40,7 @@ class PropertyPathFactoryBeanTests { @@ -40,7 +40,7 @@ class PropertyPathFactoryBeanTests {
@Test
void testPropertyPathFactoryBeanWithSingletonResult() {
void propertyPathFactoryBeanWithSingletonResult() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
assertThat(xbf.getBean("propertyPath1")).isEqualTo(12);
@ -55,7 +55,7 @@ class PropertyPathFactoryBeanTests { @@ -55,7 +55,7 @@ class PropertyPathFactoryBeanTests {
}
@Test
void testPropertyPathFactoryBeanWithPrototypeResult() {
void propertyPathFactoryBeanWithPrototypeResult() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
assertThat(xbf.getType("tb.spouse")).isNull();
@ -75,7 +75,7 @@ class PropertyPathFactoryBeanTests { @@ -75,7 +75,7 @@ class PropertyPathFactoryBeanTests {
}
@Test
void testPropertyPathFactoryBeanWithNullResult() {
void propertyPathFactoryBeanWithNullResult() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
assertThat(xbf.getType("tb.spouse.spouse")).isNull();
@ -83,7 +83,7 @@ class PropertyPathFactoryBeanTests { @@ -83,7 +83,7 @@ class PropertyPathFactoryBeanTests {
}
@Test
void testPropertyPathFactoryBeanAsInnerBean() {
void propertyPathFactoryBeanAsInnerBean() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
TestBean spouse = (TestBean) xbf.getBean("otb.spouse");
@ -94,14 +94,14 @@ class PropertyPathFactoryBeanTests { @@ -94,14 +94,14 @@ class PropertyPathFactoryBeanTests {
}
@Test
void testPropertyPathFactoryBeanAsNullReference() {
void propertyPathFactoryBeanAsNullReference() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
assertThat(xbf.getBean("tbWithNullReference", TestBean.class).getSpouse()).isNull();
}
@Test
void testPropertyPathFactoryBeanAsInnerNull() {
void propertyPathFactoryBeanAsInnerNull() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
assertThat(xbf.getBean("tbWithInnerNull", TestBean.class).getSpouse()).isNull();

62
spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java

@ -75,7 +75,7 @@ class PropertyResourceConfigurerTests { @@ -75,7 +75,7 @@ class PropertyResourceConfigurerTests {
@Test
void testPropertyOverrideConfigurer() {
void propertyOverrideConfigurer() {
BeanDefinition def1 = BeanDefinitionBuilder.genericBeanDefinition(TestBean.class).getBeanDefinition();
factory.registerBeanDefinition("tb1", def1);
@ -115,7 +115,7 @@ class PropertyResourceConfigurerTests { @@ -115,7 +115,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithNestedProperty() {
void propertyOverrideConfigurerWithNestedProperty() {
BeanDefinition def = BeanDefinitionBuilder.genericBeanDefinition(IndexedTestBean.class).getBeanDefinition();
factory.registerBeanDefinition("tb", def);
@ -133,7 +133,7 @@ class PropertyResourceConfigurerTests { @@ -133,7 +133,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithNestedPropertyAndDotInBeanName() {
void propertyOverrideConfigurerWithNestedPropertyAndDotInBeanName() {
BeanDefinition def = BeanDefinitionBuilder.genericBeanDefinition(IndexedTestBean.class).getBeanDefinition();
factory.registerBeanDefinition("my.tb", def);
@ -152,7 +152,7 @@ class PropertyResourceConfigurerTests { @@ -152,7 +152,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithNestedMapPropertyAndDotInMapKey() {
void propertyOverrideConfigurerWithNestedMapPropertyAndDotInMapKey() {
BeanDefinition def = BeanDefinitionBuilder.genericBeanDefinition(IndexedTestBean.class).getBeanDefinition();
factory.registerBeanDefinition("tb", def);
@ -170,7 +170,7 @@ class PropertyResourceConfigurerTests { @@ -170,7 +170,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithHeldProperties() {
void propertyOverrideConfigurerWithHeldProperties() {
BeanDefinition def = BeanDefinitionBuilder.genericBeanDefinition(PropertiesHolder.class).getBeanDefinition();
factory.registerBeanDefinition("tb", def);
@ -186,7 +186,7 @@ class PropertyResourceConfigurerTests { @@ -186,7 +186,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithPropertiesFile() {
void propertyOverrideConfigurerWithPropertiesFile() {
BeanDefinition def = BeanDefinitionBuilder.genericBeanDefinition(IndexedTestBean.class).getBeanDefinition();
factory.registerBeanDefinition("tb", def);
@ -200,7 +200,7 @@ class PropertyResourceConfigurerTests { @@ -200,7 +200,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithInvalidPropertiesFile() {
void propertyOverrideConfigurerWithInvalidPropertiesFile() {
BeanDefinition def = BeanDefinitionBuilder.genericBeanDefinition(IndexedTestBean.class).getBeanDefinition();
factory.registerBeanDefinition("tb", def);
@ -215,7 +215,7 @@ class PropertyResourceConfigurerTests { @@ -215,7 +215,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithPropertiesXmlFile() {
void propertyOverrideConfigurerWithPropertiesXmlFile() {
BeanDefinition def = BeanDefinitionBuilder.genericBeanDefinition(IndexedTestBean.class).getBeanDefinition();
factory.registerBeanDefinition("tb", def);
@ -229,7 +229,7 @@ class PropertyResourceConfigurerTests { @@ -229,7 +229,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithConvertProperties() {
void propertyOverrideConfigurerWithConvertProperties() {
BeanDefinition def = BeanDefinitionBuilder.genericBeanDefinition(IndexedTestBean.class).getBeanDefinition();
factory.registerBeanDefinition("tb", def);
@ -246,7 +246,7 @@ class PropertyResourceConfigurerTests { @@ -246,7 +246,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithInvalidKey() {
void propertyOverrideConfigurerWithInvalidKey() {
factory.registerBeanDefinition("tb1", genericBeanDefinition(TestBean.class).getBeanDefinition());
factory.registerBeanDefinition("tb2", genericBeanDefinition(TestBean.class).getBeanDefinition());
@ -281,7 +281,7 @@ class PropertyResourceConfigurerTests { @@ -281,7 +281,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyOverrideConfigurerWithIgnoreInvalidKeys() {
void propertyOverrideConfigurerWithIgnoreInvalidKeys() {
factory.registerBeanDefinition("tb1", genericBeanDefinition(TestBean.class).getBeanDefinition());
factory.registerBeanDefinition("tb2", genericBeanDefinition(TestBean.class).getBeanDefinition());
@ -314,12 +314,12 @@ class PropertyResourceConfigurerTests { @@ -314,12 +314,12 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurer() {
void propertyPlaceholderConfigurer() {
doTestPropertyPlaceholderConfigurer(false);
}
@Test
void testPropertyPlaceholderConfigurerWithParentChildSeparation() {
void propertyPlaceholderConfigurerWithParentChildSeparation() {
doTestPropertyPlaceholderConfigurer(true);
}
@ -425,7 +425,7 @@ class PropertyResourceConfigurerTests { @@ -425,7 +425,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithSystemPropertyFallback() {
void propertyPlaceholderConfigurerWithSystemPropertyFallback() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("country", "${os.name}").getBeanDefinition());
@ -437,7 +437,7 @@ class PropertyResourceConfigurerTests { @@ -437,7 +437,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithSystemPropertyNotUsed() {
void propertyPlaceholderConfigurerWithSystemPropertyNotUsed() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("country", "${os.name}").getBeanDefinition());
@ -452,7 +452,7 @@ class PropertyResourceConfigurerTests { @@ -452,7 +452,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithOverridingSystemProperty() {
void propertyPlaceholderConfigurerWithOverridingSystemProperty() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("country", "${os.name}").getBeanDefinition());
@ -468,7 +468,7 @@ class PropertyResourceConfigurerTests { @@ -468,7 +468,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithUnresolvableSystemProperty() {
void propertyPlaceholderConfigurerWithUnresolvableSystemProperty() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("touchy", "${user.dir}").getBeanDefinition());
PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
@ -479,7 +479,7 @@ class PropertyResourceConfigurerTests { @@ -479,7 +479,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithUnresolvablePlaceholder() {
void propertyPlaceholderConfigurerWithUnresolvablePlaceholder() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("name", "${ref}").getBeanDefinition());
PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
@ -489,7 +489,7 @@ class PropertyResourceConfigurerTests { @@ -489,7 +489,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithIgnoreUnresolvablePlaceholder() {
void propertyPlaceholderConfigurerWithIgnoreUnresolvablePlaceholder() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("name", "${ref}").getBeanDefinition());
@ -502,7 +502,7 @@ class PropertyResourceConfigurerTests { @@ -502,7 +502,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithEmptyStringAsNull() {
void propertyPlaceholderConfigurerWithEmptyStringAsNull() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("name", "").getBeanDefinition());
@ -515,7 +515,7 @@ class PropertyResourceConfigurerTests { @@ -515,7 +515,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithEmptyStringInPlaceholderAsNull() {
void propertyPlaceholderConfigurerWithEmptyStringInPlaceholderAsNull() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("name", "${ref}").getBeanDefinition());
@ -531,7 +531,7 @@ class PropertyResourceConfigurerTests { @@ -531,7 +531,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithNestedPlaceholderInKey() {
void propertyPlaceholderConfigurerWithNestedPlaceholderInKey() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("name", "${my${key}key}").getBeanDefinition());
@ -547,7 +547,7 @@ class PropertyResourceConfigurerTests { @@ -547,7 +547,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithPlaceholderInAlias() {
void propertyPlaceholderConfigurerWithPlaceholderInAlias() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class).getBeanDefinition());
factory.registerAlias("tb", "${alias}");
@ -563,7 +563,7 @@ class PropertyResourceConfigurerTests { @@ -563,7 +563,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithSelfReferencingPlaceholderInAlias() {
void propertyPlaceholderConfigurerWithSelfReferencingPlaceholderInAlias() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class).getBeanDefinition());
factory.registerAlias("tb", "${alias}");
@ -579,7 +579,7 @@ class PropertyResourceConfigurerTests { @@ -579,7 +579,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithCircularReference() {
void propertyPlaceholderConfigurerWithCircularReference() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("age", "${age}")
.addPropertyValue("name", "name${var}")
@ -596,7 +596,7 @@ class PropertyResourceConfigurerTests { @@ -596,7 +596,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithDefaultProperties() {
void propertyPlaceholderConfigurerWithDefaultProperties() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("touchy", "${test}").getBeanDefinition());
@ -611,7 +611,7 @@ class PropertyResourceConfigurerTests { @@ -611,7 +611,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithInlineDefault() {
void propertyPlaceholderConfigurerWithInlineDefault() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("touchy", "${test:mytest}").getBeanDefinition());
@ -623,7 +623,7 @@ class PropertyResourceConfigurerTests { @@ -623,7 +623,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPropertyPlaceholderConfigurerWithAliases() {
void propertyPlaceholderConfigurerWithAliases() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("touchy", "${test}").getBeanDefinition());
@ -647,7 +647,7 @@ class PropertyResourceConfigurerTests { @@ -647,7 +647,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPreferencesPlaceholderConfigurer() {
void preferencesPlaceholderConfigurer() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("name", "${myName}")
.addPropertyValue("age", "${myAge}")
@ -674,7 +674,7 @@ class PropertyResourceConfigurerTests { @@ -674,7 +674,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPreferencesPlaceholderConfigurerWithCustomTreePaths() {
void preferencesPlaceholderConfigurerWithCustomTreePaths() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("name", "${myName}")
.addPropertyValue("age", "${myAge}")
@ -703,7 +703,7 @@ class PropertyResourceConfigurerTests { @@ -703,7 +703,7 @@ class PropertyResourceConfigurerTests {
}
@Test
void testPreferencesPlaceholderConfigurerWithPathInPlaceholder() {
void preferencesPlaceholderConfigurerWithPathInPlaceholder() {
factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
.addPropertyValue("name", "${mypath/myName}")
.addPropertyValue("age", "${myAge}")

24
spring-beans/src/test/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBeanTests.java

@ -50,7 +50,7 @@ class ServiceLocatorFactoryBeanTests { @@ -50,7 +50,7 @@ class ServiceLocatorFactoryBeanTests {
}
@Test
void testNoArgGetter() {
void noArgGetter() {
bf.registerBeanDefinition("testService", genericBeanDefinition(TestService.class).getBeanDefinition());
bf.registerBeanDefinition("factory",
genericBeanDefinition(ServiceLocatorFactoryBean.class)
@ -63,7 +63,7 @@ class ServiceLocatorFactoryBeanTests { @@ -63,7 +63,7 @@ class ServiceLocatorFactoryBeanTests {
}
@Test
void testErrorOnTooManyOrTooFew() {
void errorOnTooManyOrTooFew() {
bf.registerBeanDefinition("testService", genericBeanDefinition(TestService.class).getBeanDefinition());
bf.registerBeanDefinition("testServiceInstance2", genericBeanDefinition(TestService.class).getBeanDefinition());
bf.registerBeanDefinition("factory",
@ -87,7 +87,7 @@ class ServiceLocatorFactoryBeanTests { @@ -87,7 +87,7 @@ class ServiceLocatorFactoryBeanTests {
}
@Test
void testErrorOnTooManyOrTooFewWithCustomServiceLocatorException() {
void errorOnTooManyOrTooFewWithCustomServiceLocatorException() {
bf.registerBeanDefinition("testService", genericBeanDefinition(TestService.class).getBeanDefinition());
bf.registerBeanDefinition("testServiceInstance2", genericBeanDefinition(TestService.class).getBeanDefinition());
bf.registerBeanDefinition("factory",
@ -116,7 +116,7 @@ class ServiceLocatorFactoryBeanTests { @@ -116,7 +116,7 @@ class ServiceLocatorFactoryBeanTests {
}
@Test
void testStringArgGetter() throws Exception {
void stringArgGetter() throws Exception {
bf.registerBeanDefinition("testService", genericBeanDefinition(TestService.class).getBeanDefinition());
bf.registerBeanDefinition("factory",
genericBeanDefinition(ServiceLocatorFactoryBean.class)
@ -136,7 +136,7 @@ class ServiceLocatorFactoryBeanTests { @@ -136,7 +136,7 @@ class ServiceLocatorFactoryBeanTests {
}
@Disabled @Test // worked when using an ApplicationContext (see commented), fails when using BeanFactory
public void testCombinedLocatorInterface() {
void combinedLocatorInterface() {
bf.registerBeanDefinition("testService", genericBeanDefinition(TestService.class).getBeanDefinition());
bf.registerAlias("testService", "1");
@ -169,7 +169,7 @@ class ServiceLocatorFactoryBeanTests { @@ -169,7 +169,7 @@ class ServiceLocatorFactoryBeanTests {
}
@Disabled @Test // worked when using an ApplicationContext (see commented), fails when using BeanFactory
public void testServiceMappings() {
void serviceMappings() {
bf.registerBeanDefinition("testService1", genericBeanDefinition(TestService.class).getBeanDefinition());
bf.registerBeanDefinition("testService2", genericBeanDefinition(ExtendedTestService.class).getBeanDefinition());
bf.registerBeanDefinition("factory",
@ -205,13 +205,13 @@ class ServiceLocatorFactoryBeanTests { @@ -205,13 +205,13 @@ class ServiceLocatorFactoryBeanTests {
}
@Test
void testNoServiceLocatorInterfaceSupplied() {
void noServiceLocatorInterfaceSupplied() {
assertThatIllegalArgumentException().isThrownBy(
new ServiceLocatorFactoryBean()::afterPropertiesSet);
}
@Test
void testWhenServiceLocatorInterfaceIsNotAnInterfaceType() {
void whenServiceLocatorInterfaceIsNotAnInterfaceType() {
ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean();
factory.setServiceLocatorInterface(getClass());
assertThatIllegalArgumentException().isThrownBy(
@ -220,7 +220,7 @@ class ServiceLocatorFactoryBeanTests { @@ -220,7 +220,7 @@ class ServiceLocatorFactoryBeanTests {
}
@Test
void testWhenServiceLocatorExceptionClassToExceptionTypeWithOnlyNoArgCtor() {
void whenServiceLocatorExceptionClassToExceptionTypeWithOnlyNoArgCtor() {
ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean();
assertThatIllegalArgumentException().isThrownBy(() ->
factory.setServiceLocatorExceptionClass(ExceptionClassWithOnlyZeroArgCtor.class));
@ -229,7 +229,7 @@ class ServiceLocatorFactoryBeanTests { @@ -229,7 +229,7 @@ class ServiceLocatorFactoryBeanTests {
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testWhenServiceLocatorExceptionClassIsNotAnExceptionSubclass() {
void whenServiceLocatorExceptionClassIsNotAnExceptionSubclass() {
ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean();
assertThatIllegalArgumentException().isThrownBy(() ->
factory.setServiceLocatorExceptionClass((Class) getClass()));
@ -237,7 +237,7 @@ class ServiceLocatorFactoryBeanTests { @@ -237,7 +237,7 @@ class ServiceLocatorFactoryBeanTests {
}
@Test
void testWhenServiceLocatorMethodCalledWithTooManyParameters() {
void whenServiceLocatorMethodCalledWithTooManyParameters() {
ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean();
factory.setServiceLocatorInterface(ServiceLocatorInterfaceWithExtraNonCompliantMethod.class);
factory.afterPropertiesSet();
@ -247,7 +247,7 @@ class ServiceLocatorFactoryBeanTests { @@ -247,7 +247,7 @@ class ServiceLocatorFactoryBeanTests {
}
@Test
void testRequiresListableBeanFactoryAndChokesOnAnythingElse() {
void requiresListableBeanFactoryAndChokesOnAnythingElse() {
BeanFactory beanFactory = mock();
try {
ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean();

2
spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests.java

@ -73,7 +73,7 @@ class SimpleScopeTests { @@ -73,7 +73,7 @@ class SimpleScopeTests {
@Test
void testCanGetScopedObject() {
void canGetScopedObject() {
TestBean tb1 = (TestBean) beanFactory.getBean("usesScope");
TestBean tb2 = (TestBean) beanFactory.getBean("usesScope");
assertThat(tb2).isNotSameAs(tb1);

16
spring-beans/src/test/java/org/springframework/beans/factory/config/YamlMapFactoryBeanTests.java

@ -44,14 +44,14 @@ class YamlMapFactoryBeanTests { @@ -44,14 +44,14 @@ class YamlMapFactoryBeanTests {
@Test
void testSetIgnoreResourceNotFound() {
void setIgnoreResourceNotFound() {
this.factory.setResolutionMethod(YamlMapFactoryBean.ResolutionMethod.OVERRIDE_AND_IGNORE);
this.factory.setResources(new FileSystemResource("non-existent-file.yml"));
assertThat(this.factory.getObject()).isEmpty();
}
@Test
void testSetBarfOnResourceNotFound() {
void setBarfOnResourceNotFound() {
assertThatIllegalStateException().isThrownBy(() -> {
this.factory.setResources(new FileSystemResource("non-existent-file.yml"));
this.factory.getObject().size();
@ -59,14 +59,14 @@ class YamlMapFactoryBeanTests { @@ -59,14 +59,14 @@ class YamlMapFactoryBeanTests {
}
@Test
void testGetObject() {
void getObject() {
this.factory.setResources(new ByteArrayResource("foo: bar".getBytes()));
assertThat(this.factory.getObject()).hasSize(1);
}
@SuppressWarnings("unchecked")
@Test
void testOverrideAndRemoveDefaults() {
void overrideAndRemoveDefaults() {
this.factory.setResources(new ByteArrayResource("foo:\n bar: spam".getBytes()),
new ByteArrayResource("foo:\n spam: bar".getBytes()));
@ -75,7 +75,7 @@ class YamlMapFactoryBeanTests { @@ -75,7 +75,7 @@ class YamlMapFactoryBeanTests {
}
@Test
void testFirstFound() {
void firstFound() {
this.factory.setResolutionMethod(YamlProcessor.ResolutionMethod.FIRST_FOUND);
this.factory.setResources(new AbstractResource() {
@Override
@ -92,7 +92,7 @@ class YamlMapFactoryBeanTests { @@ -92,7 +92,7 @@ class YamlMapFactoryBeanTests {
}
@Test
void testMapWithPeriodsInKey() {
void mapWithPeriodsInKey() {
this.factory.setResources(new ByteArrayResource("foo:\n ? key1.key2\n : value".getBytes()));
Map<String, Object> map = this.factory.getObject();
@ -107,7 +107,7 @@ class YamlMapFactoryBeanTests { @@ -107,7 +107,7 @@ class YamlMapFactoryBeanTests {
}
@Test
void testMapWithIntegerValue() {
void mapWithIntegerValue() {
this.factory.setResources(new ByteArrayResource("foo:\n ? key1.key2\n : 3".getBytes()));
Map<String, Object> map = this.factory.getObject();
@ -122,7 +122,7 @@ class YamlMapFactoryBeanTests { @@ -122,7 +122,7 @@ class YamlMapFactoryBeanTests {
}
@Test
void testDuplicateKey() {
void duplicateKey() {
this.factory.setResources(new ByteArrayResource("mymap:\n foo: bar\nmymap:\n bar: foo".getBytes()));
assertThatExceptionOfType(DuplicateKeyException.class).isThrownBy(() ->
this.factory.getObject().get("mymap"));

2
spring-beans/src/test/java/org/springframework/beans/factory/parsing/ConstructorArgumentEntryTests.java

@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException @@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class ConstructorArgumentEntryTests {
@Test
void testCtorBailsOnNegativeCtorIndexArgument() {
void ctorBailsOnNegativeCtorIndexArgument() {
assertThatIllegalArgumentException().isThrownBy(() ->
new ConstructorArgumentEntry(-1));
}

2
spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java

@ -53,7 +53,7 @@ class CustomProblemReporterTests { @@ -53,7 +53,7 @@ class CustomProblemReporterTests {
@Test
void testErrorsAreCollated() {
void errorsAreCollated() {
this.reader.loadBeanDefinitions(qualifiedResource(CustomProblemReporterTests.class, "context.xml"));
assertThat(this.problemReporter.getErrors()).as("Incorrect number of errors collated").hasSize(4);

4
spring-beans/src/test/java/org/springframework/beans/factory/parsing/FailFastProblemReporterTests.java

@ -35,7 +35,7 @@ import static org.mockito.Mockito.verify; @@ -35,7 +35,7 @@ import static org.mockito.Mockito.verify;
class FailFastProblemReporterTests {
@Test
void testError() {
void error() {
FailFastProblemReporter reporter = new FailFastProblemReporter();
assertThatExceptionOfType(BeanDefinitionParsingException.class).isThrownBy(() ->
reporter.error(new Problem("VGER", new Location(new DescriptiveResource("here")),
@ -43,7 +43,7 @@ class FailFastProblemReporterTests { @@ -43,7 +43,7 @@ class FailFastProblemReporterTests {
}
@Test
void testWarn() {
void warn() {
Problem problem = new Problem("VGER", new Location(new DescriptiveResource("here")),
null, new IllegalArgumentException());

4
spring-beans/src/test/java/org/springframework/beans/factory/parsing/NullSourceExtractorTests.java

@ -27,14 +27,14 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -27,14 +27,14 @@ import static org.assertj.core.api.Assertions.assertThat;
class NullSourceExtractorTests {
@Test
void testPassThroughContract() {
void passThroughContract() {
Object source = new Object();
Object extractedSource = new NullSourceExtractor().extractSource(source, null);
assertThat(extractedSource).as("The contract of NullSourceExtractor states that the extraction *always* return null").isNull();
}
@Test
void testPassThroughContractEvenWithNull() {
void passThroughContractEvenWithNull() {
Object extractedSource = new NullSourceExtractor().extractSource(null, null);
assertThat(extractedSource).as("The contract of NullSourceExtractor states that the extraction *always* return null").isNull();
}

6
spring-beans/src/test/java/org/springframework/beans/factory/parsing/ParseStateTests.java

@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class ParseStateTests {
@Test
void testSimple() {
void simple() {
MockEntry entry = new MockEntry();
ParseState parseState = new ParseState();
@ -39,7 +39,7 @@ class ParseStateTests { @@ -39,7 +39,7 @@ class ParseStateTests {
}
@Test
void testNesting() {
void nesting() {
MockEntry one = new MockEntry();
MockEntry two = new MockEntry();
MockEntry three = new MockEntry();
@ -59,7 +59,7 @@ class ParseStateTests { @@ -59,7 +59,7 @@ class ParseStateTests {
}
@Test
void testSnapshot() {
void snapshot() {
MockEntry entry = new MockEntry();
ParseState original = new ParseState();

4
spring-beans/src/test/java/org/springframework/beans/factory/parsing/PassThroughSourceExtractorTests.java

@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class PassThroughSourceExtractorTests {
@Test
void testPassThroughContract() {
void passThroughContract() {
Object source = new Object();
Object extractedSource = new PassThroughSourceExtractor().extractSource(source, null);
assertThat(extractedSource).as("The contract of PassThroughSourceExtractor states that the supplied " +
@ -37,7 +37,7 @@ class PassThroughSourceExtractorTests { @@ -37,7 +37,7 @@ class PassThroughSourceExtractorTests {
}
@Test
void testPassThroughContractEvenWithNull() {
void passThroughContractEvenWithNull() {
Object extractedSource = new PassThroughSourceExtractor().extractSource(null, null);
assertThat(extractedSource).as("The contract of PassThroughSourceExtractor states that the supplied " +
"source object *must* be returned as-is (even if null)").isNull();

6
spring-beans/src/test/java/org/springframework/beans/factory/parsing/PropertyEntryTests.java

@ -29,19 +29,19 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException @@ -29,19 +29,19 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class PropertyEntryTests {
@Test
void testCtorBailsOnNullPropertyNameArgument() {
void ctorBailsOnNullPropertyNameArgument() {
assertThatIllegalArgumentException().isThrownBy(() ->
new PropertyEntry(null));
}
@Test
void testCtorBailsOnEmptyPropertyNameArgument() {
void ctorBailsOnEmptyPropertyNameArgument() {
assertThatIllegalArgumentException().isThrownBy(() ->
new PropertyEntry(""));
}
@Test
void testCtorBailsOnWhitespacedPropertyNameArgument() {
void ctorBailsOnWhitespacedPropertyNameArgument() {
assertThatIllegalArgumentException().isThrownBy(() ->
new PropertyEntry("\t "));
}

6
spring-beans/src/test/java/org/springframework/beans/factory/serviceloader/ServiceLoaderTests.java

@ -42,7 +42,7 @@ class ServiceLoaderTests { @@ -42,7 +42,7 @@ class ServiceLoaderTests {
}
@Test
void testServiceLoaderFactoryBean() {
void serviceLoaderFactoryBean() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
RootBeanDefinition bd = new RootBeanDefinition(ServiceLoaderFactoryBean.class);
bd.getPropertyValues().add("serviceType", DocumentBuilderFactory.class.getName());
@ -52,7 +52,7 @@ class ServiceLoaderTests { @@ -52,7 +52,7 @@ class ServiceLoaderTests {
}
@Test
void testServiceFactoryBean() {
void serviceFactoryBean() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
RootBeanDefinition bd = new RootBeanDefinition(ServiceFactoryBean.class);
bd.getPropertyValues().add("serviceType", DocumentBuilderFactory.class.getName());
@ -61,7 +61,7 @@ class ServiceLoaderTests { @@ -61,7 +61,7 @@ class ServiceLoaderTests {
}
@Test
void testServiceListFactoryBean() {
void serviceListFactoryBean() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
RootBeanDefinition bd = new RootBeanDefinition(ServiceListFactoryBean.class);
bd.getPropertyValues().add("serviceType", DocumentBuilderFactory.class.getName());

14
spring-beans/src/test/java/org/springframework/beans/factory/support/LookupMethodTests.java

@ -44,7 +44,7 @@ class LookupMethodTests { @@ -44,7 +44,7 @@ class LookupMethodTests {
@Test
void testWithoutConstructorArg() {
void withoutConstructorArg() {
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
assertThat(bean).isNotNull();
Object expected = bean.get();
@ -52,7 +52,7 @@ class LookupMethodTests { @@ -52,7 +52,7 @@ class LookupMethodTests {
}
@Test
void testWithOverloadedArg() {
void withOverloadedArg() {
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
assertThat(bean).isNotNull();
TestBean expected = bean.get("haha");
@ -61,7 +61,7 @@ class LookupMethodTests { @@ -61,7 +61,7 @@ class LookupMethodTests {
}
@Test
void testWithOneConstructorArg() {
void withOneConstructorArg() {
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
assertThat(bean).isNotNull();
TestBean expected = bean.getOneArgument("haha");
@ -70,7 +70,7 @@ class LookupMethodTests { @@ -70,7 +70,7 @@ class LookupMethodTests {
}
@Test
void testWithTwoConstructorArg() {
void withTwoConstructorArg() {
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
assertThat(bean).isNotNull();
TestBean expected = bean.getTwoArguments("haha", 72);
@ -80,7 +80,7 @@ class LookupMethodTests { @@ -80,7 +80,7 @@ class LookupMethodTests {
}
@Test
void testWithThreeArgsShouldFail() {
void withThreeArgsShouldFail() {
AbstractBean bean = (AbstractBean) beanFactory.getBean("abstractBean");
assertThat(bean).isNotNull();
assertThatExceptionOfType(AbstractMethodError.class).as("does not have a three arg constructor")
@ -88,7 +88,7 @@ class LookupMethodTests { @@ -88,7 +88,7 @@ class LookupMethodTests {
}
@Test
void testWithOverriddenLookupMethod() {
void withOverriddenLookupMethod() {
AbstractBean bean = (AbstractBean) beanFactory.getBean("extendedBean");
assertThat(bean).isNotNull();
TestBean expected = bean.getOneArgument("haha");
@ -98,7 +98,7 @@ class LookupMethodTests { @@ -98,7 +98,7 @@ class LookupMethodTests {
}
@Test
void testWithGenericBean() {
void withGenericBean() {
RootBeanDefinition bd = new RootBeanDefinition(NumberBean.class);
bd.getMethodOverrides().addOverride(new LookupOverride("getDoubleStore", null));
bd.getMethodOverrides().addOverride(new LookupOverride("getFloatStore", null));

6
spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedPropertiesTests.java

@ -34,7 +34,7 @@ class ManagedPropertiesTests { @@ -34,7 +34,7 @@ class ManagedPropertiesTests {
@Test
@SuppressWarnings("unchecked")
public void mergeSunnyDay() {
void mergeSunnyDay() {
ManagedProperties parent = new ManagedProperties();
parent.setProperty("one", "one");
parent.setProperty("two", "two");
@ -69,7 +69,7 @@ class ManagedPropertiesTests { @@ -69,7 +69,7 @@ class ManagedPropertiesTests {
@Test
@SuppressWarnings("unchecked")
public void mergeEmptyChild() {
void mergeEmptyChild() {
ManagedProperties parent = new ManagedProperties();
parent.setProperty("one", "one");
parent.setProperty("two", "two");
@ -81,7 +81,7 @@ class ManagedPropertiesTests { @@ -81,7 +81,7 @@ class ManagedPropertiesTests {
@Test
@SuppressWarnings("unchecked")
public void mergeChildValuesOverrideTheParents() {
void mergeChildValuesOverrideTheParents() {
ManagedProperties parent = new ManagedProperties();
parent.setProperty("one", "one");
parent.setProperty("two", "two");

16
spring-beans/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireBeanFactoryTests.java

@ -49,7 +49,7 @@ class QualifierAnnotationAutowireBeanFactoryTests { @@ -49,7 +49,7 @@ class QualifierAnnotationAutowireBeanFactoryTests {
@Test
void testAutowireCandidateDefaultWithIrrelevantDescriptor() throws Exception {
void autowireCandidateDefaultWithIrrelevantDescriptor() throws Exception {
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
RootBeanDefinition rbd = new RootBeanDefinition(Person.class, cavs, null);
@ -63,7 +63,7 @@ class QualifierAnnotationAutowireBeanFactoryTests { @@ -63,7 +63,7 @@ class QualifierAnnotationAutowireBeanFactoryTests {
}
@Test
void testAutowireCandidateExplicitlyFalseWithIrrelevantDescriptor() throws Exception {
void autowireCandidateExplicitlyFalseWithIrrelevantDescriptor() throws Exception {
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
RootBeanDefinition rbd = new RootBeanDefinition(Person.class, cavs, null);
@ -78,7 +78,7 @@ class QualifierAnnotationAutowireBeanFactoryTests { @@ -78,7 +78,7 @@ class QualifierAnnotationAutowireBeanFactoryTests {
}
@Test
void testAutowireCandidateWithFieldDescriptor() throws Exception {
void autowireCandidateWithFieldDescriptor() throws Exception {
lbf.setAutowireCandidateResolver(new QualifierAnnotationAutowireCandidateResolver());
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
@ -104,7 +104,7 @@ class QualifierAnnotationAutowireBeanFactoryTests { @@ -104,7 +104,7 @@ class QualifierAnnotationAutowireBeanFactoryTests {
}
@Test
void testAutowireCandidateExplicitlyFalseWithFieldDescriptor() throws Exception {
void autowireCandidateExplicitlyFalseWithFieldDescriptor() throws Exception {
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null);
@ -123,7 +123,7 @@ class QualifierAnnotationAutowireBeanFactoryTests { @@ -123,7 +123,7 @@ class QualifierAnnotationAutowireBeanFactoryTests {
}
@Test
void testAutowireCandidateWithShortClassName() throws Exception {
void autowireCandidateWithShortClassName() throws Exception {
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null);
@ -141,7 +141,7 @@ class QualifierAnnotationAutowireBeanFactoryTests { @@ -141,7 +141,7 @@ class QualifierAnnotationAutowireBeanFactoryTests {
}
@Test
void testAutowireCandidateWithConstructorDescriptor() throws Exception {
void autowireCandidateWithConstructorDescriptor() throws Exception {
lbf.setAutowireCandidateResolver(new QualifierAnnotationAutowireCandidateResolver());
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
@ -165,7 +165,7 @@ class QualifierAnnotationAutowireBeanFactoryTests { @@ -165,7 +165,7 @@ class QualifierAnnotationAutowireBeanFactoryTests {
}
@Test
void testAutowireCandidateWithMethodDescriptor() throws Exception {
void autowireCandidateWithMethodDescriptor() throws Exception {
lbf.setAutowireCandidateResolver(new QualifierAnnotationAutowireCandidateResolver());
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
@ -197,7 +197,7 @@ class QualifierAnnotationAutowireBeanFactoryTests { @@ -197,7 +197,7 @@ class QualifierAnnotationAutowireBeanFactoryTests {
}
@Test
void testAutowireCandidateWithMultipleCandidatesDescriptor() throws Exception {
void autowireCandidateWithMultipleCandidatesDescriptor() throws Exception {
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
RootBeanDefinition person1 = new RootBeanDefinition(Person.class, cavs1, null);

10
spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java

@ -42,7 +42,7 @@ class CollectionsWithDefaultTypesTests { @@ -42,7 +42,7 @@ class CollectionsWithDefaultTypesTests {
}
@Test
void testListHasDefaultType() {
void listHasDefaultType() {
TestBean bean = (TestBean) this.beanFactory.getBean("testBean");
for (Object o : bean.getSomeList()) {
assertThat(o.getClass()).as("Value type is incorrect").isEqualTo(Integer.class);
@ -50,7 +50,7 @@ class CollectionsWithDefaultTypesTests { @@ -50,7 +50,7 @@ class CollectionsWithDefaultTypesTests {
}
@Test
void testSetHasDefaultType() {
void setHasDefaultType() {
TestBean bean = (TestBean) this.beanFactory.getBean("testBean");
for (Object o : bean.getSomeSet()) {
assertThat(o.getClass()).as("Value type is incorrect").isEqualTo(Integer.class);
@ -58,13 +58,13 @@ class CollectionsWithDefaultTypesTests { @@ -58,13 +58,13 @@ class CollectionsWithDefaultTypesTests {
}
@Test
void testMapHasDefaultKeyAndValueType() {
void mapHasDefaultKeyAndValueType() {
TestBean bean = (TestBean) this.beanFactory.getBean("testBean");
assertMap(bean.getSomeMap());
}
@Test
void testMapWithNestedElementsHasDefaultKeyAndValueType() {
void mapWithNestedElementsHasDefaultKeyAndValueType() {
TestBean bean = (TestBean) this.beanFactory.getBean("testBean2");
assertMap(bean.getSomeMap());
}
@ -79,7 +79,7 @@ class CollectionsWithDefaultTypesTests { @@ -79,7 +79,7 @@ class CollectionsWithDefaultTypesTests {
@Test
@SuppressWarnings("rawtypes")
public void testBuildCollectionFromMixtureOfReferencesAndValues() {
void buildCollectionFromMixtureOfReferencesAndValues() {
MixedCollectionBean jumble = (MixedCollectionBean) this.beanFactory.getBean("jumble");
assertThat(jumble.getJumble()).as("Expected 3 elements, not " + jumble.getJumble().size()).hasSize(3);
List l = (List) jumble.getJumble();

6
spring-beans/src/test/java/org/springframework/beans/factory/xml/DelegatingEntityResolverTests.java

@ -31,19 +31,19 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException @@ -31,19 +31,19 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class DelegatingEntityResolverTests {
@Test
void testCtorWhereDtdEntityResolverIsNull() {
void ctorWhereDtdEntityResolverIsNull() {
assertThatIllegalArgumentException().isThrownBy(() ->
new DelegatingEntityResolver(null, new NoOpEntityResolver()));
}
@Test
void testCtorWhereSchemaEntityResolverIsNull() {
void ctorWhereSchemaEntityResolverIsNull() {
assertThatIllegalArgumentException().isThrownBy(() ->
new DelegatingEntityResolver(new NoOpEntityResolver(), null));
}
@Test
void testCtorWhereEntityResolversAreBothNull() {
void ctorWhereEntityResolversAreBothNull() {
assertThatIllegalArgumentException().isThrownBy(() ->
new DelegatingEntityResolver(null, null));
}

38
spring-beans/src/test/java/org/springframework/beans/factory/xml/FactoryMethodTests.java

@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
class FactoryMethodTests {
@Test
void testFactoryMethodsSingletonOnTargetClass() {
void factoryMethodsSingletonOnTargetClass() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@ -73,7 +73,7 @@ class FactoryMethodTests { @@ -73,7 +73,7 @@ class FactoryMethodTests {
}
@Test
void testFactoryMethodsWithInvalidDestroyMethod() {
void factoryMethodsWithInvalidDestroyMethod() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@ -82,7 +82,7 @@ class FactoryMethodTests { @@ -82,7 +82,7 @@ class FactoryMethodTests {
}
@Test
void testFactoryMethodsWithNullInstance() {
void factoryMethodsWithNullInstance() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@ -93,7 +93,7 @@ class FactoryMethodTests { @@ -93,7 +93,7 @@ class FactoryMethodTests {
}
@Test
void testFactoryMethodsWithNullValue() {
void factoryMethodsWithNullValue() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@ -115,7 +115,7 @@ class FactoryMethodTests { @@ -115,7 +115,7 @@ class FactoryMethodTests {
}
@Test
void testFactoryMethodsWithAutowire() {
void factoryMethodsWithAutowire() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@ -127,7 +127,7 @@ class FactoryMethodTests { @@ -127,7 +127,7 @@ class FactoryMethodTests {
}
@Test
void testProtectedFactoryMethod() {
void protectedFactoryMethod() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@ -137,7 +137,7 @@ class FactoryMethodTests { @@ -137,7 +137,7 @@ class FactoryMethodTests {
}
@Test
void testPrivateFactoryMethod() {
void privateFactoryMethod() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@ -147,7 +147,7 @@ class FactoryMethodTests { @@ -147,7 +147,7 @@ class FactoryMethodTests {
}
@Test
void testFactoryMethodsPrototypeOnTargetClass() {
void factoryMethodsPrototypeOnTargetClass() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@ -191,7 +191,7 @@ class FactoryMethodTests { @@ -191,7 +191,7 @@ class FactoryMethodTests {
* Tests where the static factory method is on a different class.
*/
@Test
void testFactoryMethodsOnExternalClass() {
void factoryMethodsOnExternalClass() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@ -217,7 +217,7 @@ class FactoryMethodTests { @@ -217,7 +217,7 @@ class FactoryMethodTests {
}
@Test
void testInstanceFactoryMethodWithoutArgs() {
void instanceFactoryMethodWithoutArgs() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@ -235,7 +235,7 @@ class FactoryMethodTests { @@ -235,7 +235,7 @@ class FactoryMethodTests {
}
@Test
void testFactoryMethodNoMatchingStaticMethod() {
void factoryMethodNoMatchingStaticMethod() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@ -244,7 +244,7 @@ class FactoryMethodTests { @@ -244,7 +244,7 @@ class FactoryMethodTests {
}
@Test
void testNonExistingFactoryMethod() {
void nonExistingFactoryMethod() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@ -254,7 +254,7 @@ class FactoryMethodTests { @@ -254,7 +254,7 @@ class FactoryMethodTests {
}
@Test
void testFactoryMethodArgumentsForNonExistingMethod() {
void factoryMethodArgumentsForNonExistingMethod() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@ -264,7 +264,7 @@ class FactoryMethodTests { @@ -264,7 +264,7 @@ class FactoryMethodTests {
}
@Test
void testCanSpecifyFactoryMethodArgumentsOnFactoryMethodPrototype() {
void canSpecifyFactoryMethodArgumentsOnFactoryMethodPrototype() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@ -300,7 +300,7 @@ class FactoryMethodTests { @@ -300,7 +300,7 @@ class FactoryMethodTests {
}
@Test
void testCanSpecifyFactoryMethodArgumentsOnSingleton() {
void canSpecifyFactoryMethodArgumentsOnSingleton() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@ -315,7 +315,7 @@ class FactoryMethodTests { @@ -315,7 +315,7 @@ class FactoryMethodTests {
}
@Test
void testCannotSpecifyFactoryMethodArgumentsOnSingletonAfterCreation() {
void cannotSpecifyFactoryMethodArgumentsOnSingletonAfterCreation() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@ -329,7 +329,7 @@ class FactoryMethodTests { @@ -329,7 +329,7 @@ class FactoryMethodTests {
}
@Test
void testFactoryMethodWithDifferentReturnType() {
void factoryMethodWithDifferentReturnType() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@ -352,7 +352,7 @@ class FactoryMethodTests { @@ -352,7 +352,7 @@ class FactoryMethodTests {
}
@Test
void testFactoryMethodForJavaMailSession() {
void factoryMethodForJavaMailSession() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf);
reader.loadBeanDefinitions(new ClassPathResource("factory-methods.xml", getClass()));
@ -371,7 +371,7 @@ class MailSession { @@ -371,7 +371,7 @@ class MailSession {
private MailSession() {
}
public void setProperties(Properties props) {
void setProperties(Properties props) {
this.props = props;
}

8
spring-beans/src/test/java/org/springframework/beans/factory/xml/ProfileXmlBeanDefinitionTests.java

@ -61,13 +61,13 @@ class ProfileXmlBeanDefinitionTests { @@ -61,13 +61,13 @@ class ProfileXmlBeanDefinitionTests {
private static final String TARGET_BEAN = "foo";
@Test
void testProfileValidation() {
void profileValidation() {
assertThatIllegalArgumentException().isThrownBy(() ->
beanFactoryFor(PROD_ELIGIBLE_XML, NULL_ACTIVE));
}
@Test
void testProfilePermutations() {
void profilePermutations() {
assertThat(beanFactoryFor(PROD_ELIGIBLE_XML, NONE_ACTIVE)).isNot(containingTarget());
assertThat(beanFactoryFor(PROD_ELIGIBLE_XML, DEV_ACTIVE)).isNot(containingTarget());
assertThat(beanFactoryFor(PROD_ELIGIBLE_XML, PROD_ACTIVE)).is(containingTarget());
@ -116,7 +116,7 @@ class ProfileXmlBeanDefinitionTests { @@ -116,7 +116,7 @@ class ProfileXmlBeanDefinitionTests {
}
@Test
void testDefaultProfile() {
void defaultProfile() {
{
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);
@ -140,7 +140,7 @@ class ProfileXmlBeanDefinitionTests { @@ -140,7 +140,7 @@ class ProfileXmlBeanDefinitionTests {
}
@Test
void testDefaultAndNonDefaultProfile() {
void defaultAndNonDefaultProfile() {
assertThat(beanFactoryFor(DEFAULT_ELIGIBLE_XML, NONE_ACTIVE)).is(containingTarget());
assertThat(beanFactoryFor(DEFAULT_ELIGIBLE_XML, "other")).isNot(containingTarget());

58
spring-beans/src/test/java/org/springframework/beans/factory/xml/UtilNamespaceHandlerTests.java

@ -64,19 +64,19 @@ class UtilNamespaceHandlerTests { @@ -64,19 +64,19 @@ class UtilNamespaceHandlerTests {
@Test
void testConstant() {
void constant() {
Integer min = (Integer) this.beanFactory.getBean("min");
assertThat(min).isEqualTo(Integer.MIN_VALUE);
}
@Test
void testConstantWithDefaultName() {
void constantWithDefaultName() {
Integer max = (Integer) this.beanFactory.getBean("java.lang.Integer.MAX_VALUE");
assertThat(max).isEqualTo(Integer.MAX_VALUE);
}
@Test
void testEvents() {
void events() {
ComponentDefinition propertiesComponent = this.listener.getComponentDefinition("myProperties");
assertThat(propertiesComponent).as("Event for 'myProperties' not sent").isNotNull();
AbstractBeanDefinition propertiesBean = (AbstractBeanDefinition) propertiesComponent.getBeanDefinitions()[0];
@ -89,26 +89,26 @@ class UtilNamespaceHandlerTests { @@ -89,26 +89,26 @@ class UtilNamespaceHandlerTests {
}
@Test
void testNestedProperties() {
void nestedProperties() {
TestBean bean = (TestBean) this.beanFactory.getBean("testBean");
Properties props = bean.getSomeProperties();
assertThat(props).as("Incorrect property value").containsEntry("foo", "bar");
}
@Test
void testPropertyPath() {
void propertyPath() {
String name = (String) this.beanFactory.getBean("name");
assertThat(name).isEqualTo("Rob Harrop");
}
@Test
void testNestedPropertyPath() {
void nestedPropertyPath() {
TestBean bean = (TestBean) this.beanFactory.getBean("testBean");
assertThat(bean.getName()).isEqualTo("Rob Harrop");
}
@Test
void testSimpleMap() {
void simpleMap() {
Map<?, ?> map = (Map<?, ?>) this.beanFactory.getBean("simpleMap");
assertThat(map.get("foo")).isEqualTo("bar");
Map<?, ?> map2 = (Map<?, ?>) this.beanFactory.getBean("simpleMap");
@ -116,7 +116,7 @@ class UtilNamespaceHandlerTests { @@ -116,7 +116,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testScopedMap() {
void scopedMap() {
Map<?, ?> map = (Map<?, ?>) this.beanFactory.getBean("scopedMap");
assertThat(map.get("foo")).isEqualTo("bar");
Map<?, ?> map2 = (Map<?, ?>) this.beanFactory.getBean("scopedMap");
@ -125,7 +125,7 @@ class UtilNamespaceHandlerTests { @@ -125,7 +125,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testSimpleList() {
void simpleList() {
assertThat(this.beanFactory.getBean("simpleList"))
.asInstanceOf(InstanceOfAssertFactories.LIST).element(0).isEqualTo("Rob Harrop");
assertThat(this.beanFactory.getBean("simpleList"))
@ -133,7 +133,7 @@ class UtilNamespaceHandlerTests { @@ -133,7 +133,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testScopedList() {
void scopedList() {
assertThat(this.beanFactory.getBean("scopedList"))
.asInstanceOf(InstanceOfAssertFactories.LIST).element(0).isEqualTo("Rob Harrop");
assertThat(this.beanFactory.getBean("scopedList"))
@ -143,7 +143,7 @@ class UtilNamespaceHandlerTests { @@ -143,7 +143,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testSimpleSet() {
void simpleSet() {
assertThat(this.beanFactory.getBean("simpleSet")).isInstanceOf(Set.class)
.asInstanceOf(InstanceOfAssertFactories.collection(String.class))
.containsOnly("Rob Harrop");
@ -152,7 +152,7 @@ class UtilNamespaceHandlerTests { @@ -152,7 +152,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testScopedSet() {
void scopedSet() {
assertThat(this.beanFactory.getBean("scopedSet")).isInstanceOf(Set.class)
.asInstanceOf(InstanceOfAssertFactories.collection(String.class))
.containsOnly("Rob Harrop");
@ -164,7 +164,7 @@ class UtilNamespaceHandlerTests { @@ -164,7 +164,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testMapWithRef() throws Exception {
void mapWithRef() throws Exception {
Map<?, ?> map = (Map<?, ?>) this.beanFactory.getBean("mapWithRef");
assertThat(map).isInstanceOf(TreeMap.class);
assertThat(map.get("bean")).isEqualTo(this.beanFactory.getBean("testBean"));
@ -174,7 +174,7 @@ class UtilNamespaceHandlerTests { @@ -174,7 +174,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testMapWithTypes() throws Exception {
void mapWithTypes() throws Exception {
Map<?, ?> map = (Map<?, ?>) this.beanFactory.getBean("mapWithTypes");
assertThat(map).isInstanceOf(LinkedCaseInsensitiveMap.class);
assertThat(map.get("bean")).isEqualTo(this.beanFactory.getBean("testBean"));
@ -184,7 +184,7 @@ class UtilNamespaceHandlerTests { @@ -184,7 +184,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testNestedCollections() {
void nestedCollections() {
TestBean bean = (TestBean) this.beanFactory.getBean("nestedCollectionsBean");
assertThat(bean.getSomeList()).singleElement().isEqualTo("foo");
@ -205,7 +205,7 @@ class UtilNamespaceHandlerTests { @@ -205,7 +205,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testNestedShortcutCollections() {
void nestedShortcutCollections() {
TestBean bean = (TestBean) this.beanFactory.getBean("nestedShortcutCollections");
assertThat(bean.getStringArray()).containsExactly("fooStr");
@ -222,7 +222,7 @@ class UtilNamespaceHandlerTests { @@ -222,7 +222,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testNestedInCollections() {
void nestedInCollections() {
TestBean bean = (TestBean) this.beanFactory.getBean("nestedCustomTagBean");
assertThat(bean.getSomeList()).singleElement().isEqualTo(Integer.MIN_VALUE);
@ -243,7 +243,7 @@ class UtilNamespaceHandlerTests { @@ -243,7 +243,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testCircularCollections() {
void circularCollections() {
TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionsBean");
assertThat(bean.getSomeList()).singleElement().isSameAs(bean);
@ -255,7 +255,7 @@ class UtilNamespaceHandlerTests { @@ -255,7 +255,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testCircularCollectionBeansStartingWithList() {
void circularCollectionBeansStartingWithList() {
this.beanFactory.getBean("circularList");
TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionBeansBean");
@ -276,7 +276,7 @@ class UtilNamespaceHandlerTests { @@ -276,7 +276,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testCircularCollectionBeansStartingWithSet() {
void circularCollectionBeansStartingWithSet() {
this.beanFactory.getBean("circularSet");
TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionBeansBean");
@ -297,7 +297,7 @@ class UtilNamespaceHandlerTests { @@ -297,7 +297,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testCircularCollectionBeansStartingWithMap() {
void circularCollectionBeansStartingWithMap() {
this.beanFactory.getBean("circularMap");
TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionBeansBean");
@ -318,13 +318,13 @@ class UtilNamespaceHandlerTests { @@ -318,13 +318,13 @@ class UtilNamespaceHandlerTests {
}
@Test
void testNestedInConstructor() {
void nestedInConstructor() {
TestBean bean = (TestBean) this.beanFactory.getBean("constructedTestBean");
assertThat(bean.getName()).isEqualTo("Rob Harrop");
}
@Test
void testLoadProperties() {
void loadProperties() {
Properties props = (Properties) this.beanFactory.getBean("myProperties");
assertThat(props).as("Incorrect property value").containsEntry("foo", "bar");
assertThat(props).as("Incorrect property value").doesNotContainKey("foo2");
@ -333,7 +333,7 @@ class UtilNamespaceHandlerTests { @@ -333,7 +333,7 @@ class UtilNamespaceHandlerTests {
}
@Test
void testScopedProperties() {
void scopedProperties() {
Properties props = (Properties) this.beanFactory.getBean("myScopedProperties");
assertThat(props).as("Incorrect property value").containsEntry("foo", "bar");
assertThat(props).as("Incorrect property value").doesNotContainKey("foo2");
@ -344,35 +344,35 @@ class UtilNamespaceHandlerTests { @@ -344,35 +344,35 @@ class UtilNamespaceHandlerTests {
}
@Test
void testLocalProperties() {
void localProperties() {
Properties props = (Properties) this.beanFactory.getBean("myLocalProperties");
assertThat(props).as("Incorrect property value").doesNotContainKey("foo");
assertThat(props).as("Incorrect property value").containsEntry("foo2", "bar2");
}
@Test
void testMergedProperties() {
void mergedProperties() {
Properties props = (Properties) this.beanFactory.getBean("myMergedProperties");
assertThat(props).as("Incorrect property value").containsEntry("foo", "bar");
assertThat(props).as("Incorrect property value").containsEntry("foo2", "bar2");
}
@Test
void testLocalOverrideDefault() {
void localOverrideDefault() {
Properties props = (Properties) this.beanFactory.getBean("defaultLocalOverrideProperties");
assertThat(props).as("Incorrect property value").containsEntry("foo", "bar");
assertThat(props).as("Incorrect property value").containsEntry("foo2", "local2");
}
@Test
void testLocalOverrideFalse() {
void localOverrideFalse() {
Properties props = (Properties) this.beanFactory.getBean("falseLocalOverrideProperties");
assertThat(props).as("Incorrect property value").containsEntry("foo", "bar");
assertThat(props).as("Incorrect property value").containsEntry("foo2", "local2");
}
@Test
void testLocalOverrideTrue() {
void localOverrideTrue() {
Properties props = (Properties) this.beanFactory.getBean("trueLocalOverrideProperties");
assertThat(props).as("Incorrect property value").containsEntry("foo", "local");
assertThat(props).as("Incorrect property value").containsEntry("foo2", "local2");

68
spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanCollectionTests.java

@ -67,7 +67,7 @@ class XmlBeanCollectionTests { @@ -67,7 +67,7 @@ class XmlBeanCollectionTests {
@Test
void testCollectionFactoryDefaults() throws Exception {
void collectionFactoryDefaults() throws Exception {
ListFactoryBean listFactory = new ListFactoryBean();
listFactory.setSourceList(new LinkedList());
listFactory.afterPropertiesSet();
@ -85,7 +85,7 @@ class XmlBeanCollectionTests { @@ -85,7 +85,7 @@ class XmlBeanCollectionTests {
}
@Test
void testRefSubelement() {
void refSubelement() {
//assertTrue("5 beans in reftypes, not " + this.beanFactory.getBeanDefinitionCount(), this.beanFactory.getBeanDefinitionCount() == 5);
TestBean jen = (TestBean) this.beanFactory.getBean("jenny");
TestBean dave = (TestBean) this.beanFactory.getBean("david");
@ -93,25 +93,25 @@ class XmlBeanCollectionTests { @@ -93,25 +93,25 @@ class XmlBeanCollectionTests {
}
@Test
void testPropertyWithLiteralValueSubelement() {
void propertyWithLiteralValueSubelement() {
TestBean verbose = (TestBean) this.beanFactory.getBean("verbose");
assertThat(verbose.getName()).isEqualTo("verbose");
}
@Test
void testPropertyWithIdRefLocalAttrSubelement() {
void propertyWithIdRefLocalAttrSubelement() {
TestBean verbose = (TestBean) this.beanFactory.getBean("verbose2");
assertThat(verbose.getName()).isEqualTo("verbose");
}
@Test
void testPropertyWithIdRefBeanAttrSubelement() {
void propertyWithIdRefBeanAttrSubelement() {
TestBean verbose = (TestBean) this.beanFactory.getBean("verbose3");
assertThat(verbose.getName()).isEqualTo("verbose");
}
@Test
void testRefSubelementsBuildCollection() {
void refSubelementsBuildCollection() {
TestBean jen = (TestBean) this.beanFactory.getBean("jenny");
TestBean dave = (TestBean) this.beanFactory.getBean("david");
TestBean rod = (TestBean) this.beanFactory.getBean("rod");
@ -128,7 +128,7 @@ class XmlBeanCollectionTests { @@ -128,7 +128,7 @@ class XmlBeanCollectionTests {
}
@Test
void testRefSubelementsBuildCollectionWithPrototypes() {
void refSubelementsBuildCollectionWithPrototypes() {
TestBean jen = (TestBean) this.beanFactory.getBean("pJenny");
TestBean dave = (TestBean) this.beanFactory.getBean("pDavid");
TestBean rod = (TestBean) this.beanFactory.getBean("pRod");
@ -151,14 +151,14 @@ class XmlBeanCollectionTests { @@ -151,14 +151,14 @@ class XmlBeanCollectionTests {
}
@Test
void testRefSubelementsBuildCollectionFromSingleElement() {
void refSubelementsBuildCollectionFromSingleElement() {
TestBean loner = (TestBean) this.beanFactory.getBean("loner");
TestBean dave = (TestBean) this.beanFactory.getBean("david");
assertThat(loner.getFriends()).containsOnly(dave);
}
@Test
void testBuildCollectionFromMixtureOfReferencesAndValues() {
void buildCollectionFromMixtureOfReferencesAndValues() {
MixedCollectionBean jumble = (MixedCollectionBean) this.beanFactory.getBean("jumble");
assertThat(jumble.getJumble()).as("Expected 5 elements, not " + jumble.getJumble()).hasSize(5);
List l = (List) jumble.getJumble();
@ -172,7 +172,7 @@ class XmlBeanCollectionTests { @@ -172,7 +172,7 @@ class XmlBeanCollectionTests {
}
@Test
void testInvalidBeanNameReference() {
void invalidBeanNameReference() {
assertThatExceptionOfType(BeanCreationException.class).isThrownBy(() ->
this.beanFactory.getBean("jumble2"))
.withCauseInstanceOf(BeanDefinitionStoreException.class)
@ -180,13 +180,13 @@ class XmlBeanCollectionTests { @@ -180,13 +180,13 @@ class XmlBeanCollectionTests {
}
@Test
void testEmptyMap() {
void emptyMap() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("emptyMap");
assertThat(hasMap.getMap()).hasSize(0);
}
@Test
void testMapWithLiteralsOnly() {
void mapWithLiteralsOnly() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("literalMap");
assertThat(hasMap.getMap()).hasSize(3);
assertThat(hasMap.getMap().get("foo").equals("bar")).isTrue();
@ -195,7 +195,7 @@ class XmlBeanCollectionTests { @@ -195,7 +195,7 @@ class XmlBeanCollectionTests {
}
@Test
void testMapWithLiteralsAndReferences() {
void mapWithLiteralsAndReferences() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("mixedMap");
assertThat(hasMap.getMap()).hasSize(5);
assertThat(hasMap.getMap().get("foo")).isEqualTo(10);
@ -209,7 +209,7 @@ class XmlBeanCollectionTests { @@ -209,7 +209,7 @@ class XmlBeanCollectionTests {
}
@Test
void testMapWithLiteralsAndPrototypeReferences() {
void mapWithLiteralsAndPrototypeReferences() {
TestBean jenny = (TestBean) this.beanFactory.getBean("pJenny");
HasMap hasMap = (HasMap) this.beanFactory.getBean("pMixedMap");
assertThat(hasMap.getMap()).hasSize(2);
@ -225,7 +225,7 @@ class XmlBeanCollectionTests { @@ -225,7 +225,7 @@ class XmlBeanCollectionTests {
}
@Test
void testMapWithLiteralsReferencesAndList() {
void mapWithLiteralsReferencesAndList() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("mixedMapWithList");
assertThat(hasMap.getMap()).hasSize(4);
assertThat(hasMap.getMap().get(null).equals("bar")).isTrue();
@ -262,13 +262,13 @@ class XmlBeanCollectionTests { @@ -262,13 +262,13 @@ class XmlBeanCollectionTests {
}
@Test
void testEmptySet() {
void emptySet() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("emptySet");
assertThat(hasMap.getSet()).hasSize(0);
}
@Test
void testPopulatedSet() {
void populatedSet() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("set");
assertThat(hasMap.getSet()).hasSize(3);
assertThat(hasMap.getSet().contains("bar")).isTrue();
@ -282,7 +282,7 @@ class XmlBeanCollectionTests { @@ -282,7 +282,7 @@ class XmlBeanCollectionTests {
}
@Test
void testPopulatedConcurrentSet() {
void populatedConcurrentSet() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("concurrentSet");
assertThat(hasMap.getConcurrentSet()).hasSize(3);
assertThat(hasMap.getConcurrentSet().contains("bar")).isTrue();
@ -292,7 +292,7 @@ class XmlBeanCollectionTests { @@ -292,7 +292,7 @@ class XmlBeanCollectionTests {
}
@Test
void testPopulatedIdentityMap() {
void populatedIdentityMap() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("identityMap");
assertThat(hasMap.getIdentityMap()).hasSize(2);
HashSet set = new HashSet(hasMap.getIdentityMap().keySet());
@ -301,14 +301,14 @@ class XmlBeanCollectionTests { @@ -301,14 +301,14 @@ class XmlBeanCollectionTests {
}
@Test
void testEmptyProps() {
void emptyProps() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("emptyProps");
assertThat(hasMap.getProps()).hasSize(0);
assertThat(Properties.class).isEqualTo(hasMap.getProps().getClass());
}
@Test
void testPopulatedProps() {
void populatedProps() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("props");
assertThat(hasMap.getProps()).hasSize(2);
assertThat(hasMap.getProps().get("foo").equals("bar")).isTrue();
@ -316,7 +316,7 @@ class XmlBeanCollectionTests { @@ -316,7 +316,7 @@ class XmlBeanCollectionTests {
}
@Test
void testObjectArray() {
void objectArray() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("objectArray");
assertThat(hasMap.getObjectArray().length).isEqualTo(2);
assertThat(hasMap.getObjectArray()[0].equals("one")).isTrue();
@ -324,7 +324,7 @@ class XmlBeanCollectionTests { @@ -324,7 +324,7 @@ class XmlBeanCollectionTests {
}
@Test
void testIntegerArray() {
void integerArray() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("integerArray");
assertThat(hasMap.getIntegerArray().length).isEqualTo(3);
assertThat(hasMap.getIntegerArray()[0]).isEqualTo(0);
@ -333,7 +333,7 @@ class XmlBeanCollectionTests { @@ -333,7 +333,7 @@ class XmlBeanCollectionTests {
}
@Test
void testClassArray() {
void classArray() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("classArray");
assertThat(hasMap.getClassArray().length).isEqualTo(2);
assertThat(hasMap.getClassArray()[0].equals(String.class)).isTrue();
@ -341,7 +341,7 @@ class XmlBeanCollectionTests { @@ -341,7 +341,7 @@ class XmlBeanCollectionTests {
}
@Test
void testClassList() {
void classList() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("classList");
assertThat(hasMap.getClassList()).hasSize(2);
assertThat(hasMap.getClassList().get(0).equals(String.class)).isTrue();
@ -349,7 +349,7 @@ class XmlBeanCollectionTests { @@ -349,7 +349,7 @@ class XmlBeanCollectionTests {
}
@Test
void testProps() {
void props() {
HasMap hasMap = (HasMap) this.beanFactory.getBean("props");
assertThat(hasMap.getProps()).hasSize(2);
assertThat(hasMap.getProps().getProperty("foo")).isEqualTo("bar");
@ -362,45 +362,45 @@ class XmlBeanCollectionTests { @@ -362,45 +362,45 @@ class XmlBeanCollectionTests {
}
@Test
void testListFactory() {
void listFactory() {
List list = (List) this.beanFactory.getBean("listFactory");
assertThat(list).isInstanceOf(LinkedList.class).containsExactly("bar", "jenny");
}
@Test
void testPrototypeListFactory() {
void prototypeListFactory() {
List list = (List) this.beanFactory.getBean("pListFactory");
assertThat(list).isInstanceOf(LinkedList.class).containsExactly("bar", "jenny");
}
@Test
void testSetFactory() {
void setFactory() {
Set set = (Set) this.beanFactory.getBean("setFactory");
assertThat(set).isInstanceOf(TreeSet.class).containsOnly("bar", "jenny");
}
@Test
void testPrototypeSetFactory() {
void prototypeSetFactory() {
Set set = (Set) this.beanFactory.getBean("pSetFactory");
assertThat(set).isInstanceOf(TreeSet.class).containsOnly("bar", "jenny");
}
@Test
void testMapFactory() {
void mapFactory() {
Map map = (Map) this.beanFactory.getBean("mapFactory");
assertThat(map).isInstanceOf(TreeMap.class).containsOnly(
entry("foo", "bar"), entry("jen", "jenny"));
}
@Test
void testPrototypeMapFactory() {
void prototypeMapFactory() {
Map map = (Map) this.beanFactory.getBean("pMapFactory");
assertThat(map).isInstanceOf(TreeMap.class).containsOnly(
entry("foo", "bar"), entry("jen", "jenny"));
}
@Test
void testChoiceBetweenSetAndMap() {
void choiceBetweenSetAndMap() {
MapAndSet sam = (MapAndSet) this.beanFactory.getBean("setAndMap");
assertThat(sam.getObject() instanceof Map).as("Didn't choose constructor with Map argument").isTrue();
Map map = (Map) sam.getObject();
@ -408,7 +408,7 @@ class XmlBeanCollectionTests { @@ -408,7 +408,7 @@ class XmlBeanCollectionTests {
}
@Test
void testEnumSetFactory() {
void enumSetFactory() {
Set set = (Set) this.beanFactory.getBean("enumSetFactory");
assertThat(set).containsOnly("ONE", "TWO");
}

2
spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlListableBeanFactoryTests.java

@ -100,7 +100,7 @@ class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTests { @@ -100,7 +100,7 @@ class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTests {
@Test
@Override
public void count() {
protected void count() {
assertCount(24);
}

12
spring-beans/src/test/java/org/springframework/beans/factory/xml/support/DefaultNamespaceHandlerResolverTests.java

@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException @@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class DefaultNamespaceHandlerResolverTests {
@Test
void testResolvedMappedHandler() {
void resolvedMappedHandler() {
DefaultNamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(getClass().getClassLoader());
NamespaceHandler handler = resolver.resolve("http://www.springframework.org/schema/util");
assertThat(handler).as("Handler should not be null.").isNotNull();
@ -42,7 +42,7 @@ class DefaultNamespaceHandlerResolverTests { @@ -42,7 +42,7 @@ class DefaultNamespaceHandlerResolverTests {
}
@Test
void testResolvedMappedHandlerWithNoArgCtor() {
void resolvedMappedHandlerWithNoArgCtor() {
DefaultNamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver();
NamespaceHandler handler = resolver.resolve("http://www.springframework.org/schema/util");
assertThat(handler).as("Handler should not be null.").isNotNull();
@ -50,25 +50,25 @@ class DefaultNamespaceHandlerResolverTests { @@ -50,25 +50,25 @@ class DefaultNamespaceHandlerResolverTests {
}
@Test
void testNonExistentHandlerClass() {
void nonExistentHandlerClass() {
String mappingPath = "org/springframework/beans/factory/xml/support/nonExistent.properties";
new DefaultNamespaceHandlerResolver(getClass().getClassLoader(), mappingPath);
}
@Test
void testCtorWithNullClassLoaderArgument() {
void ctorWithNullClassLoaderArgument() {
// simply must not bail...
new DefaultNamespaceHandlerResolver(null);
}
@Test
void testCtorWithNullClassLoaderArgumentAndNullMappingLocationArgument() {
void ctorWithNullClassLoaderArgumentAndNullMappingLocationArgument() {
assertThatIllegalArgumentException().isThrownBy(() ->
new DefaultNamespaceHandlerResolver(null, null));
}
@Test
void testCtorWithNonExistentMappingLocationArgument() {
void ctorWithNonExistentMappingLocationArgument() {
// simply must not bail; we don't want non-existent resources to result in an Exception
new DefaultNamespaceHandlerResolver(null, "738trbc bobabloobop871");
}

2
spring-beans/src/test/java/org/springframework/beans/propertyeditors/BeanInfoTests.java

@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class BeanInfoTests {
@Test
void testComplexObject() {
void complexObject() {
ValueBean bean = new ValueBean();
BeanWrapper bw = new BeanWrapperImpl(bean);
Integer value = 1;

12
spring-beans/src/test/java/org/springframework/beans/propertyeditors/CustomCollectionEditorTests.java

@ -35,27 +35,27 @@ import static org.assertj.core.api.InstanceOfAssertFactories.LIST; @@ -35,27 +35,27 @@ import static org.assertj.core.api.InstanceOfAssertFactories.LIST;
class CustomCollectionEditorTests {
@Test
void testCtorWithNullCollectionType() {
void ctorWithNullCollectionType() {
assertThatIllegalArgumentException().isThrownBy(() ->
new CustomCollectionEditor(null));
}
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testCtorWithNonCollectionType() {
void ctorWithNonCollectionType() {
assertThatIllegalArgumentException().isThrownBy(() ->
new CustomCollectionEditor((Class) String.class));
}
@Test
void testWithCollectionTypeThatDoesNotExposeAPublicNoArgCtor() {
void withCollectionTypeThatDoesNotExposeAPublicNoArgCtor() {
CustomCollectionEditor editor = new CustomCollectionEditor(CollectionTypeWithNoNoArgCtor.class);
assertThatIllegalArgumentException().isThrownBy(() ->
editor.setValue("1"));
}
@Test
void testSunnyDaySetValue() {
void sunnyDaySetValue() {
CustomCollectionEditor editor = new CustomCollectionEditor(ArrayList.class);
editor.setValue(new int[] {0, 1, 2});
Object value = editor.getValue();
@ -65,7 +65,7 @@ class CustomCollectionEditorTests { @@ -65,7 +65,7 @@ class CustomCollectionEditorTests {
}
@Test
void testWhenTargetTypeIsExactlyTheCollectionInterfaceUsesFallbackCollectionType() {
void whenTargetTypeIsExactlyTheCollectionInterfaceUsesFallbackCollectionType() {
CustomCollectionEditor editor = new CustomCollectionEditor(Collection.class);
editor.setValue("0, 1, 2");
Collection<?> value = (Collection<?>) editor.getValue();
@ -75,7 +75,7 @@ class CustomCollectionEditorTests { @@ -75,7 +75,7 @@ class CustomCollectionEditorTests {
}
@Test
void testSunnyDaySetAsTextYieldsSingleValue() {
void sunnyDaySetAsTextYieldsSingleValue() {
CustomCollectionEditor editor = new CustomCollectionEditor(ArrayList.class);
editor.setValue("0, 1, 2");
Object value = editor.getValue();

14
spring-beans/src/test/java/org/springframework/beans/propertyeditors/FileEditorTests.java

@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException @@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class FileEditorTests {
@Test
void testClasspathFileName() {
void classpathFileName() {
PropertyEditor fileEditor = new FileEditor();
fileEditor.setAsText("classpath:" + ClassUtils.classPackageAsResourcePath(getClass()) + "/" +
ClassUtils.getShortName(getClass()) + ".class");
@ -45,14 +45,14 @@ class FileEditorTests { @@ -45,14 +45,14 @@ class FileEditorTests {
}
@Test
void testWithNonExistentResource() {
void withNonExistentResource() {
PropertyEditor fileEditor = new FileEditor();
assertThatIllegalArgumentException().isThrownBy(() ->
fileEditor.setAsText("classpath:no_way_this_file_is_found.doc"));
}
@Test
void testWithNonExistentFile() {
void withNonExistentFile() {
PropertyEditor fileEditor = new FileEditor();
fileEditor.setAsText("file:no_way_this_file_is_found.doc");
Object value = fileEditor.getValue();
@ -62,7 +62,7 @@ class FileEditorTests { @@ -62,7 +62,7 @@ class FileEditorTests {
}
@Test
void testAbsoluteFileName() {
void absoluteFileName() {
PropertyEditor fileEditor = new FileEditor();
fileEditor.setAsText("/no_way_this_file_is_found.doc");
Object value = fileEditor.getValue();
@ -72,7 +72,7 @@ class FileEditorTests { @@ -72,7 +72,7 @@ class FileEditorTests {
}
@Test
void testCurrentDirectory() {
void currentDirectory() {
PropertyEditor fileEditor = new FileEditor();
fileEditor.setAsText("file:.");
Object value = fileEditor.getValue();
@ -82,7 +82,7 @@ class FileEditorTests { @@ -82,7 +82,7 @@ class FileEditorTests {
}
@Test
void testUnqualifiedFileNameFound() {
void unqualifiedFileNameFound() {
PropertyEditor fileEditor = new FileEditor();
String fileName = ClassUtils.classPackageAsResourcePath(getClass()) + "/" +
ClassUtils.getShortName(getClass()) + ".class";
@ -96,7 +96,7 @@ class FileEditorTests { @@ -96,7 +96,7 @@ class FileEditorTests {
}
@Test
void testUnqualifiedFileNameNotFound() {
void unqualifiedFileNameNotFound() {
PropertyEditor fileEditor = new FileEditor();
String fileName = ClassUtils.classPackageAsResourcePath(getClass()) + "/" +
ClassUtils.getShortName(getClass()) + ".clazz";

8
spring-beans/src/test/java/org/springframework/beans/propertyeditors/InputStreamEditorTests.java

@ -35,13 +35,13 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException @@ -35,13 +35,13 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class InputStreamEditorTests {
@Test
void testCtorWithNullResourceEditor() {
void ctorWithNullResourceEditor() {
assertThatIllegalArgumentException().isThrownBy(() ->
new InputStreamEditor(null));
}
@Test
void testSunnyDay() throws IOException {
void sunnyDay() throws IOException {
InputStream stream = null;
try {
String resource = "classpath:" + ClassUtils.classPackageAsResourcePath(getClass()) +
@ -62,14 +62,14 @@ class InputStreamEditorTests { @@ -62,14 +62,14 @@ class InputStreamEditorTests {
}
@Test
void testWhenResourceDoesNotExist() {
void whenResourceDoesNotExist() {
InputStreamEditor editor = new InputStreamEditor();
assertThatIllegalArgumentException().isThrownBy(() ->
editor.setAsText("classpath:bingo!"));
}
@Test
void testGetAsTextReturnsNullByDefault() {
void getAsTextReturnsNullByDefault() {
assertThat(new InputStreamEditor().getAsText()).isNull();
String resource = "classpath:" + ClassUtils.classPackageAsResourcePath(getClass()) +
"/" + ClassUtils.getShortName(getClass()) + ".class";

18
spring-beans/src/test/java/org/springframework/beans/propertyeditors/PathEditorTests.java

@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class PathEditorTests {
@Test
void testClasspathPathName() {
void classpathPathName() {
PropertyEditor pathEditor = new PathEditor();
pathEditor.setAsText("classpath:" + ClassUtils.classPackageAsResourcePath(getClass()) + "/" +
ClassUtils.getShortName(getClass()) + ".class");
@ -46,14 +46,14 @@ class PathEditorTests { @@ -46,14 +46,14 @@ class PathEditorTests {
}
@Test
void testWithNonExistentResource() {
void withNonExistentResource() {
PropertyEditor pathEditor = new PathEditor();
assertThatIllegalArgumentException().isThrownBy(() ->
pathEditor.setAsText("classpath:/no_way_this_file_is_found.doc"));
}
@Test
void testWithNonExistentPath() {
void withNonExistentPath() {
PropertyEditor pathEditor = new PathEditor();
pathEditor.setAsText("file:/no_way_this_file_is_found.doc");
Object value = pathEditor.getValue();
@ -63,7 +63,7 @@ class PathEditorTests { @@ -63,7 +63,7 @@ class PathEditorTests {
}
@Test
void testAbsolutePath() {
void absolutePath() {
PropertyEditor pathEditor = new PathEditor();
pathEditor.setAsText("/no_way_this_file_is_found.doc");
Object value = pathEditor.getValue();
@ -73,7 +73,7 @@ class PathEditorTests { @@ -73,7 +73,7 @@ class PathEditorTests {
}
@Test
void testWindowsAbsolutePath() {
void windowsAbsolutePath() {
PropertyEditor pathEditor = new PathEditor();
pathEditor.setAsText("C:\\no_way_this_file_is_found.doc");
Object value = pathEditor.getValue();
@ -83,7 +83,7 @@ class PathEditorTests { @@ -83,7 +83,7 @@ class PathEditorTests {
}
@Test
void testWindowsAbsoluteFilePath() {
void windowsAbsoluteFilePath() {
PropertyEditor pathEditor = new PathEditor();
try {
pathEditor.setAsText("file://C:\\no_way_this_file_is_found.doc");
@ -100,7 +100,7 @@ class PathEditorTests { @@ -100,7 +100,7 @@ class PathEditorTests {
}
@Test
void testCurrentDirectory() {
void currentDirectory() {
PropertyEditor pathEditor = new PathEditor();
pathEditor.setAsText("file:.");
Object value = pathEditor.getValue();
@ -110,7 +110,7 @@ class PathEditorTests { @@ -110,7 +110,7 @@ class PathEditorTests {
}
@Test
void testUnqualifiedPathNameFound() {
void unqualifiedPathNameFound() {
PropertyEditor pathEditor = new PathEditor();
String fileName = ClassUtils.classPackageAsResourcePath(getClass()) + "/" +
ClassUtils.getShortName(getClass()) + ".class";
@ -128,7 +128,7 @@ class PathEditorTests { @@ -128,7 +128,7 @@ class PathEditorTests {
}
@Test
void testUnqualifiedPathNameNotFound() {
void unqualifiedPathNameNotFound() {
PropertyEditor pathEditor = new PathEditor();
String fileName = ClassUtils.classPackageAsResourcePath(getClass()) + "/" +
ClassUtils.getShortName(getClass()) + ".clazz";

8
spring-beans/src/test/java/org/springframework/beans/propertyeditors/ReaderEditorTests.java

@ -35,13 +35,13 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException @@ -35,13 +35,13 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class ReaderEditorTests {
@Test
void testCtorWithNullResourceEditor() {
void ctorWithNullResourceEditor() {
assertThatIllegalArgumentException().isThrownBy(() ->
new ReaderEditor(null));
}
@Test
void testSunnyDay() throws IOException {
void sunnyDay() throws IOException {
Reader reader = null;
try {
String resource = "classpath:" + ClassUtils.classPackageAsResourcePath(getClass()) +
@ -62,7 +62,7 @@ class ReaderEditorTests { @@ -62,7 +62,7 @@ class ReaderEditorTests {
}
@Test
void testWhenResourceDoesNotExist() {
void whenResourceDoesNotExist() {
String resource = "classpath:bingo!";
ReaderEditor editor = new ReaderEditor();
assertThatIllegalArgumentException().isThrownBy(() ->
@ -70,7 +70,7 @@ class ReaderEditorTests { @@ -70,7 +70,7 @@ class ReaderEditorTests {
}
@Test
void testGetAsTextReturnsNullByDefault() {
void getAsTextReturnsNullByDefault() {
assertThat(new ReaderEditor().getAsText()).isNull();
String resource = "classpath:" + ClassUtils.classPackageAsResourcePath(getClass()) +
"/" + ClassUtils.getShortName(getClass()) + ".class";

18
spring-beans/src/test/java/org/springframework/beans/propertyeditors/ResourceBundleEditorTests.java

@ -37,7 +37,7 @@ class ResourceBundleEditorTests { @@ -37,7 +37,7 @@ class ResourceBundleEditorTests {
@Test
void testSetAsTextWithJustBaseName() {
void setAsTextWithJustBaseName() {
ResourceBundleEditor editor = new ResourceBundleEditor();
editor.setAsText(BASE_NAME);
Object value = editor.getValue();
@ -49,7 +49,7 @@ class ResourceBundleEditorTests { @@ -49,7 +49,7 @@ class ResourceBundleEditorTests {
}
@Test
void testSetAsTextWithBaseNameThatEndsInDefaultSeparator() {
void setAsTextWithBaseNameThatEndsInDefaultSeparator() {
ResourceBundleEditor editor = new ResourceBundleEditor();
editor.setAsText(BASE_NAME + "_");
Object value = editor.getValue();
@ -61,7 +61,7 @@ class ResourceBundleEditorTests { @@ -61,7 +61,7 @@ class ResourceBundleEditorTests {
}
@Test
void testSetAsTextWithBaseNameAndLanguageCode() {
void setAsTextWithBaseNameAndLanguageCode() {
ResourceBundleEditor editor = new ResourceBundleEditor();
editor.setAsText(BASE_NAME + "Lang" + "_en");
Object value = editor.getValue();
@ -73,7 +73,7 @@ class ResourceBundleEditorTests { @@ -73,7 +73,7 @@ class ResourceBundleEditorTests {
}
@Test
void testSetAsTextWithBaseNameLanguageAndCountryCode() {
void setAsTextWithBaseNameLanguageAndCountryCode() {
ResourceBundleEditor editor = new ResourceBundleEditor();
editor.setAsText(BASE_NAME + "LangCountry" + "_en_GB");
Object value = editor.getValue();
@ -85,7 +85,7 @@ class ResourceBundleEditorTests { @@ -85,7 +85,7 @@ class ResourceBundleEditorTests {
}
@Test
void testSetAsTextWithTheKitchenSink() {
void setAsTextWithTheKitchenSink() {
ResourceBundleEditor editor = new ResourceBundleEditor();
editor.setAsText(BASE_NAME + "LangCountryDialect" + "_en_GB_GLASGOW");
Object value = editor.getValue();
@ -97,28 +97,28 @@ class ResourceBundleEditorTests { @@ -97,28 +97,28 @@ class ResourceBundleEditorTests {
}
@Test
void testSetAsTextWithNull() {
void setAsTextWithNull() {
ResourceBundleEditor editor = new ResourceBundleEditor();
assertThatIllegalArgumentException().isThrownBy(() ->
editor.setAsText(null));
}
@Test
void testSetAsTextWithEmptyString() {
void setAsTextWithEmptyString() {
ResourceBundleEditor editor = new ResourceBundleEditor();
assertThatIllegalArgumentException().isThrownBy(() ->
editor.setAsText(""));
}
@Test
void testSetAsTextWithWhiteSpaceString() {
void setAsTextWithWhiteSpaceString() {
ResourceBundleEditor editor = new ResourceBundleEditor();
assertThatIllegalArgumentException().isThrownBy(() ->
editor.setAsText(" "));
}
@Test
void testSetAsTextWithJustSeparatorString() {
void setAsTextWithJustSeparatorString() {
ResourceBundleEditor editor = new ResourceBundleEditor();
assertThatIllegalArgumentException().isThrownBy(() ->
editor.setAsText("_"));

14
spring-beans/src/test/java/org/springframework/beans/propertyeditors/URLEditorTests.java

@ -33,13 +33,13 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException @@ -33,13 +33,13 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
class URLEditorTests {
@Test
void testCtorWithNullResourceEditor() {
void ctorWithNullResourceEditor() {
assertThatIllegalArgumentException().isThrownBy(() ->
new URLEditor(null));
}
@Test
void testStandardURI() {
void standardURI() {
PropertyEditor urlEditor = new URLEditor();
urlEditor.setAsText("mailto:juergen.hoeller@interface21.com");
Object value = urlEditor.getValue();
@ -49,7 +49,7 @@ class URLEditorTests { @@ -49,7 +49,7 @@ class URLEditorTests {
}
@Test
void testStandardURL() {
void standardURL() {
PropertyEditor urlEditor = new URLEditor();
urlEditor.setAsText("https://www.springframework.org");
Object value = urlEditor.getValue();
@ -59,7 +59,7 @@ class URLEditorTests { @@ -59,7 +59,7 @@ class URLEditorTests {
}
@Test
void testClasspathURL() {
void classpathURL() {
PropertyEditor urlEditor = new URLEditor();
urlEditor.setAsText("classpath:" + ClassUtils.classPackageAsResourcePath(getClass()) +
"/" + ClassUtils.getShortName(getClass()) + ".class");
@ -71,14 +71,14 @@ class URLEditorTests { @@ -71,14 +71,14 @@ class URLEditorTests {
}
@Test
void testWithNonExistentResource() {
void withNonExistentResource() {
PropertyEditor urlEditor = new URLEditor();
assertThatIllegalArgumentException().isThrownBy(() ->
urlEditor.setAsText("gonna:/freak/in/the/morning/freak/in/the.evening"));
}
@Test
void testSetAsTextWithNull() {
void setAsTextWithNull() {
PropertyEditor urlEditor = new URLEditor();
urlEditor.setAsText(null);
assertThat(urlEditor.getValue()).isNull();
@ -86,7 +86,7 @@ class URLEditorTests { @@ -86,7 +86,7 @@ class URLEditorTests {
}
@Test
void testGetAsTextReturnsEmptyStringIfValueNotSet() {
void getAsTextReturnsEmptyStringIfValueNotSet() {
PropertyEditor urlEditor = new URLEditor();
assertThat(urlEditor.getAsText()).isEmpty();
}

2
spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java

@ -38,7 +38,7 @@ class PagedListHolderTests { @@ -38,7 +38,7 @@ class PagedListHolderTests {
@Test
@SuppressWarnings({ "rawtypes", "unchecked" })
public void testPagedListHolder() {
void pagedListHolder() {
TestBean tb1 = new TestBean();
tb1.setName("eva");
tb1.setAge(25);

8
spring-beans/src/test/java/org/springframework/beans/support/PropertyComparatorTests.java

@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class PropertyComparatorTests {
@Test
void testPropertyComparator() {
void propertyComparator() {
Dog dog = new Dog();
dog.setNickName("mace");
@ -47,7 +47,7 @@ class PropertyComparatorTests { @@ -47,7 +47,7 @@ class PropertyComparatorTests {
}
@Test
void testPropertyComparatorNulls() {
void propertyComparatorNulls() {
Dog dog = new Dog();
Dog dog2 = new Dog();
PropertyComparator<Dog> c = new PropertyComparator<>("nickName", false, true);
@ -55,7 +55,7 @@ class PropertyComparatorTests { @@ -55,7 +55,7 @@ class PropertyComparatorTests {
}
@Test
void testChainedComparators() {
void chainedComparators() {
Comparator<Dog> c = new PropertyComparator<>("lastName", false, true);
Dog dog1 = new Dog();
@ -76,7 +76,7 @@ class PropertyComparatorTests { @@ -76,7 +76,7 @@ class PropertyComparatorTests {
}
@Test
void testChainedComparatorsReversed() {
void chainedComparatorsReversed() {
Comparator<Dog> c = (new PropertyComparator<Dog>("lastName", false, true)).
thenComparing(new PropertyComparator<>("firstName", false, true));

8
spring-context-support/src/test/java/org/springframework/cache/caffeine/CaffeineCacheTests.java vendored

@ -66,7 +66,7 @@ class CaffeineCacheTests extends AbstractValueAdaptingCacheTests<CaffeineCache> @@ -66,7 +66,7 @@ class CaffeineCacheTests extends AbstractValueAdaptingCacheTests<CaffeineCache>
}
@Test
void testLoadingCacheGet() {
void loadingCacheGet() {
Object value = new Object();
CaffeineCache loadingCache = new CaffeineCache(CACHE_NAME, Caffeine.newBuilder()
.build(key -> value));
@ -76,7 +76,7 @@ class CaffeineCacheTests extends AbstractValueAdaptingCacheTests<CaffeineCache> @@ -76,7 +76,7 @@ class CaffeineCacheTests extends AbstractValueAdaptingCacheTests<CaffeineCache>
}
@Test
void testLoadingCacheGetWithType() {
void loadingCacheGetWithType() {
String value = "value";
CaffeineCache loadingCache = new CaffeineCache(CACHE_NAME, Caffeine.newBuilder()
.build(key -> value));
@ -86,7 +86,7 @@ class CaffeineCacheTests extends AbstractValueAdaptingCacheTests<CaffeineCache> @@ -86,7 +86,7 @@ class CaffeineCacheTests extends AbstractValueAdaptingCacheTests<CaffeineCache>
}
@Test
void testLoadingCacheGetWithWrongType() {
void loadingCacheGetWithWrongType() {
String value = "value";
CaffeineCache loadingCache = new CaffeineCache(CACHE_NAME, Caffeine.newBuilder()
.build(key -> value));
@ -94,7 +94,7 @@ class CaffeineCacheTests extends AbstractValueAdaptingCacheTests<CaffeineCache> @@ -94,7 +94,7 @@ class CaffeineCacheTests extends AbstractValueAdaptingCacheTests<CaffeineCache>
}
@Test
void testPutIfAbsentNullValue() {
void putIfAbsentNullValue() {
CaffeineCache cache = getCache();
Object key = new Object();

10
spring-context-support/src/test/java/org/springframework/cache/jcache/JCacheEhCacheAnnotationTests.java vendored

@ -78,26 +78,26 @@ class JCacheEhCacheAnnotationTests extends AbstractCacheAnnotationTests { @@ -78,26 +78,26 @@ class JCacheEhCacheAnnotationTests extends AbstractCacheAnnotationTests {
@Override
@Test
@Disabled("Multi cache manager support to be added")
public void testCustomCacheManager() {
protected void customCacheManager() {
}
@Test
void testEvictWithTransaction() {
void evictWithTransaction() {
txTemplate.executeWithoutResult(s -> testEvict(this.cs, false));
}
@Test
void testEvictEarlyWithTransaction() {
void evictEarlyWithTransaction() {
txTemplate.executeWithoutResult(s -> testEvictEarly(this.cs));
}
@Test
void testEvictAllWithTransaction() {
void evictAllWithTransaction() {
txTemplate.executeWithoutResult(s -> testEvictAll(this.cs, false));
}
@Test
void testEvictAllEarlyWithTransaction() {
void evictAllEarlyWithTransaction() {
txTemplate.executeWithoutResult(s -> testEvictAllEarly(this.cs));
}

2
spring-context-support/src/test/java/org/springframework/cache/jcache/JCacheEhCacheApiTests.java vendored

@ -82,7 +82,7 @@ class JCacheEhCacheApiTests extends AbstractValueAdaptingCacheTests<JCacheCache> @@ -82,7 +82,7 @@ class JCacheEhCacheApiTests extends AbstractValueAdaptingCacheTests<JCacheCache>
}
@Test
void testPutIfAbsentNullValue() {
void putIfAbsentNullValue() {
JCacheCache cache = getCache(true);
String key = createRandomKey();

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save