This commit is contained in:
Stéphane Nicoll 2024-01-03 16:34:07 +01:00
parent f846d9484c
commit 05ebca8677
218 changed files with 1576 additions and 1591 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -64,7 +64,7 @@ class AfterAdviceBindingTests {
}
@AfterEach
void tearDown() throws Exception {
void tearDown() {
this.ctx.close();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -62,14 +62,14 @@ class AfterThrowingAdviceBindingTests {
@Test
void simpleAfterThrowing() throws Throwable {
void simpleAfterThrowing() {
assertThatExceptionOfType(Throwable.class).isThrownBy(() ->
this.testBean.exceptional(new Throwable()));
verify(mockCollaborator).noArgs();
}
@Test
void afterThrowingWithBinding() throws Throwable {
void afterThrowingWithBinding() {
Throwable t = new Throwable();
assertThatExceptionOfType(Throwable.class).isThrownBy(() ->
this.testBean.exceptional(t));
@ -77,7 +77,7 @@ class AfterThrowingAdviceBindingTests {
}
@Test
void afterThrowingWithNamedTypeRestriction() throws Throwable {
void afterThrowingWithNamedTypeRestriction() {
Throwable t = new Throwable();
assertThatExceptionOfType(Throwable.class).isThrownBy(() ->
this.testBean.exceptional(t));
@ -87,7 +87,7 @@ class AfterThrowingAdviceBindingTests {
}
@Test
void afterThrowingWithRuntimeExceptionBinding() throws Throwable {
void afterThrowingWithRuntimeExceptionBinding() {
RuntimeException ex = new RuntimeException();
assertThatExceptionOfType(Throwable.class).isThrownBy(() ->
this.testBean.exceptional(ex));
@ -95,14 +95,14 @@ class AfterThrowingAdviceBindingTests {
}
@Test
void afterThrowingWithTypeSpecified() throws Throwable {
void afterThrowingWithTypeSpecified() {
assertThatExceptionOfType(Throwable.class).isThrownBy(() ->
this.testBean.exceptional(new Throwable()));
verify(mockCollaborator).noArgsOnThrowableMatch();
}
@Test
void afterThrowingWithRuntimeTypeSpecified() throws Throwable {
void afterThrowingWithRuntimeTypeSpecified() {
assertThatExceptionOfType(Throwable.class).isThrownBy(() ->
this.testBean.exceptional(new RuntimeException()));
verify(mockCollaborator).noArgsOnRuntimeExceptionMatch();
@ -123,7 +123,7 @@ final class AfterThrowingAdviceBindingTestAspect {
void noArgsOnRuntimeExceptionMatch();
}
protected AfterThrowingAdviceBindingCollaborator collaborator = null;
AfterThrowingAdviceBindingCollaborator collaborator = null;
public void setCollaborator(AfterThrowingAdviceBindingCollaborator aCollaborator) {
this.collaborator = aCollaborator;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -242,8 +242,7 @@ class SimpleSpringBeforeAdvice implements MethodBeforeAdvice, BeanNameAware {
* @see org.springframework.aop.MethodBeforeAdvice#before(java.lang.reflect.Method, java.lang.Object[], java.lang.Object)
*/
@Override
public void before(Method method, Object[] args, @Nullable Object target)
throws Throwable {
public void before(Method method, Object[] args, @Nullable Object target) {
this.collaborator.beforeAdviceOne(this.name);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -139,7 +139,7 @@ class BeanNamePointcutTests {
private int interceptionCount;
@Override
public void before(Method method, Object[] args, @Nullable Object target) throws Throwable {
public void before(Method method, Object[] args, @Nullable Object target) {
interceptionCount++;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -119,7 +119,7 @@ class ThisAndTargetSelectionOnlyPointcutsAtAspectJTests {
}
interface TestInterface {
public void doIt();
void doIt();
}
static class TestImpl implements TestInterface {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -107,7 +107,7 @@ class ThisAndTargetSelectionOnlyPointcutsTests {
interface TestInterface {
public void doIt();
void doIt();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,7 +23,7 @@ import org.aspectj.lang.ProceedingJoinPoint;
*/
class AnnotationBindingTestAspect {
public String doWithAnnotation(ProceedingJoinPoint pjp, TestAnnotation testAnnotation) throws Throwable {
public String doWithAnnotation(ProceedingJoinPoint pjp, TestAnnotation testAnnotation) {
return testAnnotation.value();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -65,7 +65,7 @@ class AnnotationPointcutTests {
class TestMethodInterceptor implements MethodInterceptor {
@Override
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
public Object invoke(MethodInvocation methodInvocation) {
return "this value";
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -51,7 +51,7 @@ class AspectImplementingInterfaceTests {
interface AnInterface {
public void interfaceMethod();
void interfaceMethod();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -226,7 +226,7 @@ class TraceAfterReturningAdvice implements AfterReturningAdvice {
public int afterTakesInt;
@Override
public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable {
public void afterReturning(Object returnValue, Method method, Object[] args, Object target) {
++afterTakesInt;
}
@ -270,7 +270,7 @@ class TraceBeforeAdvice implements MethodBeforeAdvice {
public int beforeStringReturn;
@Override
public void before(Method method, Object[] args, Object target) throws Throwable {
public void before(Method method, Object[] args, Object target) {
++beforeStringReturn;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -59,7 +59,7 @@ class SPR3064Tests {
class TransactionInterceptor {
@Around(value="execution(* *..Service.*(..)) && @annotation(transaction)")
public Object around(ProceedingJoinPoint pjp, Transaction transaction) throws Throwable {
public Object around(ProceedingJoinPoint pjp, Transaction transaction) {
throw new RuntimeException("advice invoked");
//return pjp.proceed();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -157,11 +157,11 @@ class CountingAspectJAdvice {
private int aroundCount;
public void myBeforeAdvice() throws Throwable {
public void myBeforeAdvice() {
this.beforeCount++;
}
public void myAfterAdvice() throws Throwable {
public void myAfterAdvice() {
this.afterCount++;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -96,12 +96,12 @@ public abstract class AbstractAopProxyTests {
* to ensure that it was used appropriately by code.
*/
@BeforeEach
public void reset() {
void reset() {
mockTargetSource.reset();
}
@AfterEach
public void verify() {
void verify() {
mockTargetSource.verify();
}
@ -125,7 +125,7 @@ public abstract class AbstractAopProxyTests {
* Simple test that if we set values we can get them out again.
*/
@Test
public void testValuesStick() {
void testValuesStick() {
int age1 = 33;
int age2 = 37;
String name = "tony";
@ -146,7 +146,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testSerializationAdviceAndTargetNotSerializable() throws Exception {
void testSerializationAdviceAndTargetNotSerializable() throws Exception {
TestBean tb = new TestBean();
assertThat(SerializationTestUtils.isSerializable(tb)).isFalse();
@ -159,7 +159,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testSerializationAdviceNotSerializable() throws Exception {
void testSerializationAdviceNotSerializable() throws Exception {
SerializablePerson sp = new SerializablePerson();
assertThat(SerializationTestUtils.isSerializable(sp)).isTrue();
@ -175,7 +175,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testSerializableTargetAndAdvice() throws Throwable {
void testSerializableTargetAndAdvice() throws Throwable {
SerializablePerson personTarget = new SerializablePerson();
personTarget.setName("jim");
personTarget.setAge(26);
@ -245,7 +245,7 @@ public abstract class AbstractAopProxyTests {
* Check also proxy exposure.
*/
@Test
public void testOneAdvisedObjectCallsAnother() {
void testOneAdvisedObjectCallsAnother() {
int age1 = 33;
int age2 = 37;
@ -290,7 +290,7 @@ public abstract class AbstractAopProxyTests {
@Test
public void testReentrance() {
void testReentrance() {
int age1 = 33;
TestBean target1 = new TestBean();
@ -314,7 +314,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testTargetCanGetProxy() {
void testTargetCanGetProxy() {
NopInterceptor di = new NopInterceptor();
INeedsToSeeProxy target = new TargetChecker();
ProxyFactory proxyFactory = new ProxyFactory(target);
@ -343,24 +343,23 @@ public abstract class AbstractAopProxyTests {
ProxyFactory pf1 = new ProxyFactory(et);
assertThat(pf1.isExposeProxy()).isFalse();
INeedsToSeeProxy proxied = (INeedsToSeeProxy) createProxy(pf1);
assertThatIllegalStateException().isThrownBy(() ->
proxied.incrementViaProxy());
assertThatIllegalStateException().isThrownBy(proxied::incrementViaProxy);
}
@Test
public void testContext() throws Throwable {
void testContext() {
testContext(true);
}
@Test
public void testNoContext() throws Throwable {
void testNoContext() {
testContext(false);
}
/**
* @param context if true, want context
*/
private void testContext(final boolean context) throws Throwable {
private void testContext(final boolean context) {
final String s = "foo";
// Test return value
MethodInterceptor mi = invocation -> {
@ -394,7 +393,7 @@ public abstract class AbstractAopProxyTests {
* target returns {@code this}
*/
@Test
public void testTargetReturnsThis() throws Throwable {
void testTargetReturnsThis() {
// Test return value
TestBean raw = new OwnSpouse();
@ -407,7 +406,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testDeclaredException() throws Throwable {
void testDeclaredException() {
final Exception expectedException = new Exception();
// Test return value
MethodInterceptor mi = invocation -> {
@ -435,7 +434,7 @@ public abstract class AbstractAopProxyTests {
* org.springframework.cglib UndeclaredThrowableException
*/
@Test
public void testUndeclaredCheckedException() throws Throwable {
void testUndeclaredCheckedException() {
final Exception unexpectedException = new Exception();
// Test return value
MethodInterceptor mi = invocation -> {
@ -455,7 +454,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testUndeclaredUncheckedException() throws Throwable {
void testUndeclaredUncheckedException() {
final RuntimeException unexpectedException = new RuntimeException();
// Test return value
MethodInterceptor mi = invocation -> {
@ -481,7 +480,7 @@ public abstract class AbstractAopProxyTests {
* so as to guarantee a consistent programming model.
*/
@Test
public void testTargetCanGetInvocationEvenIfNoAdviceChain() throws Throwable {
void testTargetCanGetInvocationEvenIfNoAdviceChain() {
NeedsToSeeProxy target = new NeedsToSeeProxy();
AdvisedSupport pc = new AdvisedSupport(INeedsToSeeProxy.class);
pc.setTarget(target);
@ -495,7 +494,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testTargetCanGetInvocation() throws Throwable {
void testTargetCanGetInvocation() {
final InvocationCheckExposedInvocationTestBean expectedTarget = new InvocationCheckExposedInvocationTestBean();
AdvisedSupport pc = new AdvisedSupport(ITestBean.class, IOther.class);
@ -528,7 +527,7 @@ public abstract class AbstractAopProxyTests {
* Test stateful interceptor
*/
@Test
public void testMixinWithIntroductionAdvisor() throws Throwable {
void testMixinWithIntroductionAdvisor() {
TestBean tb = new TestBean();
ProxyFactory pc = new ProxyFactory();
pc.addInterface(ITestBean.class);
@ -539,7 +538,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testMixinWithIntroductionInfo() throws Throwable {
void testMixinWithIntroductionInfo() {
TestBean tb = new TestBean();
ProxyFactory pc = new ProxyFactory();
pc.addInterface(ITestBean.class);
@ -572,7 +571,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testReplaceArgument() throws Throwable {
void testReplaceArgument() {
TestBean tb = new TestBean();
ProxyFactory pc = new ProxyFactory();
pc.addInterface(ITestBean.class);
@ -593,7 +592,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testCanCastProxyToProxyConfig() throws Throwable {
void testCanCastProxyToProxyConfig() {
TestBean tb = new TestBean();
ProxyFactory pc = new ProxyFactory(tb);
NopInterceptor di = new NopInterceptor();
@ -629,7 +628,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testAdviceImplementsIntroductionInfo() throws Throwable {
void testAdviceImplementsIntroductionInfo() {
TestBean tb = new TestBean();
String name = "tony";
tb.setName(name);
@ -646,7 +645,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testCannotAddDynamicIntroductionAdviceExceptInIntroductionAdvice() throws Throwable {
void testCannotAddDynamicIntroductionAdviceExceptInIntroductionAdvice() {
TestBean target = new TestBean();
target.setAge(21);
ProxyFactory pc = new ProxyFactory(target);
@ -659,7 +658,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testRejectsBogusDynamicIntroductionAdviceWithNoAdapter() throws Throwable {
void testRejectsBogusDynamicIntroductionAdviceWithNoAdapter() {
TestBean target = new TestBean();
target.setAge(21);
ProxyFactory pc = new ProxyFactory(target);
@ -680,7 +679,7 @@ public abstract class AbstractAopProxyTests {
* that are unsupported by the IntroductionInterceptor.
*/
@Test
public void testCannotAddIntroductionAdviceWithUnimplementedInterface() throws Throwable {
void testCannotAddIntroductionAdviceWithUnimplementedInterface() {
TestBean target = new TestBean();
target.setAge(21);
ProxyFactory pc = new ProxyFactory(target);
@ -696,7 +695,7 @@ public abstract class AbstractAopProxyTests {
* as it's constrained by the interface.
*/
@Test
public void testIntroductionThrowsUncheckedException() throws Throwable {
void testIntroductionThrowsUncheckedException() {
TestBean target = new TestBean();
target.setAge(21);
ProxyFactory pc = new ProxyFactory(target);
@ -721,7 +720,7 @@ public abstract class AbstractAopProxyTests {
* Should only be able to introduce interfaces, not classes.
*/
@Test
public void testCannotAddIntroductionAdviceToIntroduceClass() throws Throwable {
void testCannotAddIntroductionAdviceToIntroduceClass() {
TestBean target = new TestBean();
target.setAge(21);
ProxyFactory pc = new ProxyFactory(target);
@ -734,7 +733,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testCannotAddInterceptorWhenFrozen() throws Throwable {
void testCannotAddInterceptorWhenFrozen() {
TestBean target = new TestBean();
target.setAge(21);
ProxyFactory pc = new ProxyFactory(target);
@ -754,7 +753,7 @@ public abstract class AbstractAopProxyTests {
* Check that casting to Advised can't get around advice freeze.
*/
@Test
public void testCannotAddAdvisorWhenFrozenUsingCast() throws Throwable {
void testCannotAddAdvisorWhenFrozenUsingCast() {
TestBean target = new TestBean();
target.setAge(21);
ProxyFactory pc = new ProxyFactory(target);
@ -774,7 +773,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testCannotRemoveAdvisorWhenFrozen() throws Throwable {
void testCannotRemoveAdvisorWhenFrozen() {
TestBean target = new TestBean();
target.setAge(21);
ProxyFactory pc = new ProxyFactory(target);
@ -799,7 +798,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testUseAsHashKey() {
void testUseAsHashKey() {
TestBean target1 = new TestBean();
ProxyFactory pf1 = new ProxyFactory(target1);
pf1.addAdvice(new NopInterceptor());
@ -824,7 +823,7 @@ public abstract class AbstractAopProxyTests {
* Check that the string is informative.
*/
@Test
public void testProxyConfigString() {
void testProxyConfigString() {
TestBean target = new TestBean();
ProxyFactory pc = new ProxyFactory(target);
pc.setInterfaces(ITestBean.class);
@ -840,7 +839,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testCanPreventCastToAdvisedUsingOpaque() {
void testCanPreventCastToAdvisedUsingOpaque() {
TestBean target = new TestBean();
ProxyFactory pc = new ProxyFactory(target);
pc.setInterfaces(ITestBean.class);
@ -861,7 +860,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testAdviceSupportListeners() throws Throwable {
void testAdviceSupportListeners() {
TestBean target = new TestBean();
target.setAge(21);
@ -900,7 +899,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testExistingProxyChangesTarget() throws Throwable {
void testExistingProxyChangesTarget() {
TestBean tb1 = new TestBean();
tb1.setAge(33);
@ -943,7 +942,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testDynamicMethodPointcutThatAlwaysAppliesStatically() throws Throwable {
void testDynamicMethodPointcutThatAlwaysAppliesStatically() {
TestBean tb = new TestBean();
ProxyFactory pc = new ProxyFactory();
pc.addInterface(ITestBean.class);
@ -960,7 +959,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testDynamicMethodPointcutThatAppliesStaticallyOnlyToSetters() throws Throwable {
void testDynamicMethodPointcutThatAppliesStaticallyOnlyToSetters() {
TestBean tb = new TestBean();
ProxyFactory pc = new ProxyFactory();
pc.addInterface(ITestBean.class);
@ -983,7 +982,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testStaticMethodPointcut() throws Throwable {
void testStaticMethodPointcut() {
TestBean tb = new TestBean();
ProxyFactory pc = new ProxyFactory();
pc.addInterface(ITestBean.class);
@ -1005,7 +1004,7 @@ public abstract class AbstractAopProxyTests {
* We can do this if we clone the invocation.
*/
@Test
public void testCloneInvocationToProceedThreeTimes() throws Throwable {
void testCloneInvocationToProceedThreeTimes() {
TestBean tb = new TestBean();
ProxyFactory pc = new ProxyFactory(tb);
pc.addInterface(ITestBean.class);
@ -1042,14 +1041,11 @@ public abstract class AbstractAopProxyTests {
* We want to change the arguments on a clone: it shouldn't affect the original.
*/
@Test
public void testCanChangeArgumentsIndependentlyOnClonedInvocation() throws Throwable {
void testCanChangeArgumentsIndependentlyOnClonedInvocation() {
TestBean tb = new TestBean();
ProxyFactory pc = new ProxyFactory(tb);
pc.addInterface(ITestBean.class);
/**
* Changes the name, then changes it back.
*/
MethodInterceptor nameReverter = mi -> {
MethodInvocation clone = ((ReflectiveMethodInvocation) mi).invocableClone();
String oldName = ((ITestBean) mi.getThis()).getName();
@ -1084,14 +1080,12 @@ public abstract class AbstractAopProxyTests {
it.setName(name2);
// NameReverter saved it back
assertThat(it.getName()).isEqualTo(name1);
assertThat(saver.names).hasSize(2);
assertThat(saver.names).element(0).isEqualTo(name2);
assertThat(saver.names).element(1).isEqualTo(name1);
assertThat(saver.names).containsExactly(name2, name1);
}
@SuppressWarnings("serial")
@Test
public void testOverloadedMethodsWithDifferentAdvice() throws Throwable {
void testOverloadedMethodsWithDifferentAdvice() {
Overloads target = new Overloads();
ProxyFactory pc = new ProxyFactory(target);
@ -1127,7 +1121,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testProxyIsBoundBeforeTargetSourceInvoked() {
void testProxyIsBoundBeforeTargetSourceInvoked() {
final TestBean target = new TestBean();
ProxyFactory pf = new ProxyFactory(target);
pf.addAdvice(new DebugInterceptor());
@ -1142,7 +1136,7 @@ public abstract class AbstractAopProxyTests {
return TestBean.class;
}
@Override
public Object getTarget() throws Exception {
public Object getTarget() {
assertThat(AopContext.currentProxy()).isEqualTo(proxy);
return target;
}
@ -1153,7 +1147,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testEquals() {
void testEquals() {
IOther a = new AllInstancesAreEqual();
IOther b = new AllInstancesAreEqual();
NopInterceptor i1 = new NopInterceptor();
@ -1183,7 +1177,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testBeforeAdvisorIsInvoked() {
void testBeforeAdvisorIsInvoked() {
CountingBeforeAdvice cba = new CountingBeforeAdvice();
@SuppressWarnings("serial")
Advisor matchesNoArgs = new StaticMethodMatcherPointcutAdvisor(cba) {
@ -1212,7 +1206,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testUserAttributes() throws Throwable {
void testUserAttributes() {
class MapAwareMethodInterceptor implements MethodInterceptor {
private final Map<String, String> expectedValues;
private final Map<String, String> valuesToAdd;
@ -1263,7 +1257,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testMultiAdvice() throws Throwable {
void testMultiAdvice() {
CountingMultiAdvice cca = new CountingMultiAdvice();
@SuppressWarnings("serial")
Advisor matchesNoArgs = new StaticMethodMatcherPointcutAdvisor(cca) {
@ -1297,7 +1291,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testBeforeAdviceThrowsException() {
void testBeforeAdviceThrowsException() {
final RuntimeException rex = new RuntimeException();
@SuppressWarnings("serial")
CountingBeforeAdvice ba = new CountingBeforeAdvice() {
@ -1339,11 +1333,11 @@ public abstract class AbstractAopProxyTests {
@Test
public void testAfterReturningAdvisorIsInvoked() {
void testAfterReturningAdvisorIsInvoked() {
class SummingAfterAdvice implements AfterReturningAdvice {
public int sum;
@Override
public void afterReturning(@Nullable Object returnValue, Method m, Object[] args, @Nullable Object target) throws Throwable {
public void afterReturning(@Nullable Object returnValue, Method m, Object[] args, @Nullable Object target) {
sum += (Integer) returnValue;
}
}
@ -1376,7 +1370,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testAfterReturningAdvisorIsNotInvokedOnException() {
void testAfterReturningAdvisorIsNotInvokedOnException() {
CountingAfterReturningAdvice car = new CountingAfterReturningAdvice();
TestBean target = new TestBean();
ProxyFactory pf = new ProxyFactory(target);
@ -1398,7 +1392,7 @@ public abstract class AbstractAopProxyTests {
@Test
public void testThrowsAdvisorIsInvoked() throws Throwable {
void testThrowsAdvisorIsInvoked() {
// Reacts to ServletException and RemoteException
MyThrowsHandler th = new MyThrowsHandler();
@SuppressWarnings("serial")
@ -1431,7 +1425,7 @@ public abstract class AbstractAopProxyTests {
}
@Test
public void testAddThrowsAdviceWithoutAdvisor() throws Throwable {
void testAddThrowsAdviceWithoutAdvisor() {
// Reacts to ServletException and RemoteException
MyThrowsHandler th = new MyThrowsHandler();
@ -1790,21 +1784,20 @@ public abstract class AbstractAopProxyTests {
AfterReturningAdvice, ThrowsAdvice {
@Override
public void before(Method m, Object[] args, @Nullable Object target) throws Throwable {
public void before(Method m, Object[] args, @Nullable Object target) {
count(m);
}
@Override
public void afterReturning(@Nullable Object o, Method m, Object[] args, @Nullable Object target)
throws Throwable {
public void afterReturning(@Nullable Object o, Method m, Object[] args, @Nullable Object target) {
count(m);
}
public void afterThrowing(IOException ex) throws Throwable {
public void afterThrowing(IOException ex) {
count(IOException.class.getName());
}
public void afterThrowing(UncheckedException ex) throws Throwable {
public void afterThrowing(UncheckedException ex) {
count(UncheckedException.class.getName());
}
@ -1814,11 +1807,11 @@ public abstract class AbstractAopProxyTests {
@SuppressWarnings("serial")
public static class CountingThrowsAdvice extends MethodCounter implements ThrowsAdvice {
public void afterThrowing(IOException ex) throws Throwable {
public void afterThrowing(IOException ex) {
count(IOException.class.getName());
}
public void afterThrowing(UncheckedException ex) throws Throwable {
public void afterThrowing(UncheckedException ex) {
count(UncheckedException.class.getName());
}
@ -1869,7 +1862,7 @@ public abstract class AbstractAopProxyTests {
* @see org.springframework.aop.TargetSource#getTarget()
*/
@Override
public Object getTarget() throws Exception {
public Object getTarget() {
++gets;
return target;
}
@ -1878,7 +1871,7 @@ public abstract class AbstractAopProxyTests {
* @see org.springframework.aop.TargetSource#releaseTarget(java.lang.Object)
*/
@Override
public void releaseTarget(Object pTarget) throws Exception {
public void releaseTarget(Object pTarget) {
if (pTarget != this.target) {
throw new RuntimeException("Released wrong target");
}

View File

@ -458,13 +458,13 @@ class CglibProxyTests extends AbstractAopProxyTests {
public enum MyEnum implements MyInterface {
A, B;
A, B
}
public enum MyOtherEnum implements MyInterface {
C, D;
C, D
}
@ -482,7 +482,7 @@ class CglibProxyTests extends AbstractAopProxyTests {
return finallyInvoked;
}
public void doTest() throws Exception {
public void doTest() {
try {
throw new ApplicationContextException("foo");
}
@ -586,7 +586,7 @@ class CglibTestBean {
class UnsupportedInterceptor implements MethodInterceptor {
@Override
public Object invoke(MethodInvocation mi) throws Throwable {
public Object invoke(MethodInvocation mi) {
throw new UnsupportedOperationException(mi.getMethod().getName());
}
}

View File

@ -239,13 +239,13 @@ class JdkDynamicProxyTests extends AbstractAopProxyTests {
public enum MyEnum implements MyInterface {
A, B;
A, B
}
public enum MyOtherEnum implements MyInterface {
C, D;
C, D
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -92,7 +92,7 @@ class ProxyFactoryBeanTests {
@BeforeEach
void setup() throws Exception {
void setup() {
DefaultListableBeanFactory parent = new DefaultListableBeanFactory();
parent.registerBeanDefinition("target2", new RootBeanDefinition(TestApplicationListener.class));
this.factory = new DefaultListableBeanFactory(parent);
@ -425,13 +425,12 @@ class ProxyFactoryBeanTests {
tb.getAge();
tb.setName("Tristan");
tb.toString();
assertThat(PointcutForVoid.methodNames).as("Recorded wrong number of invocations").hasSize(2);
assertThat(PointcutForVoid.methodNames).element(0).isEqualTo("setAge");
assertThat(PointcutForVoid.methodNames).element(1).isEqualTo("setName");
assertThat(PointcutForVoid.methodNames).as("Recorded wrong number of invocations")
.containsExactly("setAge", "setName");
}
@Test
void testCanAddThrowsAdviceWithoutAdvisor() throws Throwable {
void testCanAddThrowsAdviceWithoutAdvisor() {
DefaultListableBeanFactory f = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(f).loadBeanDefinitions(new ClassPathResource(THROWS_ADVICE_CONTEXT, CLASS));
MyThrowsHandler th = (MyThrowsHandler) f.getBean("throwsAdvice");

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -81,7 +81,7 @@ class AdvisorAdapterRegistrationTests {
interface SimpleBeforeAdvice extends BeforeAdvice {
void before() throws Throwable;
void before();
}
@ -108,7 +108,7 @@ class SimpleBeforeAdviceImpl implements SimpleBeforeAdvice {
private int invocationCounter;
@Override
public void before() throws Throwable {
public void before() {
++invocationCounter;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,8 +16,6 @@
package org.springframework.aop.framework.autoproxy;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import org.springframework.aop.Advisor;
@ -63,7 +61,7 @@ class AdvisorAutoProxyCreatorTests {
/**
* Return a bean factory with attributes and EnterpriseServices configured.
*/
protected BeanFactory getBeanFactory() throws IOException {
protected BeanFactory getBeanFactory() {
return new ClassPathXmlApplicationContext(DEFAULT_CONTEXT, CLASS);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -57,7 +57,7 @@ class BeanNameAutoProxyCreatorInitTests {
class NullChecker implements MethodBeforeAdvice {
@Override
public void before(Method method, Object[] args, @Nullable Object target) throws Throwable {
public void before(Method method, Object[] args, @Nullable Object target) {
check(args);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -198,7 +198,7 @@ class BeanNameAutoProxyCreatorTests {
class CreatesTestBean implements FactoryBean<Object> {
@Override
public Object getObject() throws Exception {
public Object getObject() {
return new TestBean();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -56,7 +56,7 @@ class CommonsPool2TargetSourceTests {
private DefaultListableBeanFactory beanFactory;
@BeforeEach
void setUp() throws Exception {
void setUp() {
this.beanFactory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions(
new ClassPathResource(getClass().getSimpleName() + "-context.xml", getClass()));

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Juergen Hoeller
* @since 3.0
*/
public class InjectAnnotationAutowireContextTests {
class InjectAnnotationAutowireContextTests {
private static final String JUERGEN = "juergen";
@ -52,7 +52,7 @@ public class InjectAnnotationAutowireContextTests {
@Test
public void testAutowiredFieldWithSingleNonQualifiedCandidate() {
void testAutowiredFieldWithSingleNonQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
@ -70,7 +70,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredMethodParameterWithSingleNonQualifiedCandidate() {
void testAutowiredMethodParameterWithSingleNonQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
@ -88,7 +88,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredConstructorArgumentWithSingleNonQualifiedCandidate() {
void testAutowiredConstructorArgumentWithSingleNonQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
@ -103,7 +103,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredFieldWithSingleQualifiedCandidate() {
void testAutowiredFieldWithSingleQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
@ -118,7 +118,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredMethodParameterWithSingleQualifiedCandidate() {
void testAutowiredMethodParameterWithSingleQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
@ -135,7 +135,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredMethodParameterWithStaticallyQualifiedCandidate() {
void testAutowiredMethodParameterWithStaticallyQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
@ -152,7 +152,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredMethodParameterWithStaticallyQualifiedCandidateAmongOthers() {
void testAutowiredMethodParameterWithStaticallyQualifiedCandidateAmongOthers() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
@ -172,7 +172,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredConstructorArgumentWithSingleQualifiedCandidate() {
void testAutowiredConstructorArgumentWithSingleQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
@ -189,7 +189,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredFieldWithMultipleNonQualifiedCandidates() {
void testAutowiredFieldWithMultipleNonQualifiedCandidates() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -211,7 +211,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredMethodParameterWithMultipleNonQualifiedCandidates() {
void testAutowiredMethodParameterWithMultipleNonQualifiedCandidates() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -233,7 +233,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredConstructorArgumentWithMultipleNonQualifiedCandidates() {
void testAutowiredConstructorArgumentWithMultipleNonQualifiedCandidates() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -252,7 +252,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredFieldResolvesQualifiedCandidate() {
void testAutowiredFieldResolvesQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -272,7 +272,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredMethodParameterResolvesQualifiedCandidate() {
void testAutowiredMethodParameterResolvesQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -293,7 +293,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredConstructorArgumentResolvesQualifiedCandidate() {
void testAutowiredConstructorArgumentResolvesQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -314,7 +314,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredFieldResolvesQualifiedCandidateWithDefaultValueAndNoValueOnBeanDefinition() {
void testAutowiredFieldResolvesQualifiedCandidateWithDefaultValueAndNoValueOnBeanDefinition() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -336,7 +336,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredFieldDoesNotResolveCandidateWithDefaultValueAndConflictingValueOnBeanDefinition() {
void testAutowiredFieldDoesNotResolveCandidateWithDefaultValueAndConflictingValueOnBeanDefinition() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -360,7 +360,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredFieldResolvesWithDefaultValueAndExplicitDefaultValueOnBeanDefinition() {
void testAutowiredFieldResolvesWithDefaultValueAndExplicitDefaultValueOnBeanDefinition() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -382,7 +382,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredFieldResolvesWithMultipleQualifierValues() {
void testAutowiredFieldResolvesWithMultipleQualifierValues() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -408,7 +408,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredFieldDoesNotResolveWithMultipleQualifierValuesAndConflictingDefaultValue() {
void testAutowiredFieldDoesNotResolveWithMultipleQualifierValuesAndConflictingDefaultValue() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -437,7 +437,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredFieldResolvesWithMultipleQualifierValuesAndExplicitDefaultValue() {
void testAutowiredFieldResolvesWithMultipleQualifierValuesAndExplicitDefaultValue() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -464,7 +464,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredFieldDoesNotResolveWithMultipleQualifierValuesAndMultipleMatchingCandidates() {
void testAutowiredFieldDoesNotResolveWithMultipleQualifierValuesAndMultipleMatchingCandidates() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -493,7 +493,7 @@ public class InjectAnnotationAutowireContextTests {
}
@Test
public void testAutowiredFieldDoesNotResolveWithBaseQualifierAndNonDefaultValueAndMultipleMatchingCandidates() {
void testAutowiredFieldDoesNotResolveWithBaseQualifierAndNonDefaultValueAndMultipleMatchingCandidates() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue("the real juergen");

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Chris Beams
* @author Sam Brannen
*/
public class QualifierAnnotationAutowireContextTests {
class QualifierAnnotationAutowireContextTests {
private static final String JUERGEN = "juergen";
@ -53,7 +53,7 @@ public class QualifierAnnotationAutowireContextTests {
@Test
public void autowiredFieldWithSingleNonQualifiedCandidate() {
void autowiredFieldWithSingleNonQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
@ -72,7 +72,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredMethodParameterWithSingleNonQualifiedCandidate() {
void autowiredMethodParameterWithSingleNonQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
@ -91,7 +91,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredConstructorArgumentWithSingleNonQualifiedCandidate() {
void autowiredConstructorArgumentWithSingleNonQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
@ -106,7 +106,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredFieldWithSingleQualifiedCandidate() {
void autowiredFieldWithSingleQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
@ -121,7 +121,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredMethodParameterWithSingleQualifiedCandidate() {
void autowiredMethodParameterWithSingleQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
@ -138,7 +138,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredMethodParameterWithStaticallyQualifiedCandidate() {
void autowiredMethodParameterWithStaticallyQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
@ -155,7 +155,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredMethodParameterWithStaticallyQualifiedCandidateAmongOthers() {
void autowiredMethodParameterWithStaticallyQualifiedCandidateAmongOthers() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
@ -175,7 +175,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredConstructorArgumentWithSingleQualifiedCandidate() {
void autowiredConstructorArgumentWithSingleQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addGenericArgumentValue(JUERGEN);
@ -192,7 +192,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredFieldWithMultipleNonQualifiedCandidates() {
void autowiredFieldWithMultipleNonQualifiedCandidates() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -214,7 +214,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredMethodParameterWithMultipleNonQualifiedCandidates() {
void autowiredMethodParameterWithMultipleNonQualifiedCandidates() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -236,7 +236,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredConstructorArgumentWithMultipleNonQualifiedCandidates() {
void autowiredConstructorArgumentWithMultipleNonQualifiedCandidates() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -255,7 +255,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredFieldResolvesQualifiedCandidate() {
void autowiredFieldResolvesQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -275,7 +275,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredFieldResolvesMetaQualifiedCandidate() {
void autowiredFieldResolvesMetaQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -295,7 +295,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredMethodParameterResolvesQualifiedCandidate() {
void autowiredMethodParameterResolvesQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -316,7 +316,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredConstructorArgumentResolvesQualifiedCandidate() {
void autowiredConstructorArgumentResolvesQualifiedCandidate() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -337,7 +337,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredFieldResolvesQualifiedCandidateWithDefaultValueAndNoValueOnBeanDefinition() {
void autowiredFieldResolvesQualifiedCandidateWithDefaultValueAndNoValueOnBeanDefinition() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -359,7 +359,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredFieldDoesNotResolveCandidateWithDefaultValueAndConflictingValueOnBeanDefinition() {
void autowiredFieldDoesNotResolveCandidateWithDefaultValueAndConflictingValueOnBeanDefinition() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -383,7 +383,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredFieldResolvesWithDefaultValueAndExplicitDefaultValueOnBeanDefinition() {
void autowiredFieldResolvesWithDefaultValueAndExplicitDefaultValueOnBeanDefinition() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -405,7 +405,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredFieldResolvesWithMultipleQualifierValues() {
void autowiredFieldResolvesWithMultipleQualifierValues() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -431,7 +431,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredFieldDoesNotResolveWithMultipleQualifierValuesAndConflictingDefaultValue() {
void autowiredFieldDoesNotResolveWithMultipleQualifierValuesAndConflictingDefaultValue() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -460,7 +460,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredFieldResolvesWithMultipleQualifierValuesAndExplicitDefaultValue() {
void autowiredFieldResolvesWithMultipleQualifierValuesAndExplicitDefaultValue() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -487,7 +487,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredFieldDoesNotResolveWithMultipleQualifierValuesAndMultipleMatchingCandidates() {
void autowiredFieldDoesNotResolveWithMultipleQualifierValuesAndMultipleMatchingCandidates() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -516,7 +516,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredFieldResolvesWithBaseQualifierAndDefaultValue() {
void autowiredFieldResolvesWithBaseQualifierAndDefaultValue() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue(JUERGEN);
@ -537,7 +537,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredFieldResolvesWithBaseQualifierAndNonDefaultValue() {
void autowiredFieldResolvesWithBaseQualifierAndNonDefaultValue() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue("the real juergen");
@ -559,7 +559,7 @@ public class QualifierAnnotationAutowireContextTests {
}
@Test
public void autowiredFieldDoesNotResolveWithBaseQualifierAndNonDefaultValueAndMultipleMatchingCandidates() {
void autowiredFieldDoesNotResolveWithBaseQualifierAndNonDefaultValueAndMultipleMatchingCandidates() {
GenericApplicationContext context = new GenericApplicationContext();
ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
cavs1.addGenericArgumentValue("the real juergen");

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Juergen Hoeller
* @author Chris Beams
*/
public class LookupMethodWrappedByCglibProxyTests {
class LookupMethodWrappedByCglibProxyTests {
private static final Class<?> CLASS = LookupMethodWrappedByCglibProxyTests.class;
private static final String CLASSNAME = CLASS.getSimpleName();
@ -43,13 +43,13 @@ public class LookupMethodWrappedByCglibProxyTests {
private ApplicationContext applicationContext;
@BeforeEach
public void setUp() {
void setUp() {
this.applicationContext = new ClassPathXmlApplicationContext(CONTEXT, CLASS);
resetInterceptor();
}
@Test
public void testAutoProxiedLookup() {
void testAutoProxiedLookup() {
OverloadLookup olup = (OverloadLookup) applicationContext.getBean("autoProxiedOverload");
ITestBean jenny = olup.newTestBean();
assertThat(jenny.getName()).isEqualTo("Jenny");
@ -58,7 +58,7 @@ public class LookupMethodWrappedByCglibProxyTests {
}
@Test
public void testRegularlyProxiedLookup() {
void testRegularlyProxiedLookup() {
OverloadLookup olup = (OverloadLookup) applicationContext.getBean("regularlyProxiedOverload");
ITestBean jenny = olup.newTestBean();
assertThat(jenny.getName()).isEqualTo("Jenny");

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -44,7 +44,7 @@ import static org.springframework.util.ClassUtils.convertClassNameToResourcePath
* @author Juergen Hoeller
* @author Chris Beams
*/
public class QualifierAnnotationTests {
class QualifierAnnotationTests {
private static final String CLASSNAME = QualifierAnnotationTests.class.getName();
@ -53,7 +53,7 @@ public class QualifierAnnotationTests {
@Test
public void testNonQualifiedFieldFails() {
void testNonQualifiedFieldFails() {
StaticApplicationContext context = new StaticApplicationContext();
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(CONFIG_LOCATION);
@ -64,7 +64,7 @@ public class QualifierAnnotationTests {
}
@Test
public void testQualifiedByValue() {
void testQualifiedByValue() {
StaticApplicationContext context = new StaticApplicationContext();
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(CONFIG_LOCATION);
@ -76,7 +76,7 @@ public class QualifierAnnotationTests {
}
@Test
public void testQualifiedByParentValue() {
void testQualifiedByParentValue() {
StaticApplicationContext parent = new StaticApplicationContext();
GenericBeanDefinition parentLarry = new GenericBeanDefinition();
parentLarry.setBeanClass(Person.class);
@ -101,7 +101,7 @@ public class QualifierAnnotationTests {
}
@Test
public void testQualifiedByBeanName() {
void testQualifiedByBeanName() {
StaticApplicationContext context = new StaticApplicationContext();
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(CONFIG_LOCATION);
@ -115,7 +115,7 @@ public class QualifierAnnotationTests {
}
@Test
public void testQualifiedByFieldName() {
void testQualifiedByFieldName() {
StaticApplicationContext context = new StaticApplicationContext();
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(CONFIG_LOCATION);
@ -127,7 +127,7 @@ public class QualifierAnnotationTests {
}
@Test
public void testQualifiedByParameterName() {
void testQualifiedByParameterName() {
StaticApplicationContext context = new StaticApplicationContext();
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(CONFIG_LOCATION);
@ -139,7 +139,7 @@ public class QualifierAnnotationTests {
}
@Test
public void testQualifiedByAlias() {
void testQualifiedByAlias() {
StaticApplicationContext context = new StaticApplicationContext();
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(CONFIG_LOCATION);
@ -151,7 +151,7 @@ public class QualifierAnnotationTests {
}
@Test
public void testQualifiedByAnnotation() {
void testQualifiedByAnnotation() {
StaticApplicationContext context = new StaticApplicationContext();
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(CONFIG_LOCATION);
@ -163,7 +163,7 @@ public class QualifierAnnotationTests {
}
@Test
public void testQualifiedByCustomValue() {
void testQualifiedByCustomValue() {
StaticApplicationContext context = new StaticApplicationContext();
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(CONFIG_LOCATION);
@ -175,7 +175,7 @@ public class QualifierAnnotationTests {
}
@Test
public void testQualifiedByAnnotationValue() {
void testQualifiedByAnnotationValue() {
StaticApplicationContext context = new StaticApplicationContext();
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(CONFIG_LOCATION);
@ -187,7 +187,7 @@ public class QualifierAnnotationTests {
}
@Test
public void testQualifiedByAttributesFailsWithoutCustomQualifierRegistered() {
void testQualifiedByAttributesFailsWithoutCustomQualifierRegistered() {
StaticApplicationContext context = new StaticApplicationContext();
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(CONFIG_LOCATION);
@ -198,7 +198,7 @@ public class QualifierAnnotationTests {
}
@Test
public void testQualifiedByAttributesWithCustomQualifierRegistered() {
void testQualifiedByAttributesWithCustomQualifierRegistered() {
StaticApplicationContext context = new StaticApplicationContext();
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(CONFIG_LOCATION);
@ -215,7 +215,7 @@ public class QualifierAnnotationTests {
}
@Test
public void testInterfaceWithOneQualifiedFactoryAndOneQualifiedBean() {
void testInterfaceWithOneQualifiedFactoryAndOneQualifiedBean() {
StaticApplicationContext context = new StaticApplicationContext();
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(CONFIG_LOCATION);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -313,7 +313,7 @@ class FixedMethodReplacer implements MethodReplacer {
public static final String VALUE = "fixedMethodReplacer";
@Override
public Object reimplement(Object obj, Method method, Object[] args) throws Throwable {
public Object reimplement(Object obj, Method method, Object[] args) {
return VALUE;
}
}
@ -587,7 +587,7 @@ class ProtectedLifecycleBean implements BeanNameAware, BeanFactoryAware, Initial
class ReverseMethodReplacer implements MethodReplacer, Serializable {
@Override
public Object reimplement(Object obj, Method method, Object[] args) throws Throwable {
public Object reimplement(Object obj, Method method, Object[] args) {
String s = (String) args[0];
return new StringBuilder(s).reverse().toString();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -1611,7 +1611,7 @@ class XmlBeanFactoryTests {
public Object lastArg;
@Override
public Object reimplement(Object obj, Method method, Object[] args) throws Throwable {
public Object reimplement(Object obj, Method method, Object[] args) {
assertThat(args).hasSize(1);
assertThat(method.getName()).isEqualTo("doSomething");
lastArg = args[0];
@ -1668,7 +1668,7 @@ class XmlBeanFactoryTests {
}
/** Init method */
public void customInit() throws IOException {
public void customInit() {
assertThat(this.afterPropertiesSetInvoked).isTrue();
if (this.initMethodInvoked) {
throw new IllegalStateException("Already customInitialized");

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -71,7 +71,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Chris Beams
* @author Juergen Hoeller
*/
public class CustomNamespaceHandlerTests {
class CustomNamespaceHandlerTests {
private static final Class<?> CLASS = CustomNamespaceHandlerTests.class;
private static final String CLASSNAME = CLASS.getSimpleName();
@ -85,7 +85,7 @@ public class CustomNamespaceHandlerTests {
@BeforeEach
public void setUp() throws Exception {
void setUp() {
NamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(CLASS.getClassLoader(), NS_PROPS);
this.beanFactory = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
@ -98,19 +98,19 @@ public class CustomNamespaceHandlerTests {
@Test
public void testSimpleParser() throws Exception {
void testSimpleParser() {
TestBean bean = (TestBean) this.beanFactory.getBean("testBean");
assertTestBean(bean);
}
@Test
public void testSimpleDecorator() throws Exception {
void testSimpleDecorator() {
TestBean bean = (TestBean) this.beanFactory.getBean("customisedTestBean");
assertTestBean(bean);
}
@Test
public void testProxyingDecorator() throws Exception {
void testProxyingDecorator() {
ITestBean bean = (ITestBean) this.beanFactory.getBean("debuggingTestBean");
assertTestBean(bean);
assertThat(AopUtils.isAopProxy(bean)).isTrue();
@ -120,7 +120,7 @@ public class CustomNamespaceHandlerTests {
}
@Test
public void testProxyingDecoratorNoInstance() throws Exception {
void testProxyingDecoratorNoInstance() {
String[] beanNames = this.beanFactory.getBeanNamesForType(ApplicationListener.class);
assertThat(Arrays.asList(beanNames)).contains("debuggingTestBeanNoInstance");
assertThat(this.beanFactory.getType("debuggingTestBeanNoInstance")).isEqualTo(ApplicationListener.class);
@ -131,7 +131,7 @@ public class CustomNamespaceHandlerTests {
}
@Test
public void testChainedDecorators() throws Exception {
void testChainedDecorators() {
ITestBean bean = (ITestBean) this.beanFactory.getBean("chainedTestBean");
assertTestBean(bean);
assertThat(AopUtils.isAopProxy(bean)).isTrue();
@ -142,27 +142,27 @@ public class CustomNamespaceHandlerTests {
}
@Test
public void testDecorationViaAttribute() throws Exception {
void testDecorationViaAttribute() {
BeanDefinition beanDefinition = this.beanFactory.getBeanDefinition("decorateWithAttribute");
assertThat(beanDefinition.getAttribute("objectName")).isEqualTo("foo");
}
@Test // SPR-2728
public void testCustomElementNestedWithinUtilList() throws Exception {
public void testCustomElementNestedWithinUtilList() {
List<?> things = (List<?>) this.beanFactory.getBean("list.of.things");
assertThat(things).isNotNull();
assertThat(things).hasSize(2);
}
@Test // SPR-2728
public void testCustomElementNestedWithinUtilSet() throws Exception {
public void testCustomElementNestedWithinUtilSet() {
Set<?> things = (Set<?>) this.beanFactory.getBean("set.of.things");
assertThat(things).isNotNull();
assertThat(things).hasSize(2);
}
@Test // SPR-2728
public void testCustomElementNestedWithinUtilMap() throws Exception {
public void testCustomElementNestedWithinUtilMap() {
Map<?, ?> things = (Map<?, ?>) this.beanFactory.getBean("map.of.things");
assertThat(things).isNotNull();
assertThat(things).hasSize(2);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -30,19 +30,19 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Costin Leau
* @author Stephane Nicoll
*/
public class NoOpCacheManagerTests {
class NoOpCacheManagerTests {
private final CacheManager manager = new NoOpCacheManager();
@Test
public void testGetCache() throws Exception {
void testGetCache() {
Cache cache = this.manager.getCache("bucket");
assertThat(cache).isNotNull();
assertThat(this.manager.getCache("bucket")).isSameAs(cache);
}
@Test
public void testNoOpCache() throws Exception {
void testNoOpCache() {
String name = createRandomKey();
Cache cache = this.manager.getCache(name);
assertThat(cache.getName()).isEqualTo(name);
@ -54,7 +54,7 @@ public class NoOpCacheManagerTests {
}
@Test
public void testCacheName() throws Exception {
void testCacheName() {
String name = "bucket";
assertThat(this.manager.getCacheNames()).doesNotContain(name);
this.manager.getCache(name);
@ -62,7 +62,7 @@ public class NoOpCacheManagerTests {
}
@Test
public void testCacheCallable() throws Exception {
void testCacheCallable() {
String name = createRandomKey();
Cache cache = this.manager.getCache(name);
Object returnValue = new Object();
@ -71,7 +71,7 @@ public class NoOpCacheManagerTests {
}
@Test
public void testCacheGetCallableFail() {
void testCacheGetCallableFail() {
Cache cache = this.manager.getCache(createRandomKey());
String key = createRandomKey();
try {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -41,19 +41,19 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
* @author Stephane Nicoll
* @author Sam Brannen
*/
public class AnnotationCacheOperationSourceTests {
class AnnotationCacheOperationSourceTests {
private final AnnotationCacheOperationSource source = new AnnotationCacheOperationSource();
@Test
public void singularAnnotation() {
void singularAnnotation() {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "singular", 1);
assertThat(ops).element(0).isInstanceOf(CacheableOperation.class);
}
@Test
public void multipleAnnotation() {
void multipleAnnotation() {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "multiple", 2);
Iterator<CacheOperation> it = ops.iterator();
assertThat(it.next()).isInstanceOf(CacheableOperation.class);
@ -61,7 +61,7 @@ public class AnnotationCacheOperationSourceTests {
}
@Test
public void caching() {
void caching() {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "caching", 2);
Iterator<CacheOperation> it = ops.iterator();
assertThat(it.next()).isInstanceOf(CacheableOperation.class);
@ -69,18 +69,18 @@ public class AnnotationCacheOperationSourceTests {
}
@Test
public void emptyCaching() {
void emptyCaching() {
getOps(AnnotatedClass.class, "emptyCaching", 0);
}
@Test
public void singularStereotype() {
void singularStereotype() {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "singleStereotype", 1);
assertThat(ops).element(0).isInstanceOf(CacheEvictOperation.class);
}
@Test
public void multipleStereotypes() {
void multipleStereotypes() {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "multipleStereotype", 3);
Iterator<CacheOperation> it = ops.iterator();
assertThat(it.next()).isInstanceOf(CacheableOperation.class);
@ -93,7 +93,7 @@ public class AnnotationCacheOperationSourceTests {
}
@Test
public void singleComposedAnnotation() {
void singleComposedAnnotation() {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "singleComposed", 2);
Iterator<CacheOperation> it = ops.iterator();
@ -109,7 +109,7 @@ public class AnnotationCacheOperationSourceTests {
}
@Test
public void multipleComposedAnnotations() {
void multipleComposedAnnotations() {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "multipleComposed", 4);
Iterator<CacheOperation> it = ops.iterator();
@ -135,89 +135,89 @@ public class AnnotationCacheOperationSourceTests {
}
@Test
public void customKeyGenerator() {
void customKeyGenerator() {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "customKeyGenerator", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertThat(cacheOperation.getKeyGenerator()).as("Custom key generator not set").isEqualTo("custom");
}
@Test
public void customKeyGeneratorInherited() {
void customKeyGeneratorInherited() {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "customKeyGeneratorInherited", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertThat(cacheOperation.getKeyGenerator()).as("Custom key generator not set").isEqualTo("custom");
}
@Test
public void keyAndKeyGeneratorCannotBeSetTogether() {
void keyAndKeyGeneratorCannotBeSetTogether() {
assertThatIllegalStateException().isThrownBy(() ->
getOps(AnnotatedClass.class, "invalidKeyAndKeyGeneratorSet"));
}
@Test
public void customCacheManager() {
void customCacheManager() {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "customCacheManager", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertThat(cacheOperation.getCacheManager()).as("Custom cache manager not set").isEqualTo("custom");
}
@Test
public void customCacheManagerInherited() {
void customCacheManagerInherited() {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "customCacheManagerInherited", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertThat(cacheOperation.getCacheManager()).as("Custom cache manager not set").isEqualTo("custom");
}
@Test
public void customCacheResolver() {
void customCacheResolver() {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "customCacheResolver", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertThat(cacheOperation.getCacheResolver()).as("Custom cache resolver not set").isEqualTo("custom");
}
@Test
public void customCacheResolverInherited() {
void customCacheResolverInherited() {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "customCacheResolverInherited", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertThat(cacheOperation.getCacheResolver()).as("Custom cache resolver not set").isEqualTo("custom");
}
@Test
public void cacheResolverAndCacheManagerCannotBeSetTogether() {
void cacheResolverAndCacheManagerCannotBeSetTogether() {
assertThatIllegalStateException().isThrownBy(() ->
getOps(AnnotatedClass.class, "invalidCacheResolverAndCacheManagerSet"));
}
@Test
public void fullClassLevelWithCustomCacheName() {
void fullClassLevelWithCustomCacheName() {
Collection<CacheOperation> ops = getOps(AnnotatedClassWithFullDefault.class, "methodLevelCacheName", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertSharedConfig(cacheOperation, "classKeyGenerator", "", "classCacheResolver", "custom");
}
@Test
public void fullClassLevelWithCustomKeyManager() {
void fullClassLevelWithCustomKeyManager() {
Collection<CacheOperation> ops = getOps(AnnotatedClassWithFullDefault.class, "methodLevelKeyGenerator", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertSharedConfig(cacheOperation, "custom", "", "classCacheResolver" , "classCacheName");
}
@Test
public void fullClassLevelWithCustomCacheManager() {
void fullClassLevelWithCustomCacheManager() {
Collection<CacheOperation> ops = getOps(AnnotatedClassWithFullDefault.class, "methodLevelCacheManager", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertSharedConfig(cacheOperation, "classKeyGenerator", "custom", "", "classCacheName");
}
@Test
public void fullClassLevelWithCustomCacheResolver() {
void fullClassLevelWithCustomCacheResolver() {
Collection<CacheOperation> ops = getOps(AnnotatedClassWithFullDefault.class, "methodLevelCacheResolver", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertSharedConfig(cacheOperation, "classKeyGenerator", "", "custom" , "classCacheName");
}
@Test
public void validateNoCacheIsValid() {
void validateNoCacheIsValid() {
// Valid as a CacheResolver might return the cache names to use with other info
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "noCacheNameSpecified");
CacheOperation cacheOperation = ops.iterator().next();
@ -226,28 +226,28 @@ public class AnnotationCacheOperationSourceTests {
}
@Test
public void customClassLevelWithCustomCacheName() {
void customClassLevelWithCustomCacheName() {
Collection<CacheOperation> ops = getOps(AnnotatedClassWithCustomDefault.class, "methodLevelCacheName", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertSharedConfig(cacheOperation, "classKeyGenerator", "", "classCacheResolver", "custom");
}
@Test
public void severalCacheConfigUseClosest() {
void severalCacheConfigUseClosest() {
Collection<CacheOperation> ops = getOps(MultipleCacheConfig.class, "multipleCacheConfig");
CacheOperation cacheOperation = ops.iterator().next();
assertSharedConfig(cacheOperation, "", "", "", "myCache");
}
@Test
public void cacheConfigFromInterface() {
void cacheConfigFromInterface() {
Collection<CacheOperation> ops = getOps(InterfaceCacheConfig.class, "interfaceCacheConfig");
CacheOperation cacheOperation = ops.iterator().next();
assertSharedConfig(cacheOperation, "", "", "", "myCache");
}
@Test
public void cacheAnnotationOverride() {
void cacheAnnotationOverride() {
Collection<CacheOperation> ops = getOps(InterfaceCacheConfig.class, "interfaceCacheableOverride");
assertThat(ops.size()).isSameAs(1);
CacheOperation cacheOperation = ops.iterator().next();
@ -255,21 +255,21 @@ public class AnnotationCacheOperationSourceTests {
}
@Test
public void partialClassLevelWithCustomCacheManager() {
void partialClassLevelWithCustomCacheManager() {
Collection<CacheOperation> ops = getOps(AnnotatedClassWithSomeDefault.class, "methodLevelCacheManager", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertSharedConfig(cacheOperation, "classKeyGenerator", "custom", "", "classCacheName");
}
@Test
public void partialClassLevelWithCustomCacheResolver() {
void partialClassLevelWithCustomCacheResolver() {
Collection<CacheOperation> ops = getOps(AnnotatedClassWithSomeDefault.class, "methodLevelCacheResolver", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertSharedConfig(cacheOperation, "classKeyGenerator", "", "custom", "classCacheName");
}
@Test
public void partialClassLevelWithNoCustomization() {
void partialClassLevelWithNoCustomization() {
Collection<CacheOperation> ops = getOps(AnnotatedClassWithSomeDefault.class, "noCustomization", 1);
CacheOperation cacheOperation = ops.iterator().next();
assertSharedConfig(cacheOperation, "classKeyGenerator", "classCacheManager", "", "classCacheName");

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,10 +27,10 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Juergen Hoeller
* @author Stephane Nicoll
*/
public class ConcurrentMapCacheManagerTests {
class ConcurrentMapCacheManagerTests {
@Test
public void testDynamicMode() {
void testDynamicMode() {
CacheManager cm = new ConcurrentMapCacheManager();
Cache cache1 = cm.getCache("c1");
assertThat(cache1).isInstanceOf(ConcurrentMapCache.class);
@ -68,7 +68,7 @@ public class ConcurrentMapCacheManagerTests {
}
@Test
public void testStaticMode() {
void testStaticMode() {
ConcurrentMapCacheManager cm = new ConcurrentMapCacheManager("c1", "c2");
Cache cache1 = cm.getCache("c1");
assertThat(cache1).isInstanceOf(ConcurrentMapCache.class);
@ -115,7 +115,7 @@ public class ConcurrentMapCacheManagerTests {
}
@Test
public void testChangeStoreByValue() {
void testChangeStoreByValue() {
ConcurrentMapCacheManager cm = new ConcurrentMapCacheManager("c1", "c2");
assertThat(cm.isStoreByValue()).isFalse();
Cache cache1 = cm.getCache("c1");

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
* @author Juergen Hoeller
* @author Stephane Nicoll
*/
public class ConcurrentMapCacheTests extends AbstractValueAdaptingCacheTests<ConcurrentMapCache> {
class ConcurrentMapCacheTests extends AbstractValueAdaptingCacheTests<ConcurrentMapCache> {
protected ConcurrentMap<Object, Object> nativeCache;
@ -48,7 +48,7 @@ public class ConcurrentMapCacheTests extends AbstractValueAdaptingCacheTests<Con
@BeforeEach
public void setup() {
void setup() {
this.nativeCache = new ConcurrentHashMap<>();
this.cache = new ConcurrentMapCache(CACHE_NAME, this.nativeCache, true);
this.nativeCacheNoNull = new ConcurrentHashMap<>();
@ -73,13 +73,13 @@ public class ConcurrentMapCacheTests extends AbstractValueAdaptingCacheTests<Con
@Test
public void testIsStoreByReferenceByDefault() {
void testIsStoreByReferenceByDefault() {
assertThat(this.cache.isStoreByValue()).isFalse();
}
@SuppressWarnings("unchecked")
@Test
public void testSerializer() {
void testSerializer() {
ConcurrentMapCache serializeCache = createCacheWithStoreByValue();
assertThat(serializeCache.isStoreByValue()).isTrue();
@ -89,11 +89,11 @@ public class ConcurrentMapCacheTests extends AbstractValueAdaptingCacheTests<Con
content.remove(0);
List<String> entry = (List<String>) serializeCache.get(key).get();
assertThat(entry).hasSize(3);
assertThat(entry).element(0).isEqualTo("one");
assertThat(entry.get(0)).isEqualTo("one");
}
@Test
public void testNonSerializableContent() {
void testNonSerializableContent() {
ConcurrentMapCache serializeCache = createCacheWithStoreByValue();
assertThatIllegalArgumentException().isThrownBy(() ->
@ -104,7 +104,7 @@ public class ConcurrentMapCacheTests extends AbstractValueAdaptingCacheTests<Con
}
@Test
public void testInvalidSerializedContent() {
void testInvalidSerializedContent() {
ConcurrentMapCache serializeCache = createCacheWithStoreByValue();
String key = createRandomKey();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -24,7 +24,7 @@ import org.springframework.context.testfixture.cache.AbstractCacheAnnotationTest
* @author Costin Leau
* @author Chris Beams
*/
public class AnnotationDrivenCacheConfigTests extends AbstractCacheAnnotationTests {
class AnnotationDrivenCacheConfigTests extends AbstractCacheAnnotationTests {
@Override
protected ConfigurableApplicationContext getApplicationContext() {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Chris Beams
* @author Stephane Nicoll
*/
public class AnnotationNamespaceDrivenTests extends AbstractCacheAnnotationTests {
class AnnotationNamespaceDrivenTests extends AbstractCacheAnnotationTests {
@Override
protected ConfigurableApplicationContext getApplicationContext() {
@ -40,14 +40,14 @@ public class AnnotationNamespaceDrivenTests extends AbstractCacheAnnotationTests
}
@Test
public void testKeyStrategy() {
void testKeyStrategy() {
CacheInterceptor ci = this.ctx.getBean(
"org.springframework.cache.interceptor.CacheInterceptor#0", CacheInterceptor.class);
assertThat(ci.getKeyGenerator()).isSameAs(this.ctx.getBean("keyGenerator"));
}
@Test
public void cacheResolver() {
void cacheResolver() {
ConfigurableApplicationContext context = new GenericXmlApplicationContext(
"/org/springframework/cache/config/annotationDrivenCacheNamespace-resolver.xml");
@ -57,7 +57,7 @@ public class AnnotationNamespaceDrivenTests extends AbstractCacheAnnotationTests
}
@Test
public void bothSetOnlyResolverIsUsed() {
void bothSetOnlyResolverIsUsed() {
ConfigurableApplicationContext context = new GenericXmlApplicationContext(
"/org/springframework/cache/config/annotationDrivenCacheNamespace-manager-resolver.xml");
@ -67,7 +67,7 @@ public class AnnotationNamespaceDrivenTests extends AbstractCacheAnnotationTests
}
@Test
public void testCacheErrorHandler() {
void testCacheErrorHandler() {
CacheInterceptor ci = this.ctx.getBean(
"org.springframework.cache.interceptor.CacheInterceptor#0", CacheInterceptor.class);
assertThat(ci.getErrorHandler()).isSameAs(this.ctx.getBean("errorHandler", CacheErrorHandler.class));

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Costin Leau
* @author Chris Beams
*/
public class CacheAdviceNamespaceTests extends AbstractCacheAnnotationTests {
class CacheAdviceNamespaceTests extends AbstractCacheAnnotationTests {
@Override
protected ConfigurableApplicationContext getApplicationContext() {
@ -38,7 +38,7 @@ public class CacheAdviceNamespaceTests extends AbstractCacheAnnotationTests {
}
@Test
public void testKeyStrategy() {
void testKeyStrategy() {
CacheInterceptor bean = this.ctx.getBean("cacheAdviceClass", CacheInterceptor.class);
assertThat(bean.getKeyGenerator()).isSameAs(this.ctx.getBean("keyGenerator"));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -49,13 +49,13 @@ class CustomInterceptorTests {
protected CacheableService<?> cs;
@BeforeEach
public void setup() {
void setup() {
this.ctx = new AnnotationConfigApplicationContext(EnableCachingConfig.class);
this.cs = ctx.getBean("service", CacheableService.class);
}
@AfterEach
public void tearDown() {
void tearDown() {
this.ctx.close();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -31,7 +31,7 @@ import org.springframework.context.annotation.Configuration;
/**
* @author Stephane Nicoll
*/
public class ExpressionCachingIntegrationTests {
class ExpressionCachingIntegrationTests {
@Test // SPR-11692
@SuppressWarnings("unchecked")

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -35,10 +35,10 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author John Blum
* @author Juergen Hoeller
*/
public class CacheProxyFactoryBeanTests {
class CacheProxyFactoryBeanTests {
@Test
public void configurationClassWithCacheProxyFactoryBean() {
void configurationClassWithCacheProxyFactoryBean() {
try (AnnotationConfigApplicationContext applicationContext =
new AnnotationConfigApplicationContext(CacheProxyFactoryBeanConfiguration.class)) {
Greeter greeter = applicationContext.getBean("greeter", Greeter.class);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Stephane Nicoll
*/
public class CachePutEvaluationTests {
class CachePutEvaluationTests {
private ConfigurableApplicationContext context;
@ -53,20 +53,20 @@ public class CachePutEvaluationTests {
@BeforeEach
public void setup() {
void setup() {
this.context = new AnnotationConfigApplicationContext(Config.class);
this.cache = this.context.getBean(CacheManager.class).getCache("test");
this.service = this.context.getBean(SimpleService.class);
}
@AfterEach
public void closeContext() {
void closeContext() {
this.context.close();
}
@Test
public void mutualGetPutExclusion() {
void mutualGetPutExclusion() {
String key = "1";
Long first = this.service.getOrPut(key, true);
@ -83,7 +83,7 @@ public class CachePutEvaluationTests {
}
@Test
public void getAndPut() {
void getAndPut() {
this.cache.clear();
long key = 1;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -42,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
* @author Stephane Nicoll
* @since 4.3
*/
public class CacheSyncFailureTests {
class CacheSyncFailureTests {
private ConfigurableApplicationContext context;
@ -50,13 +50,13 @@ public class CacheSyncFailureTests {
@BeforeEach
public void setup() {
void setup() {
this.context = new AnnotationConfigApplicationContext(Config.class);
this.simpleService = this.context.getBean(SimpleService.class);
}
@AfterEach
public void closeContext() {
void closeContext() {
if (this.context != null) {
this.context.close();
}
@ -64,35 +64,35 @@ public class CacheSyncFailureTests {
@Test
public void unlessSync() {
void unlessSync() {
assertThatIllegalStateException()
.isThrownBy(() -> this.simpleService.unlessSync("key"))
.withMessageContaining("A sync=true operation does not support the unless attribute");
}
@Test
public void severalCachesSync() {
void severalCachesSync() {
assertThatIllegalStateException()
.isThrownBy(() -> this.simpleService.severalCachesSync("key"))
.withMessageContaining("A sync=true operation is restricted to a single cache");
}
@Test
public void severalCachesWithResolvedSync() {
void severalCachesWithResolvedSync() {
assertThatIllegalStateException()
.isThrownBy(() -> this.simpleService.severalCachesWithResolvedSync("key"))
.withMessageContaining("A sync=true operation is restricted to a single cache");
}
@Test
public void syncWithAnotherOperation() {
void syncWithAnotherOperation() {
assertThatIllegalStateException()
.isThrownBy(() -> this.simpleService.syncWithAnotherOperation("key"))
.withMessageContaining("A sync=true operation cannot be combined with other cache operations");
}
@Test
public void syncWithTwoGetOperations() {
void syncWithTwoGetOperations() {
assertThatIllegalStateException()
.isThrownBy(() -> this.simpleService.syncWithTwoGetOperations("key"))
.withMessageContaining("Only one sync=true operation is allowed");

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Sam Brannen
* @author Stephane Nicoll
*/
public class ExpressionEvaluatorTests {
class ExpressionEvaluatorTests {
private final StandardEvaluationContext originalEvaluationContext = new StandardEvaluationContext();
@ -65,7 +65,7 @@ public class ExpressionEvaluatorTests {
@Test
public void testMultipleCachingSource() {
void testMultipleCachingSource() {
Collection<CacheOperation> ops = getOps("multipleCaching");
assertThat(ops).hasSize(2);
Iterator<CacheOperation> it = ops.iterator();
@ -80,7 +80,7 @@ public class ExpressionEvaluatorTests {
}
@Test
public void testMultipleCachingEval() {
void testMultipleCachingEval() {
AnnotatedClass target = new AnnotatedClass();
Method method = ReflectionUtils.findMethod(
AnnotatedClass.class, "multipleCaching", Object.class, Object.class);
@ -102,28 +102,28 @@ public class ExpressionEvaluatorTests {
}
@Test
public void withReturnValue() {
void withReturnValue() {
EvaluationContext context = createEvaluationContext("theResult");
Object value = new SpelExpressionParser().parseExpression("#result").getValue(context);
assertThat(value).isEqualTo("theResult");
}
@Test
public void withNullReturn() {
void withNullReturn() {
EvaluationContext context = createEvaluationContext(null);
Object value = new SpelExpressionParser().parseExpression("#result").getValue(context);
assertThat(value).isNull();
}
@Test
public void withoutReturnValue() {
void withoutReturnValue() {
EvaluationContext context = createEvaluationContext(CacheOperationExpressionEvaluator.NO_RESULT);
Object value = new SpelExpressionParser().parseExpression("#result").getValue(context);
assertThat(value).isNull();
}
@Test
public void unavailableReturnValue() {
void unavailableReturnValue() {
EvaluationContext context = createEvaluationContext(CacheOperationExpressionEvaluator.RESULT_UNAVAILABLE);
assertThatExceptionOfType(VariableNotAvailableException.class).isThrownBy(() ->
new SpelExpressionParser().parseExpression("#result").getValue(context))
@ -131,7 +131,7 @@ public class ExpressionEvaluatorTests {
}
@Test
public void resolveBeanReference() {
void resolveBeanReference() {
StaticApplicationContext applicationContext = new StaticApplicationContext();
BeanDefinition beanDefinition = new RootBeanDefinition(String.class);
applicationContext.registerBeanDefinition("myBean", beanDefinition);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -33,13 +33,13 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Juergen Hoeller
* @author Sebastien Deleuze
*/
public class SimpleKeyGeneratorTests {
class SimpleKeyGeneratorTests {
private final SimpleKeyGenerator generator = new SimpleKeyGenerator();
@Test
public void noValues() {
void noValues() {
Object k1 = generateKey(new Object[] {});
Object k2 = generateKey(new Object[] {});
Object k3 = generateKey(new Object[] { "different" });
@ -50,7 +50,7 @@ public class SimpleKeyGeneratorTests {
}
@Test
public void singleValue() {
void singleValue() {
Object k1 = generateKey(new Object[] { "a" });
Object k2 = generateKey(new Object[] { "a" });
Object k3 = generateKey(new Object[] { "different" });
@ -62,7 +62,7 @@ public class SimpleKeyGeneratorTests {
}
@Test
public void multipleValues() {
void multipleValues() {
Object k1 = generateKey(new Object[] { "a", 1, "b" });
Object k2 = generateKey(new Object[] { "a", 1, "b" });
Object k3 = generateKey(new Object[] { "b", 1, "a" });
@ -73,7 +73,7 @@ public class SimpleKeyGeneratorTests {
}
@Test
public void singleNullValue() {
void singleNullValue() {
Object k1 = generateKey(new Object[] { null });
Object k2 = generateKey(new Object[] { null });
Object k3 = generateKey(new Object[] { "different" });
@ -85,7 +85,7 @@ public class SimpleKeyGeneratorTests {
}
@Test
public void multipleNullValues() {
void multipleNullValues() {
Object k1 = generateKey(new Object[] { "a", null, "b", null });
Object k2 = generateKey(new Object[] { "a", null, "b", null });
Object k3 = generateKey(new Object[] { "a", null, "b" });
@ -96,7 +96,7 @@ public class SimpleKeyGeneratorTests {
}
@Test
public void plainArray() {
void plainArray() {
Object k1 = generateKey(new Object[] { new String[]{"a", "b"} });
Object k2 = generateKey(new Object[] { new String[]{"a", "b"} });
Object k3 = generateKey(new Object[] { new String[]{"b", "a"} });
@ -107,7 +107,7 @@ public class SimpleKeyGeneratorTests {
}
@Test
public void arrayWithExtraParameter() {
void arrayWithExtraParameter() {
Object k1 = generateKey(new Object[] { new String[]{"a", "b"}, "c" });
Object k2 = generateKey(new Object[] { new String[]{"a", "b"}, "c" });
Object k3 = generateKey(new Object[] { new String[]{"b", "a"}, "c" });
@ -118,7 +118,7 @@ public class SimpleKeyGeneratorTests {
}
@Test
public void serializedKeys() throws Exception {
void serializedKeys() throws Exception {
Object k1 = SerializationTestUtils.serializeAndDeserialize(generateKey(new Object[] { "a", 1, "b" }));
Object k2 = SerializationTestUtils.serializeAndDeserialize(generateKey(new Object[] { "a", 1, "b" }));
Object k3 = SerializationTestUtils.serializeAndDeserialize(generateKey(new Object[] { "b", 1, "a" }));

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -33,11 +33,11 @@ public abstract class AbstractCircularImportDetectionTests {
protected abstract ConfigurationClassParser newParser();
protected abstract String loadAsConfigurationSource(Class<?> clazz) throws Exception;
protected abstract String loadAsConfigurationSource(Class<?> clazz);
@Test
public void simpleCircularImportIsDetected() throws Exception {
void simpleCircularImportIsDetected() throws Exception {
boolean threw = false;
try {
newParser().parse(loadAsConfigurationSource(A.class), "A");
@ -52,7 +52,7 @@ public abstract class AbstractCircularImportDetectionTests {
}
@Test
public void complexCircularImportIsDetected() throws Exception {
void complexCircularImportIsDetected() throws Exception {
boolean threw = false;
try {
newParser().parse(loadAsConfigurationSource(X.class), "X");

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -34,10 +34,10 @@ import static org.assertj.core.api.Assertions.fail;
* @author Andy Wilkinson
* @author Liu Dongmiao
*/
public class AggressiveFactoryBeanInstantiationTests {
class AggressiveFactoryBeanInstantiationTests {
@Test
public void directlyRegisteredFactoryBean() {
void directlyRegisteredFactoryBean() {
try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext()) {
context.register(SimpleFactoryBean.class);
context.addBeanFactoryPostProcessor(factory ->
@ -48,7 +48,7 @@ public class AggressiveFactoryBeanInstantiationTests {
}
@Test
public void beanMethodFactoryBean() {
void beanMethodFactoryBean() {
try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext()) {
context.register(BeanMethodConfiguration.class);
context.addBeanFactoryPostProcessor(factory ->
@ -59,7 +59,7 @@ public class AggressiveFactoryBeanInstantiationTests {
}
@Test
public void checkLinkageError() {
void checkLinkageError() {
try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext()) {
context.register(BeanMethodConfigurationWithExceptionInInitializer.class);
context.refresh();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -307,8 +307,8 @@ class AnnotationConfigApplicationContextTests {
assertThat(ObjectUtils.containsElement(context.getBeanNamesForType(BeanC.class), "c")).isTrue();
assertThat(context.getBeansOfType(BeanA.class)).isEmpty();
assertThat(context.getBeansOfType(BeanB.class).values()).element(0).isSameAs(context.getBean(BeanB.class));
assertThat(context.getBeansOfType(BeanC.class).values()).element(0).isSameAs(context.getBean(BeanC.class));
assertThat(context.getBeansOfType(BeanB.class).values()).singleElement().isSameAs(context.getBean(BeanB.class));
assertThat(context.getBeansOfType(BeanC.class).values()).singleElement().isSameAs(context.getBean(BeanC.class));
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
.isThrownBy(() -> context.getBeanFactory().resolveNamedBean(BeanA.class));

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -44,13 +44,13 @@ import static org.springframework.context.annotation.ScopedProxyMode.TARGET_CLAS
* @author Juergen Hoeller
* @author Sam Brannen
*/
public class AnnotationScopeMetadataResolverTests {
class AnnotationScopeMetadataResolverTests {
private AnnotationScopeMetadataResolver scopeMetadataResolver = new AnnotationScopeMetadataResolver();
@Test
public void resolveScopeMetadataShouldNotApplyScopedProxyModeToSingleton() {
void resolveScopeMetadataShouldNotApplyScopedProxyModeToSingleton() {
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithSingletonScope.class);
ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
assertThat(scopeMetadata).as("resolveScopeMetadata(..) must *never* return null.").isNotNull();
@ -59,7 +59,7 @@ public class AnnotationScopeMetadataResolverTests {
}
@Test
public void resolveScopeMetadataShouldApplyScopedProxyModeToPrototype() {
void resolveScopeMetadataShouldApplyScopedProxyModeToPrototype() {
this.scopeMetadataResolver = new AnnotationScopeMetadataResolver(INTERFACES);
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithPrototypeScope.class);
ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
@ -69,7 +69,7 @@ public class AnnotationScopeMetadataResolverTests {
}
@Test
public void resolveScopeMetadataShouldReadScopedProxyModeFromAnnotation() {
void resolveScopeMetadataShouldReadScopedProxyModeFromAnnotation() {
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithScopedProxy.class);
ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
assertThat(scopeMetadata).as("resolveScopeMetadata(..) must *never* return null.").isNotNull();
@ -78,7 +78,7 @@ public class AnnotationScopeMetadataResolverTests {
}
@Test
public void customRequestScope() {
void customRequestScope() {
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithCustomRequestScope.class);
ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
assertThat(scopeMetadata).as("resolveScopeMetadata(..) must *never* return null.").isNotNull();
@ -87,7 +87,7 @@ public class AnnotationScopeMetadataResolverTests {
}
@Test
public void customRequestScopeViaAsm() throws IOException {
void customRequestScopeViaAsm() throws IOException {
MetadataReaderFactory readerFactory = new SimpleMetadataReaderFactory();
MetadataReader reader = readerFactory.getMetadataReader(AnnotatedWithCustomRequestScope.class.getName());
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(reader.getAnnotationMetadata());
@ -98,7 +98,7 @@ public class AnnotationScopeMetadataResolverTests {
}
@Test
public void customRequestScopeWithAttribute() {
void customRequestScopeWithAttribute() {
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(
AnnotatedWithCustomRequestScopeWithAttributeOverride.class);
ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
@ -108,7 +108,7 @@ public class AnnotationScopeMetadataResolverTests {
}
@Test
public void customRequestScopeWithAttributeViaAsm() throws IOException {
void customRequestScopeWithAttributeViaAsm() throws IOException {
MetadataReaderFactory readerFactory = new SimpleMetadataReaderFactory();
MetadataReader reader = readerFactory.getMetadataReader(AnnotatedWithCustomRequestScopeWithAttributeOverride.class.getName());
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(reader.getAnnotationMetadata());
@ -119,13 +119,13 @@ public class AnnotationScopeMetadataResolverTests {
}
@Test
public void ctorWithNullScopedProxyMode() {
void ctorWithNullScopedProxyMode() {
assertThatIllegalArgumentException().isThrownBy(() ->
new AnnotationScopeMetadataResolver(null));
}
@Test
public void setScopeAnnotationTypeWithNullType() {
void setScopeAnnotationTypeWithNullType() {
assertThatIllegalArgumentException().isThrownBy(() ->
scopeMetadataResolver.setScopeAnnotationType(null));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -28,7 +28,7 @@ import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
*
* @author Chris Beams
*/
public class AsmCircularImportDetectionTests extends AbstractCircularImportDetectionTests {
class AsmCircularImportDetectionTests extends AbstractCircularImportDetectionTests {
@Override
protected ConfigurationClassParser newParser() {
@ -42,7 +42,7 @@ public class AsmCircularImportDetectionTests extends AbstractCircularImportDetec
}
@Override
protected String loadAsConfigurationSource(Class<?> clazz) throws Exception {
protected String loadAsConfigurationSource(Class<?> clazz) {
return clazz.getName();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class BeanMethodMetadataTests {
@Test
void providesBeanMethodBeanDefinition() throws Exception {
void providesBeanMethodBeanDefinition() {
AnnotationConfigApplicationContext context= new AnnotationConfigApplicationContext(Conf.class);
BeanDefinition beanDefinition = context.getBeanDefinition("myBean");
assertThat(beanDefinition).as("should provide AnnotatedBeanDefinition").isInstanceOf(AnnotatedBeanDefinition.class);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -39,13 +39,13 @@ import static org.assertj.core.api.Assertions.assertThat;
public class BeanMethodPolymorphismTests {
@Test
public void beanMethodDetectedOnSuperClass() {
void beanMethodDetectedOnSuperClass() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Config.class);
assertThat(ctx.getBean("testBean", BaseTestBean.class)).isNotNull();
}
@Test
public void beanMethodOverriding() {
void beanMethodOverriding() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(OverridingConfig.class);
ctx.setAllowBeanDefinitionOverriding(false);
@ -56,7 +56,7 @@ public class BeanMethodPolymorphismTests {
}
@Test
public void beanMethodOverridingOnASM() {
void beanMethodOverridingOnASM() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.registerBeanDefinition("config", new RootBeanDefinition(OverridingConfig.class.getName()));
ctx.setAllowBeanDefinitionOverriding(false);
@ -67,7 +67,7 @@ public class BeanMethodPolymorphismTests {
}
@Test
public void beanMethodOverridingWithNarrowedReturnType() {
void beanMethodOverridingWithNarrowedReturnType() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(NarrowedOverridingConfig.class);
ctx.setAllowBeanDefinitionOverriding(false);
@ -78,7 +78,7 @@ public class BeanMethodPolymorphismTests {
}
@Test
public void beanMethodOverridingWithNarrowedReturnTypeOnASM() {
void beanMethodOverridingWithNarrowedReturnTypeOnASM() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.registerBeanDefinition("config", new RootBeanDefinition(NarrowedOverridingConfig.class.getName()));
ctx.setAllowBeanDefinitionOverriding(false);
@ -89,7 +89,7 @@ public class BeanMethodPolymorphismTests {
}
@Test
public void beanMethodOverloadingWithoutInheritance() {
void beanMethodOverloadingWithoutInheritance() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(ConfigWithOverloading.class);
ctx.setAllowBeanDefinitionOverriding(false);
@ -98,7 +98,7 @@ public class BeanMethodPolymorphismTests {
}
@Test
public void beanMethodOverloadingWithoutInheritanceAndExtraDependency() {
void beanMethodOverloadingWithoutInheritanceAndExtraDependency() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(ConfigWithOverloading.class);
ctx.getDefaultListableBeanFactory().registerSingleton("anInt", 5);
@ -108,7 +108,7 @@ public class BeanMethodPolymorphismTests {
}
@Test
public void beanMethodOverloadingWithAdditionalMetadata() {
void beanMethodOverloadingWithAdditionalMetadata() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(ConfigWithOverloadingAndAdditionalMetadata.class);
ctx.setAllowBeanDefinitionOverriding(false);
@ -119,7 +119,7 @@ public class BeanMethodPolymorphismTests {
}
@Test
public void beanMethodOverloadingWithAdditionalMetadataButOtherMethodExecuted() {
void beanMethodOverloadingWithAdditionalMetadataButOtherMethodExecuted() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(ConfigWithOverloadingAndAdditionalMetadata.class);
ctx.getDefaultListableBeanFactory().registerSingleton("anInt", 5);
@ -131,7 +131,7 @@ public class BeanMethodPolymorphismTests {
}
@Test
public void beanMethodOverloadingWithInheritance() {
void beanMethodOverloadingWithInheritance() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(SubConfig.class);
ctx.setAllowBeanDefinitionOverriding(false);
@ -143,7 +143,7 @@ public class BeanMethodPolymorphismTests {
// SPR-11025
@Test
public void beanMethodOverloadingWithInheritanceAndList() {
void beanMethodOverloadingWithInheritanceAndList() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(SubConfigWithList.class);
ctx.setAllowBeanDefinitionOverriding(false);
@ -159,13 +159,13 @@ public class BeanMethodPolymorphismTests {
* so it's referred to here as 'shadowing' to distinguish the difference.
*/
@Test
public void beanMethodShadowing() {
void beanMethodShadowing() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ShadowConfig.class);
assertThat(ctx.getBean(String.class)).isEqualTo("shadow");
}
@Test
public void beanMethodThroughAopProxy() {
void beanMethodThroughAopProxy() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(Config.class);
ctx.register(AnnotationAwareAspectJAutoProxyCreator.class);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -51,13 +51,13 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
* @author Juergen Hoeller
* @author Chris Beams
*/
public class ClassPathBeanDefinitionScannerTests {
class ClassPathBeanDefinitionScannerTests {
private static final String BASE_PACKAGE = "example.scannable";
@Test
public void testSimpleScanWithDefaultFiltersAndPostProcessors() {
void testSimpleScanWithDefaultFiltersAndPostProcessors() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
int beanCount = scanner.scan(BASE_PACKAGE);
@ -83,7 +83,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testSimpleScanWithDefaultFiltersAndPrimaryLazyBean() {
void testSimpleScanWithDefaultFiltersAndPrimaryLazyBean() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
scanner.scan(BASE_PACKAGE);
@ -105,7 +105,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testDoubleScan() {
void testDoubleScan() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
@ -130,7 +130,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testWithIndex() {
void testWithIndex() {
GenericApplicationContext context = new GenericApplicationContext();
context.setClassLoader(CandidateComponentsTestClassLoader.index(
ClassPathScanningCandidateComponentProviderTests.class.getClassLoader(),
@ -149,7 +149,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testDoubleScanWithIndex() {
void testDoubleScanWithIndex() {
GenericApplicationContext context = new GenericApplicationContext();
context.setClassLoader(CandidateComponentsTestClassLoader.index(
ClassPathScanningCandidateComponentProviderTests.class.getClassLoader(),
@ -177,7 +177,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testSimpleScanWithDefaultFiltersAndNoPostProcessors() {
void testSimpleScanWithDefaultFiltersAndNoPostProcessors() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
scanner.setIncludeAnnotationConfig(false);
@ -192,7 +192,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testSimpleScanWithDefaultFiltersAndOverridingBean() {
void testSimpleScanWithDefaultFiltersAndOverridingBean() {
GenericApplicationContext context = new GenericApplicationContext();
context.registerBeanDefinition("stubFooDao", new RootBeanDefinition(TestBean.class));
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
@ -203,7 +203,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testSimpleScanWithDefaultFiltersAndOverridingBeanNotAllowed() {
void testSimpleScanWithDefaultFiltersAndOverridingBeanNotAllowed() {
GenericApplicationContext context = new GenericApplicationContext();
context.getDefaultListableBeanFactory().setAllowBeanDefinitionOverriding(false);
context.registerBeanDefinition("stubFooDao", new RootBeanDefinition(TestBean.class));
@ -216,7 +216,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testSimpleScanWithDefaultFiltersAndOverridingBeanAcceptedForSameBeanClass() {
void testSimpleScanWithDefaultFiltersAndOverridingBeanAcceptedForSameBeanClass() {
GenericApplicationContext context = new GenericApplicationContext();
context.getDefaultListableBeanFactory().setAllowBeanDefinitionOverriding(false);
context.registerBeanDefinition("stubFooDao", new RootBeanDefinition(StubFooDao.class));
@ -228,7 +228,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testSimpleScanWithDefaultFiltersAndDefaultBeanNameClash() {
void testSimpleScanWithDefaultFiltersAndDefaultBeanNameClash() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
scanner.setIncludeAnnotationConfig(false);
@ -240,7 +240,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testSimpleScanWithDefaultFiltersAndOverriddenEqualNamedBean() {
void testSimpleScanWithDefaultFiltersAndOverriddenEqualNamedBean() {
GenericApplicationContext context = new GenericApplicationContext();
context.registerBeanDefinition("myNamedDao", new RootBeanDefinition(NamedStubDao.class));
int initialBeanCount = context.getBeanDefinitionCount();
@ -258,7 +258,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testSimpleScanWithDefaultFiltersAndOverriddenCompatibleNamedBean() {
void testSimpleScanWithDefaultFiltersAndOverriddenCompatibleNamedBean() {
GenericApplicationContext context = new GenericApplicationContext();
RootBeanDefinition bd = new RootBeanDefinition(NamedStubDao.class);
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
@ -278,7 +278,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testSimpleScanWithDefaultFiltersAndSameBeanTwice() {
void testSimpleScanWithDefaultFiltersAndSameBeanTwice() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
scanner.setIncludeAnnotationConfig(false);
@ -288,7 +288,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testSimpleScanWithDefaultFiltersAndSpecifiedBeanNameClash() {
void testSimpleScanWithDefaultFiltersAndSpecifiedBeanNameClash() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
scanner.setIncludeAnnotationConfig(false);
@ -300,7 +300,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testCustomIncludeFilterWithoutDefaultsButIncludingPostProcessors() {
void testCustomIncludeFilterWithoutDefaultsButIncludingPostProcessors() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context, false);
scanner.addIncludeFilter(new AnnotationTypeFilter(CustomComponent.class));
@ -315,7 +315,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testCustomIncludeFilterWithoutDefaultsAndNoPostProcessors() {
void testCustomIncludeFilterWithoutDefaultsAndNoPostProcessors() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context, false);
scanner.addIncludeFilter(new AnnotationTypeFilter(CustomComponent.class));
@ -335,7 +335,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testCustomIncludeFilterAndDefaults() {
void testCustomIncludeFilterAndDefaults() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context, true);
scanner.addIncludeFilter(new AnnotationTypeFilter(CustomComponent.class));
@ -355,7 +355,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testCustomAnnotationExcludeFilterAndDefaults() {
void testCustomAnnotationExcludeFilterAndDefaults() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context, true);
scanner.addExcludeFilter(new AnnotationTypeFilter(Aspect.class));
@ -373,7 +373,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testCustomAssignableTypeExcludeFilterAndDefaults() {
void testCustomAssignableTypeExcludeFilterAndDefaults() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context, true);
scanner.addExcludeFilter(new AssignableTypeFilter(FooService.class));
@ -392,7 +392,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testCustomAssignableTypeExcludeFilterAndDefaultsWithoutPostProcessors() {
void testCustomAssignableTypeExcludeFilterAndDefaultsWithoutPostProcessors() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context, true);
scanner.setIncludeAnnotationConfig(false);
@ -410,7 +410,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testMultipleCustomExcludeFiltersAndDefaults() {
void testMultipleCustomExcludeFiltersAndDefaults() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context, true);
scanner.addExcludeFilter(new AssignableTypeFilter(FooService.class));
@ -430,7 +430,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testCustomBeanNameGenerator() {
void testCustomBeanNameGenerator() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
scanner.setBeanNameGenerator(new TestBeanNameGenerator());
@ -450,7 +450,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testMultipleBasePackagesWithDefaultsOnly() {
void testMultipleBasePackagesWithDefaultsOnly() {
GenericApplicationContext singlePackageContext = new GenericApplicationContext();
ClassPathBeanDefinitionScanner singlePackageScanner = new ClassPathBeanDefinitionScanner(singlePackageContext);
GenericApplicationContext multiPackageContext = new GenericApplicationContext();
@ -462,7 +462,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testMultipleScanCalls() {
void testMultipleScanCalls() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
int initialBeanCount = context.getBeanDefinitionCount();
@ -474,7 +474,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testBeanAutowiredWithAnnotationConfigEnabled() {
void testBeanAutowiredWithAnnotationConfigEnabled() {
GenericApplicationContext context = new GenericApplicationContext();
context.registerBeanDefinition("myBf", new RootBeanDefinition(StaticListableBeanFactory.class));
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
@ -504,7 +504,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testBeanNotAutowiredWithAnnotationConfigDisabled() {
void testBeanNotAutowiredWithAnnotationConfigDisabled() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
scanner.setIncludeAnnotationConfig(false);
@ -523,7 +523,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testAutowireCandidatePatternMatches() {
void testAutowireCandidatePatternMatches() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
scanner.setIncludeAnnotationConfig(true);
@ -538,7 +538,7 @@ public class ClassPathBeanDefinitionScannerTests {
}
@Test
public void testAutowireCandidatePatternDoesNotMatch() {
void testAutowireCandidatePatternDoesNotMatch() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
scanner.setIncludeAnnotationConfig(true);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -37,13 +37,13 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Mark Pollack
* @author Juergen Hoeller
*/
public class ClassPathFactoryBeanDefinitionScannerTests {
class ClassPathFactoryBeanDefinitionScannerTests {
private static final String BASE_PACKAGE = FactoryMethodComponent.class.getPackage().getName();
@Test
public void testSingletonScopedFactoryMethod() {
void testSingletonScopedFactoryMethod() {
GenericApplicationContext context = new GenericApplicationContext();
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -49,10 +49,10 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Juergen Hoeller
* @author Chris Beams
*/
public class CommonAnnotationBeanPostProcessorTests {
class CommonAnnotationBeanPostProcessorTests {
@Test
public void testPostConstructAndPreDestroy() {
void testPostConstructAndPreDestroy() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.addBeanPostProcessor(new CommonAnnotationBeanPostProcessor());
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(AnnotatedInitDestroyBean.class));
@ -64,7 +64,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testPostConstructAndPreDestroyWithPostProcessor() {
void testPostConstructAndPreDestroyWithPostProcessor() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.addBeanPostProcessor(new InitDestroyBeanPostProcessor());
bf.addBeanPostProcessor(new CommonAnnotationBeanPostProcessor());
@ -77,7 +77,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testPostConstructAndPreDestroyWithApplicationContextAndPostProcessor() {
void testPostConstructAndPreDestroyWithApplicationContextAndPostProcessor() {
GenericApplicationContext ctx = new GenericApplicationContext();
ctx.registerBeanDefinition("bpp1", new RootBeanDefinition(InitDestroyBeanPostProcessor.class));
ctx.registerBeanDefinition("bpp2", new RootBeanDefinition(CommonAnnotationBeanPostProcessor.class));
@ -91,7 +91,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testPostConstructAndPreDestroyWithLegacyAnnotations() {
void testPostConstructAndPreDestroyWithLegacyAnnotations() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.addBeanPostProcessor(new CommonAnnotationBeanPostProcessor());
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(LegacyAnnotatedInitDestroyBean.class));
@ -103,7 +103,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testPostConstructAndPreDestroyWithManualConfiguration() {
void testPostConstructAndPreDestroyWithManualConfiguration() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
InitDestroyAnnotationBeanPostProcessor bpp = new InitDestroyAnnotationBeanPostProcessor();
bpp.setInitAnnotationType(PostConstruct.class);
@ -118,7 +118,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testPostProcessorWithNullBean() {
void testPostProcessorWithNullBean() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.addBeanPostProcessor(new CommonAnnotationBeanPostProcessor());
RootBeanDefinition rbd = new RootBeanDefinition(NullFactory.class);
@ -130,7 +130,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testSerialization() throws Exception {
void testSerialization() throws Exception {
CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();
CommonAnnotationBeanPostProcessor bpp2 = SerializationTestUtils.serializeAndDeserialize(bpp);
@ -140,7 +140,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testSerializationWithManualConfiguration() throws Exception {
void testSerializationWithManualConfiguration() throws Exception {
InitDestroyAnnotationBeanPostProcessor bpp = new InitDestroyAnnotationBeanPostProcessor();
bpp.setInitAnnotationType(PostConstruct.class);
bpp.setDestroyAnnotationType(PreDestroy.class);
@ -152,7 +152,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testResourceInjection() {
void testResourceInjection() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();
bpp.setResourceFactory(bf);
@ -176,7 +176,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testResourceInjectionWithPrototypes() {
void testResourceInjectionWithPrototypes() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();
bpp.setResourceFactory(bf);
@ -213,7 +213,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testResourceInjectionWithLegacyAnnotations() {
void testResourceInjectionWithLegacyAnnotations() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();
bpp.setResourceFactory(bf);
@ -237,7 +237,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testResourceInjectionWithResolvableDependencyType() {
void testResourceInjectionWithResolvableDependencyType() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();
bpp.setBeanFactory(bf);
@ -273,7 +273,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testResourceInjectionWithDefaultMethod() {
void testResourceInjectionWithDefaultMethod() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();
bpp.setBeanFactory(bf);
@ -293,7 +293,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testResourceInjectionWithTwoProcessors() {
void testResourceInjectionWithTwoProcessors() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();
bpp.setResourceFactory(bf);
@ -318,7 +318,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testResourceInjectionFromJndi() {
void testResourceInjectionFromJndi() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();
SimpleJndiBeanFactory resourceFactory = new SimpleJndiBeanFactory();
@ -343,7 +343,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testExtendedResourceInjection() {
void testExtendedResourceInjection() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();
bpp.setBeanFactory(bf);
@ -396,7 +396,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testExtendedResourceInjectionWithOverriding() {
void testExtendedResourceInjectionWithOverriding() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();
bpp.setBeanFactory(bf);
@ -453,7 +453,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testExtendedEjbInjection() {
void testExtendedEjbInjection() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();
bpp.setBeanFactory(bf);
@ -490,7 +490,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testLazyResolutionWithResourceField() {
void testLazyResolutionWithResourceField() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();
bpp.setBeanFactory(bf);
@ -508,7 +508,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testLazyResolutionWithResourceMethod() {
void testLazyResolutionWithResourceMethod() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();
bpp.setBeanFactory(bf);
@ -526,7 +526,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testLazyResolutionWithCglibProxy() {
void testLazyResolutionWithCglibProxy() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();
bpp.setBeanFactory(bf);
@ -544,7 +544,7 @@ public class CommonAnnotationBeanPostProcessorTests {
}
@Test
public void testLazyResolutionWithFallbackTypeMatch() {
void testLazyResolutionWithFallbackTypeMatch() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.setAutowireCandidateResolver(new ContextAnnotationAutowireCandidateResolver());
CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Mark Fisher
* @author Chris Beams
*/
public class ComponentScanParserBeanDefinitionDefaultsTests {
class ComponentScanParserBeanDefinitionDefaultsTests {
private static final String TEST_BEAN_NAME = "componentScanParserBeanDefinitionDefaultsTests.DefaultsTestBean";
@ -38,12 +38,12 @@ public class ComponentScanParserBeanDefinitionDefaultsTests {
@BeforeEach
public void setUp() {
void setUp() {
DefaultsTestBean.INIT_COUNT = 0;
}
@Test
public void testDefaultLazyInit() {
void testDefaultLazyInit() {
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultWithNoOverridesTests.xml");
@ -54,7 +54,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests {
}
@Test
public void testLazyInitTrue() {
void testLazyInitTrue() {
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultLazyInitTrueTests.xml");
@ -67,7 +67,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests {
}
@Test
public void testLazyInitFalse() {
void testLazyInitFalse() {
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultLazyInitFalseTests.xml");
@ -78,7 +78,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests {
}
@Test
public void testDefaultAutowire() {
void testDefaultAutowire() {
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultWithNoOverridesTests.xml");
@ -90,7 +90,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests {
}
@Test
public void testAutowireNo() {
void testAutowireNo() {
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultAutowireNoTests.xml");
@ -102,7 +102,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests {
}
@Test
public void testAutowireConstructor() {
void testAutowireConstructor() {
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultAutowireConstructorTests.xml");
@ -115,7 +115,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests {
}
@Test
public void testAutowireByType() {
void testAutowireByType() {
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultAutowireByTypeTests.xml");
@ -124,7 +124,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests {
}
@Test
public void testAutowireByName() {
void testAutowireByName() {
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultAutowireByNameTests.xml");
@ -137,7 +137,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests {
}
@Test
public void testDefaultDependencyCheck() {
void testDefaultDependencyCheck() {
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultWithNoOverridesTests.xml");
@ -149,7 +149,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests {
}
@Test
public void testDefaultInitAndDestroyMethodsNotDefined() {
void testDefaultInitAndDestroyMethodsNotDefined() {
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultWithNoOverridesTests.xml");
@ -161,7 +161,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests {
}
@Test
public void testDefaultInitAndDestroyMethodsDefined() {
void testDefaultInitAndDestroyMethodsDefined() {
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultInitAndDestroyMethodsTests.xml");
@ -173,7 +173,7 @@ public class ComponentScanParserBeanDefinitionDefaultsTests {
}
@Test
public void testDefaultNonExistingInitAndDestroyMethodsDefined() {
void testDefaultNonExistingInitAndDestroyMethodsDefined() {
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultNonExistingInitAndDestroyMethodsTests.xml");

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -34,10 +34,10 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Juergen Hoeller
* @author Sam Brannen
*/
public class ComponentScanParserScopedProxyTests {
class ComponentScanParserScopedProxyTests {
@Test
public void testDefaultScopedProxy() {
void testDefaultScopedProxy() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"org/springframework/context/annotation/scopedProxyDefaultTests.xml");
context.getBeanFactory().registerScope("myScope", new SimpleMapScope());
@ -49,7 +49,7 @@ public class ComponentScanParserScopedProxyTests {
}
@Test
public void testNoScopedProxy() {
void testNoScopedProxy() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"org/springframework/context/annotation/scopedProxyNoTests.xml");
context.getBeanFactory().registerScope("myScope", new SimpleMapScope());
@ -61,7 +61,7 @@ public class ComponentScanParserScopedProxyTests {
}
@Test
public void testInterfacesScopedProxy() throws Exception {
void testInterfacesScopedProxy() throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"org/springframework/context/annotation/scopedProxyInterfacesTests.xml");
context.getBeanFactory().registerScope("myScope", new SimpleMapScope());
@ -79,7 +79,7 @@ public class ComponentScanParserScopedProxyTests {
}
@Test
public void testTargetClassScopedProxy() throws Exception {
void testTargetClassScopedProxy() throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"org/springframework/context/annotation/scopedProxyTargetClassTests.xml");
context.getBeanFactory().registerScope("myScope", new SimpleMapScope());
@ -97,7 +97,7 @@ public class ComponentScanParserScopedProxyTests {
@Test
@SuppressWarnings("resource")
public void testInvalidConfigScopedProxy() throws Exception {
public void testInvalidConfigScopedProxy() {
assertThatExceptionOfType(BeanDefinitionParsingException.class).isThrownBy(() ->
new ClassPathXmlApplicationContext("org/springframework/context/annotation/scopedProxyInvalidConfigTests.xml"))
.withMessageContaining("Cannot define both 'scope-resolver' and 'scoped-proxy' on <component-scan> tag")

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Chris Beams
* @author Sam Brannen
*/
public class ComponentScanParserTests {
class ComponentScanParserTests {
private ClassPathXmlApplicationContext loadContext(String path) {
return new ClassPathXmlApplicationContext(path, getClass());
@ -49,7 +49,7 @@ public class ComponentScanParserTests {
@Test
public void aspectjTypeFilter() {
void aspectjTypeFilter() {
ClassPathXmlApplicationContext context = loadContext("aspectjTypeFilterTests.xml");
assertThat(context.containsBean("fooServiceImpl")).isTrue();
assertThat(context.containsBean("stubFooDao")).isTrue();
@ -58,7 +58,7 @@ public class ComponentScanParserTests {
}
@Test
public void aspectjTypeFilterWithPlaceholders() {
void aspectjTypeFilterWithPlaceholders() {
System.setProperty("basePackage", "example.scannable, test");
System.setProperty("scanInclude", "example.scannable.FooService+");
System.setProperty("scanExclude", "example..Scoped*Test*");
@ -77,21 +77,21 @@ public class ComponentScanParserTests {
}
@Test
public void nonMatchingResourcePattern() {
void nonMatchingResourcePattern() {
ClassPathXmlApplicationContext context = loadContext("nonMatchingResourcePatternTests.xml");
assertThat(context.containsBean("fooServiceImpl")).isFalse();
context.close();
}
@Test
public void matchingResourcePattern() {
void matchingResourcePattern() {
ClassPathXmlApplicationContext context = loadContext("matchingResourcePatternTests.xml");
assertThat(context.containsBean("fooServiceImpl")).isTrue();
context.close();
}
@Test
public void componentScanWithAutowiredQualifier() {
void componentScanWithAutowiredQualifier() {
ClassPathXmlApplicationContext context = loadContext("componentScanWithAutowiredQualifierTests.xml");
AutowiredQualifierFooService fooService = (AutowiredQualifierFooService) context.getBean("fooService");
assertThat(fooService.isInitCalled()).isTrue();
@ -100,7 +100,7 @@ public class ComponentScanParserTests {
}
@Test
public void customAnnotationUsedForBothComponentScanAndQualifier() {
void customAnnotationUsedForBothComponentScanAndQualifier() {
ClassPathXmlApplicationContext context = loadContext("customAnnotationUsedForBothComponentScanAndQualifierTests.xml");
KustomAnnotationAutowiredBean testBean = (KustomAnnotationAutowiredBean) context.getBean("testBean");
assertThat(testBean.getDependency()).isNotNull();
@ -108,7 +108,7 @@ public class ComponentScanParserTests {
}
@Test
public void customTypeFilter() {
void customTypeFilter() {
ClassPathXmlApplicationContext context = loadContext("customTypeFilterTests.xml");
KustomAnnotationAutowiredBean testBean = (KustomAnnotationAutowiredBean) context.getBean("testBean");
assertThat(testBean.getDependency()).isNotNull();
@ -116,7 +116,7 @@ public class ComponentScanParserTests {
}
@Test
public void componentScanRespectsProfileAnnotation() {
void componentScanRespectsProfileAnnotation() {
String xmlLocation = "org/springframework/context/annotation/componentScanRespectsProfileAnnotationTests.xml";
{ // should exclude the profile-annotated bean if active profiles remains unset
GenericXmlApplicationContext context = new GenericXmlApplicationContext();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -39,14 +39,14 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Chris Beams
* @since 3.1
*/
public class ConfigurationClassPostConstructAndAutowiringTests {
class ConfigurationClassPostConstructAndAutowiringTests {
/**
* Prior to the fix for SPR-8080, this method would succeed due to ordering of
* configuration class registration.
*/
@Test
public void control() {
void control() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(Config1.class, Config2.class);
ctx.refresh();
@ -62,7 +62,7 @@ public class ConfigurationClassPostConstructAndAutowiringTests {
* configuration class registration.
*/
@Test
public void originalReproCase() {
void originalReproCase() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(Config2.class, Config1.class);
ctx.refresh();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -238,7 +238,7 @@ class ConfigurationClassPostProcessorAotContributionTests {
}
@Override
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
Assert.notNull(this.metadata, "Metadata was not injected");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -1155,11 +1155,13 @@ class ConfigurationClassPostProcessorTests {
@Configuration
static class StaticSingletonBeanConfig {
public static @Bean Foo foo() {
@Bean
public static Foo foo() {
return new Foo();
}
public static @Bean Bar bar() {
@Bean
public static Bar bar() {
return new Bar(foo());
}
}
@ -1598,7 +1600,7 @@ class ConfigurationClassPostProcessorTests {
public static class WildcardWithGenericExtendsConfiguration {
@Bean
public Repository<? extends Object> genericRepo() {
public Repository<?> genericRepo() {
return new Repository<String>();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class ConfigurationClassWithConditionTests {
@Test
public void conditionalOnMissingBeanMatch() throws Exception {
void conditionalOnMissingBeanMatch() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(BeanOneConfiguration.class, BeanTwoConfiguration.class);
ctx.refresh();
@ -53,7 +53,7 @@ public class ConfigurationClassWithConditionTests {
}
@Test
public void conditionalOnMissingBeanNoMatch() throws Exception {
void conditionalOnMissingBeanNoMatch() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(BeanTwoConfiguration.class);
ctx.refresh();
@ -63,7 +63,7 @@ public class ConfigurationClassWithConditionTests {
}
@Test
public void conditionalOnBeanMatch() throws Exception {
void conditionalOnBeanMatch() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(BeanOneConfiguration.class, BeanThreeConfiguration.class);
ctx.refresh();
@ -72,7 +72,7 @@ public class ConfigurationClassWithConditionTests {
}
@Test
public void conditionalOnBeanNoMatch() throws Exception {
void conditionalOnBeanNoMatch() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(BeanThreeConfiguration.class);
ctx.refresh();
@ -81,7 +81,7 @@ public class ConfigurationClassWithConditionTests {
}
@Test
public void metaConditional() throws Exception {
void metaConditional() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(ConfigurationWithMetaCondition.class);
ctx.refresh();
@ -89,7 +89,7 @@ public class ConfigurationClassWithConditionTests {
}
@Test
public void metaConditionalWithAsm() throws Exception {
void metaConditionalWithAsm() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.registerBeanDefinition("config", new RootBeanDefinition(ConfigurationWithMetaCondition.class.getName()));
ctx.refresh();
@ -97,7 +97,7 @@ public class ConfigurationClassWithConditionTests {
}
@Test
public void nonConfigurationClass() throws Exception {
void nonConfigurationClass() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(NonConfigurationClass.class);
ctx.refresh();
@ -105,7 +105,7 @@ public class ConfigurationClassWithConditionTests {
}
@Test
public void nonConfigurationClassWithAsm() throws Exception {
void nonConfigurationClassWithAsm() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.registerBeanDefinition("config", new RootBeanDefinition(NonConfigurationClass.class.getName()));
ctx.refresh();
@ -113,7 +113,7 @@ public class ConfigurationClassWithConditionTests {
}
@Test
public void methodConditional() throws Exception {
void methodConditional() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(ConditionOnMethodConfiguration.class);
ctx.refresh();
@ -121,7 +121,7 @@ public class ConfigurationClassWithConditionTests {
}
@Test
public void methodConditionalWithAsm() throws Exception {
void methodConditionalWithAsm() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.registerBeanDefinition("config", new RootBeanDefinition(ConditionOnMethodConfiguration.class.getName()));
ctx.refresh();
@ -129,27 +129,27 @@ public class ConfigurationClassWithConditionTests {
}
@Test
public void importsNotCreated() throws Exception {
void importsNotCreated() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(ImportsNotCreated.class);
ctx.refresh();
}
@Test
public void conditionOnOverriddenMethodHonored() {
void conditionOnOverriddenMethodHonored() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConfigWithBeanSkipped.class);
assertThat(context.getBeansOfType(ExampleBean.class)).isEmpty();
}
@Test
public void noConditionOnOverriddenMethodHonored() {
void noConditionOnOverriddenMethodHonored() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConfigWithBeanReactivated.class);
Map<String, ExampleBean> beans = context.getBeansOfType(ExampleBean.class);
assertThat(beans).containsOnlyKeys("baz");
}
@Test
public void configWithAlternativeBeans() {
void configWithAlternativeBeans() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConfigWithAlternativeBeans.class);
Map<String, ExampleBean> beans = context.getBeansOfType(ExampleBean.class);
assertThat(beans).containsOnlyKeys("baz");

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -108,12 +108,12 @@ class ConfigurationWithFactoryBeanAndAutowiringTests {
private boolean initialized = false;
@Override
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
this.initialized = true;
}
@Override
public String getObject() throws Exception {
public String getObject() {
return "foo";
}
@ -142,7 +142,7 @@ class ConfigurationWithFactoryBeanAndAutowiringTests {
}
@Override
public T getObject() throws Exception {
public T getObject() {
return obj;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -40,50 +40,50 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Phillip Webb
*/
public class ConfigurationWithFactoryBeanBeanEarlyDeductionTests {
class ConfigurationWithFactoryBeanBeanEarlyDeductionTests {
@Test
public void preFreezeDirect() {
void preFreezeDirect() {
assertPreFreeze(DirectConfiguration.class);
}
@Test
public void postFreezeDirect() {
void postFreezeDirect() {
assertPostFreeze(DirectConfiguration.class);
}
@Test
public void preFreezeGenericMethod() {
void preFreezeGenericMethod() {
assertPreFreeze(GenericMethodConfiguration.class);
}
@Test
public void postFreezeGenericMethod() {
void postFreezeGenericMethod() {
assertPostFreeze(GenericMethodConfiguration.class);
}
@Test
public void preFreezeGenericClass() {
void preFreezeGenericClass() {
assertPreFreeze(GenericClassConfiguration.class);
}
@Test
public void postFreezeGenericClass() {
void postFreezeGenericClass() {
assertPostFreeze(GenericClassConfiguration.class);
}
@Test
public void preFreezeAttribute() {
void preFreezeAttribute() {
assertPreFreeze(AttributeClassConfiguration.class);
}
@Test
public void postFreezeAttribute() {
void postFreezeAttribute() {
assertPostFreeze(AttributeClassConfiguration.class);
}
@Test
public void preFreezeUnresolvedGenericFactoryBean() {
void preFreezeUnresolvedGenericFactoryBean() {
// Covers the case where a @Configuration is picked up via component scanning
// and its bean definition only has a String bean class. In such cases
// beanDefinition.hasBeanClass() returns false so we need to actually
@ -212,7 +212,7 @@ public class ConfigurationWithFactoryBeanBeanEarlyDeductionTests {
}
@Override
public T getObject() throws Exception {
public T getObject() {
return this.instance;
}
@ -236,7 +236,7 @@ public class ConfigurationWithFactoryBeanBeanEarlyDeductionTests {
private final Object object = new MyBean();
@Override
public Object getObject() throws Exception {
public Object getObject() {
return object;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -29,28 +29,28 @@ import static org.mockito.Mockito.mock;
*
* @author Stephane Nicoll
*/
public class DeferredImportSelectorTests {
class DeferredImportSelectorTests {
@Test
public void entryEqualsSameInstance() {
void entryEqualsSameInstance() {
AnnotationMetadata metadata = mock();
Group.Entry entry = new Group.Entry(metadata, "com.example.Test");
assertThat(entry).isEqualTo(entry);
}
@Test
public void entryEqualsSameMetadataAndClassName() {
void entryEqualsSameMetadataAndClassName() {
AnnotationMetadata metadata = mock();
assertThat(new Group.Entry(metadata, "com.example.Test")).isEqualTo(new Group.Entry(metadata, "com.example.Test"));
}
@Test
public void entryEqualDifferentMetadataAndSameClassName() {
void entryEqualDifferentMetadataAndSameClassName() {
assertThat(new Group.Entry(mock(), "com.example.Test")).isNotEqualTo(new Group.Entry(mock(), "com.example.Test"));
}
@Test
public void entryEqualSameMetadataAnDifferentClassName() {
void entryEqualSameMetadataAnDifferentClassName() {
AnnotationMetadata metadata = mock();
assertThat(new Group.Entry(metadata, "com.example.AnotherTest")).isNotEqualTo(new Group.Entry(metadata, "com.example.Test"));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -33,10 +33,10 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Juergen Hoeller
* @author Stephane Nicoll
*/
public class DestroyMethodInferenceTests {
class DestroyMethodInferenceTests {
@Test
public void beanMethods() {
void beanMethods() {
ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext(Config.class);
WithExplicitDestroyMethod c0 = ctx.getBean(WithExplicitDestroyMethod.class);
WithLocalCloseMethod c1 = ctx.getBean("c1", WithLocalCloseMethod.class);
@ -83,7 +83,7 @@ public class DestroyMethodInferenceTests {
}
@Test
public void xml() {
void xml() {
ConfigurableApplicationContext ctx = new GenericXmlApplicationContext(
getClass(), "DestroyMethodInferenceTests-context.xml");
WithLocalCloseMethod x1 = ctx.getBean("x1", WithLocalCloseMethod.class);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -20,7 +20,7 @@ package org.springframework.context.annotation;
* @author Juergen Hoeller
* @author Chris Beams
*/
public class DoubleScanTests extends SimpleScanTests {
class DoubleScanTests extends SimpleScanTests {
@Override
protected String[] getConfigLocations() {

View File

@ -70,7 +70,7 @@ public class ImportSelectorTests {
@BeforeEach
public void cleanup() {
void cleanup() {
ImportSelectorTests.importFrom.clear();
SampleImportSelector.cleanup();
TestImportGroup.cleanup();
@ -78,7 +78,7 @@ public class ImportSelectorTests {
@Test
public void importSelectors() {
void importSelectors() {
DefaultListableBeanFactory beanFactory = spy(new DefaultListableBeanFactory());
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(beanFactory);
context.register(Config.class);
@ -92,7 +92,7 @@ public class ImportSelectorTests {
}
@Test
public void invokeAwareMethodsInImportSelector() {
void invokeAwareMethodsInImportSelector() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AwareConfig.class);
assertThat(SampleImportSelector.beanFactory).isEqualTo(context.getBeanFactory());
assertThat(SampleImportSelector.classLoader).isEqualTo(context.getBeanFactory().getBeanClassLoader());
@ -101,7 +101,7 @@ public class ImportSelectorTests {
}
@Test
public void correctMetadataOnIndirectImports() {
void correctMetadataOnIndirectImports() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(IndirectConfig.class);
String indirectImport = IndirectImport.class.getName();
assertThat(importFrom.get(ImportSelector1.class)).isEqualTo(indirectImport);
@ -115,7 +115,7 @@ public class ImportSelectorTests {
}
@Test
public void importSelectorsWithGroup() {
void importSelectorsWithGroup() {
DefaultListableBeanFactory beanFactory = spy(new DefaultListableBeanFactory());
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(beanFactory);
context.register(GroupedConfig.class);
@ -131,7 +131,7 @@ public class ImportSelectorTests {
}
@Test
public void importSelectorsSeparateWithGroup() {
void importSelectorsSeparateWithGroup() {
DefaultListableBeanFactory beanFactory = spy(new DefaultListableBeanFactory());
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(beanFactory);
context.register(GroupedConfig1.class);
@ -146,7 +146,7 @@ public class ImportSelectorTests {
}
@Test
public void importSelectorsWithNestedGroup() {
void importSelectorsWithNestedGroup() {
DefaultListableBeanFactory beanFactory = spy(new DefaultListableBeanFactory());
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(beanFactory);
context.register(ParentConfiguration1.class);
@ -166,7 +166,7 @@ public class ImportSelectorTests {
}
@Test
public void importSelectorsWithNestedGroupSameDeferredImport() {
void importSelectorsWithNestedGroupSameDeferredImport() {
DefaultListableBeanFactory beanFactory = spy(new DefaultListableBeanFactory());
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(beanFactory);
context.register(ParentConfiguration2.class);
@ -185,7 +185,7 @@ public class ImportSelectorTests {
}
@Test
public void invokeAwareMethodsInImportGroup() {
void invokeAwareMethodsInImportGroup() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(GroupedConfig1.class);
assertThat(TestImportGroup.beanFactory).isEqualTo(context.getBeanFactory());
assertThat(TestImportGroup.classLoader).isEqualTo(context.getBeanFactory().getBeanClassLoader());

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,10 +26,10 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
/**
* @author Andy Wilkinson
*/
public class ImportVersusDirectRegistrationTests {
class ImportVersusDirectRegistrationTests {
@Test
public void thingIsNotAvailableWhenOuterConfigurationIsRegisteredDirectly() {
void thingIsNotAvailableWhenOuterConfigurationIsRegisteredDirectly() {
try (AnnotationConfigApplicationContext directRegistration = new AnnotationConfigApplicationContext()) {
directRegistration.register(AccidentalLiteConfiguration.class);
directRegistration.refresh();
@ -39,7 +39,7 @@ public class ImportVersusDirectRegistrationTests {
}
@Test
public void thingIsNotAvailableWhenOuterConfigurationIsRegisteredWithClassName() {
void thingIsNotAvailableWhenOuterConfigurationIsRegisteredWithClassName() {
try (AnnotationConfigApplicationContext directRegistration = new AnnotationConfigApplicationContext()) {
directRegistration.registerBeanDefinition("config",
new RootBeanDefinition(AccidentalLiteConfiguration.class.getName()));
@ -50,7 +50,7 @@ public class ImportVersusDirectRegistrationTests {
}
@Test
public void thingIsNotAvailableWhenOuterConfigurationIsImported() {
void thingIsNotAvailableWhenOuterConfigurationIsImported() {
try (AnnotationConfigApplicationContext viaImport = new AnnotationConfigApplicationContext()) {
viaImport.register(Importer.class);
viaImport.refresh();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -32,10 +32,10 @@ import static org.springframework.beans.factory.support.BeanDefinitionBuilder.ro
*
* @author Chris Beams
*/
public class InvalidConfigurationClassDefinitionTests {
class InvalidConfigurationClassDefinitionTests {
@Test
public void configurationClassesMayNotBeFinal() {
void configurationClassesMayNotBeFinal() {
@Configuration
final class Config { }

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -45,7 +45,7 @@ import static org.mockito.Mockito.reset;
*
* @author Phillip Webb
*/
public class ParserStrategyUtilsTests {
class ParserStrategyUtilsTests {
@Mock
private Environment environment;
@ -66,7 +66,7 @@ public class ParserStrategyUtilsTests {
}
@Test
public void instantiateClassWhenHasNoArgsConstructorCallsAware() {
void instantiateClassWhenHasNoArgsConstructorCallsAware() {
NoArgsConstructor instance = instantiateClass(NoArgsConstructor.class);
assertThat(instance.setEnvironment).isSameAs(this.environment);
assertThat(instance.setBeanFactory).isSameAs(this.registry);
@ -75,7 +75,7 @@ public class ParserStrategyUtilsTests {
}
@Test
public void instantiateClassWhenHasSingleConstructorInjectsParams() {
void instantiateClassWhenHasSingleConstructorInjectsParams() {
ArgsConstructor instance = instantiateClass(ArgsConstructor.class);
assertThat(instance.environment).isSameAs(this.environment);
assertThat(instance.beanFactory).isSameAs(this.registry);
@ -84,7 +84,7 @@ public class ParserStrategyUtilsTests {
}
@Test
public void instantiateClassWhenHasSingleConstructorAndAwareInjectsParamsAndCallsAware() {
void instantiateClassWhenHasSingleConstructorAndAwareInjectsParamsAndCallsAware() {
ArgsConstructorAndAware instance = instantiateClass(ArgsConstructorAndAware.class);
assertThat(instance.environment).isSameAs(this.environment);
assertThat(instance.setEnvironment).isSameAs(this.environment);
@ -97,20 +97,20 @@ public class ParserStrategyUtilsTests {
}
@Test
public void instantiateClassWhenHasMultipleConstructorsUsesNoArgsConstructor() {
void instantiateClassWhenHasMultipleConstructorsUsesNoArgsConstructor() {
// Remain back-compatible by using the default constructor if there's more than one
MultipleConstructors instance = instantiateClass(MultipleConstructors.class);
assertThat(instance.usedDefaultConstructor).isTrue();
}
@Test
public void instantiateClassWhenHasMultipleConstructorsAndNotDefaultThrowsException() {
void instantiateClassWhenHasMultipleConstructorsAndNotDefaultThrowsException() {
assertThatExceptionOfType(BeanInstantiationException.class).isThrownBy(() ->
instantiateClass(MultipleConstructorsWithNoDefault.class));
}
@Test
public void instantiateClassWhenHasUnsupportedParameterThrowsException() {
void instantiateClassWhenHasUnsupportedParameterThrowsException() {
assertThatExceptionOfType(BeanInstantiationException.class).isThrownBy(() ->
instantiateClass(InvalidConstructorParameterType.class))
.withCauseInstanceOf(IllegalStateException.class)
@ -118,7 +118,7 @@ public class ParserStrategyUtilsTests {
}
@Test
public void instantiateClassHasSubclassParameterThrowsException() {
void instantiateClassHasSubclassParameterThrowsException() {
// To keep the algorithm simple we don't support subtypes
assertThatExceptionOfType(BeanInstantiationException.class).isThrownBy(() ->
instantiateClass(InvalidConstructorParameterSubType.class))
@ -127,14 +127,14 @@ public class ParserStrategyUtilsTests {
}
@Test
public void instantiateClassWhenHasNoBeanClassLoaderInjectsNull() {
void instantiateClassWhenHasNoBeanClassLoaderInjectsNull() {
reset(this.resourceLoader);
ArgsConstructor instance = instantiateClass(ArgsConstructor.class);
assertThat(instance.beanClassLoader).isNull();
}
@Test
public void instantiateClassWhenHasNoBeanClassLoaderDoesNotCallAware() {
void instantiateClassWhenHasNoBeanClassLoaderDoesNotCallAware() {
reset(this.resourceLoader);
NoArgsConstructor instance = instantiateClass(NoArgsConstructor.class);
assertThat(instance.setBeanClassLoader).isNull();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -32,10 +32,10 @@ import static org.assertj.core.api.Assertions.assertThat;
* @since 3.1
* @see org.springframework.util.ReflectionUtilsTests
*/
public class ReflectionUtilsIntegrationTests {
class ReflectionUtilsIntegrationTests {
@Test
public void getUniqueDeclaredMethods_withCovariantReturnType_andCglibRewrittenMethodNames() throws Exception {
void getUniqueDeclaredMethods_withCovariantReturnType_andCglibRewrittenMethodNames() {
Class<?> cglibLeaf = new ConfigurationClassEnhancer().enhance(Leaf.class, null);
int m1MethodCount = 0;
Method[] methods = ReflectionUtils.getUniqueDeclaredMethods(cglibLeaf);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -31,10 +31,10 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Mark Fisher
* @author Juergen Hoeller
*/
public class SimpleConfigTests {
class SimpleConfigTests {
@Test
public void testFooService() throws Exception {
void testFooService() throws Exception {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getConfigLocations(), getClass());
FooService fooService = ctx.getBean("fooServiceImpl", FooService.class);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -29,14 +29,14 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Juergen Hoeller
* @author Chris Beams
*/
public class SimpleScanTests {
class SimpleScanTests {
protected String[] getConfigLocations() {
return new String[] {"simpleScanTests.xml"};
}
@Test
public void testFooService() throws Exception {
void testFooService() {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getConfigLocations(), getClass());
FooService fooService = (FooService) ctx.getBean("fooServiceImpl");

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -77,7 +77,7 @@ class Spr11202Tests {
}
@Bean
public String value() throws Exception {
public String value() {
String name = foo().getObject().getName();
Assert.state(name != null, "Name cannot be null");
return name;
@ -85,7 +85,7 @@ class Spr11202Tests {
@Bean
@Conditional(NoBarCondition.class)
public String bar() throws Exception {
public String bar() {
return "bar";
}
}
@ -115,7 +115,7 @@ class Spr11202Tests {
private Foo foo = new Foo();
@Override
public Foo getObject() throws Exception {
public Foo getObject() {
return foo;
}
@ -130,7 +130,7 @@ class Spr11202Tests {
}
@Override
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
this.foo.name = "foo";
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,33 +27,33 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
/**
* @author Stephane Nicoll
*/
public class Spr12278Tests {
class Spr12278Tests {
private AnnotationConfigApplicationContext context;
@AfterEach
public void close() {
void close() {
if (context != null) {
context.close();
}
}
@Test
public void componentSingleConstructor() {
void componentSingleConstructor() {
this.context = new AnnotationConfigApplicationContext(BaseConfiguration.class,
SingleConstructorComponent.class);
assertThat(this.context.getBean(SingleConstructorComponent.class).autowiredName).isEqualTo("foo");
}
@Test
public void componentTwoConstructorsNoHint() {
void componentTwoConstructorsNoHint() {
this.context = new AnnotationConfigApplicationContext(BaseConfiguration.class,
TwoConstructorsComponent.class);
assertThat(this.context.getBean(TwoConstructorsComponent.class).name).isEqualTo("fallback");
}
@Test
public void componentTwoSpecificConstructorsNoHint() {
void componentTwoSpecificConstructorsNoHint() {
assertThatExceptionOfType(BeanCreationException.class).isThrownBy(() ->
new AnnotationConfigApplicationContext(BaseConfiguration.class, TwoSpecificConstructorsComponent.class))
.withMessageContaining("No default constructor found");

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -34,29 +34,30 @@ import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Stephane Nicoll
*/
public class Spr12636Tests {
class Spr12636Tests {
private ConfigurableApplicationContext context;
@AfterEach
public void closeContext() {
void closeContext() {
if (this.context != null) {
this.context.close();
}
}
@Test
public void orderOnImplementation() {
void orderOnImplementation() {
this.context = new AnnotationConfigApplicationContext(
UserServiceTwo.class, UserServiceOne.class, UserServiceCollector.class);
UserServiceCollector bean = this.context.getBean(UserServiceCollector.class);
assertThat(bean.userServices).element(0).isSameAs(context.getBean("serviceOne", UserService.class));
assertThat(bean.userServices).element(1).isSameAs(context.getBean("serviceTwo", UserService.class));
assertThat(bean.userServices).containsExactly(
context.getBean("serviceOne", UserService.class),
context.getBean("serviceTwo", UserService.class));
}
@Test
public void orderOnImplementationWithProxy() {
void orderOnImplementationWithProxy() {
this.context = new AnnotationConfigApplicationContext(
UserServiceTwo.class, UserServiceOne.class, UserServiceCollector.class, AsyncConfig.class);
@ -67,8 +68,7 @@ public class Spr12636Tests {
assertThat(AopUtils.isAopProxy(serviceTwo)).isTrue();
UserServiceCollector bean = this.context.getBean(UserServiceCollector.class);
assertThat(bean.userServices).element(0).isSameAs(serviceOne);
assertThat(bean.userServices).element(1).isSameAs(serviceTwo);
assertThat(bean.userServices).containsExactly(serviceOne, serviceTwo);
}
@Configuration

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -204,7 +204,7 @@ class Spr15275Tests {
}
@Bean
public Bar bar() throws Exception {
public Bar bar() {
assertThat(foo().isSingleton()).isTrue();
return new Bar(foo().getObject());
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,7 +25,7 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
* @author Andy Wilkinson
* @author Juergen Hoeller
*/
public class Spr16217Tests {
class Spr16217Tests {
@Test
@Disabled("TODO")
@ -37,7 +37,7 @@ public class Spr16217Tests {
}
@Test
public void baseConfigurationIsIncludedWhenFirstSuperclassReferenceIsSkippedInParseConfigurationPhase() {
void baseConfigurationIsIncludedWhenFirstSuperclassReferenceIsSkippedInParseConfigurationPhase() {
try (AnnotationConfigApplicationContext context =
new AnnotationConfigApplicationContext(ParseConfigurationPhaseImportingConfiguration.class)) {
context.getBean("someBean");
@ -45,17 +45,14 @@ public class Spr16217Tests {
}
@Test
public void baseConfigurationIsIncludedOnceWhenBothConfigurationClassesAreActive() {
void baseConfigurationIsIncludedOnceWhenBothConfigurationClassesAreActive() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.setAllowBeanDefinitionOverriding(false);
context.register(UnconditionalImportingConfiguration.class);
context.refresh();
try {
try (context) {
context.setAllowBeanDefinitionOverriding(false);
context.register(UnconditionalImportingConfiguration.class);
context.refresh();
context.getBean("someBean");
}
finally {
context.close();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -31,19 +31,19 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Chris Beams
*/
public class Spr6602Tests {
class Spr6602Tests {
@Test
public void testXmlBehavior() throws Exception {
void testXmlBehavior() throws Exception {
doAssertions(new ClassPathXmlApplicationContext("Spr6602Tests-context.xml", Spr6602Tests.class));
}
@Test
public void testConfigurationClassBehavior() throws Exception {
void testConfigurationClassBehavior() throws Exception {
doAssertions(new AnnotationConfigApplicationContext(FooConfig.class));
}
private void doAssertions(ApplicationContext ctx) throws Exception {
private void doAssertions(ApplicationContext ctx) {
Foo foo = ctx.getBean(Foo.class);
Bar bar1 = ctx.getBean(Bar.class);
@ -65,7 +65,7 @@ public class Spr6602Tests {
public static class FooConfig {
@Bean
public Foo foo() throws Exception {
public Foo foo() {
return new Foo(barFactory().getObject());
}
@ -93,7 +93,7 @@ public class Spr6602Tests {
public static class BarFactory implements FactoryBean<Bar> {
@Override
public Bar getObject() throws Exception {
public Bar getObject() {
return new Bar();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class Spr8954Tests {
@Test
public void repro() {
void repro() {
AnnotationConfigApplicationContext bf = new AnnotationConfigApplicationContext();
bf.registerBeanDefinition("fooConfig", new RootBeanDefinition(FooConfig.class));
bf.getBeanFactory().addBeanPostProcessor(new PredictingBPP());
@ -64,7 +64,7 @@ public class Spr8954Tests {
}
@Test
public void findsBeansByTypeIfNotInstantiated() {
void findsBeansByTypeIfNotInstantiated() {
AnnotationConfigApplicationContext bf = new AnnotationConfigApplicationContext();
bf.registerBeanDefinition("fooConfig", new RootBeanDefinition(FooConfig.class));
bf.getBeanFactory().addBeanPostProcessor(new PredictingBPP());

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -281,7 +281,7 @@ class AutowiredConfigurationTests {
return new TestBean("");
}
else {
return new TestBean(colour.get().toString() + "-" + colours.get().get(0).toString());
return new TestBean(colour.get() + "-" + colours.get().get(0).toString());
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -43,10 +43,10 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Chris Beams
* @author Juergen Hoeller
*/
public class BeanAnnotationAttributePropagationTests {
class BeanAnnotationAttributePropagationTests {
@Test
public void autowireCandidateMetadataIsPropagated() {
void autowireCandidateMetadataIsPropagated() {
@Configuration class Config {
@Bean(autowireCandidate=false) Object foo() { return null; }
}
@ -55,7 +55,7 @@ public class BeanAnnotationAttributePropagationTests {
}
@Test
public void initMethodMetadataIsPropagated() {
void initMethodMetadataIsPropagated() {
@Configuration class Config {
@Bean(initMethod="start") Object foo() { return null; }
}
@ -64,7 +64,7 @@ public class BeanAnnotationAttributePropagationTests {
}
@Test
public void destroyMethodMetadataIsPropagated() {
void destroyMethodMetadataIsPropagated() {
@Configuration class Config {
@Bean(destroyMethod="destroy") Object foo() { return null; }
}
@ -73,7 +73,7 @@ public class BeanAnnotationAttributePropagationTests {
}
@Test
public void dependsOnMetadataIsPropagated() {
void dependsOnMetadataIsPropagated() {
@Configuration class Config {
@Bean() @DependsOn({"bar", "baz"}) Object foo() { return null; }
}
@ -82,7 +82,7 @@ public class BeanAnnotationAttributePropagationTests {
}
@Test
public void primaryMetadataIsPropagated() {
void primaryMetadataIsPropagated() {
@Configuration class Config {
@Primary @Bean
Object foo() { return null; }
@ -92,7 +92,7 @@ public class BeanAnnotationAttributePropagationTests {
}
@Test
public void primaryMetadataIsFalseByDefault() {
void primaryMetadataIsFalseByDefault() {
@Configuration class Config {
@Bean Object foo() { return null; }
}
@ -101,7 +101,7 @@ public class BeanAnnotationAttributePropagationTests {
}
@Test
public void lazyMetadataIsPropagated() {
void lazyMetadataIsPropagated() {
@Configuration class Config {
@Lazy @Bean
Object foo() { return null; }
@ -111,7 +111,7 @@ public class BeanAnnotationAttributePropagationTests {
}
@Test
public void lazyMetadataIsFalseByDefault() {
void lazyMetadataIsFalseByDefault() {
@Configuration class Config {
@Bean Object foo() { return null; }
}
@ -120,7 +120,7 @@ public class BeanAnnotationAttributePropagationTests {
}
@Test
public void defaultLazyConfigurationPropagatesToIndividualBeans() {
void defaultLazyConfigurationPropagatesToIndividualBeans() {
@Lazy @Configuration class Config {
@Bean Object foo() { return null; }
}
@ -129,7 +129,7 @@ public class BeanAnnotationAttributePropagationTests {
}
@Test
public void eagerBeanOverridesDefaultLazyConfiguration() {
void eagerBeanOverridesDefaultLazyConfiguration() {
@Lazy @Configuration class Config {
@Lazy(false) @Bean Object foo() { return null; }
}
@ -138,7 +138,7 @@ public class BeanAnnotationAttributePropagationTests {
}
@Test
public void eagerConfigurationProducesEagerBeanDefinitions() {
void eagerConfigurationProducesEagerBeanDefinitions() {
@Lazy(false) @Configuration class Config { // will probably never happen, doesn't make much sense
@Bean Object foo() { return null; }
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Juergen Hoeller
* @author Sam Brannen
*/
public class ConfigurationClassWithPlaceholderConfigurerBeanTests {
class ConfigurationClassWithPlaceholderConfigurerBeanTests {
/**
* Test which proves that a non-static property placeholder bean cannot be declared

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class ImportAnnotationDetectionTests {
@Test
public void multipleMetaImportsAreProcessed() {
void multipleMetaImportsAreProcessed() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(MultiMetaImportConfig.class);
ctx.refresh();
@ -53,7 +53,7 @@ public class ImportAnnotationDetectionTests {
}
@Test
public void localAndMetaImportsAreProcessed() {
void localAndMetaImportsAreProcessed() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(MultiMetaImportConfigWithLocalImport.class);
ctx.refresh();
@ -63,7 +63,7 @@ public class ImportAnnotationDetectionTests {
}
@Test
public void localImportIsProcessedLast() {
void localImportIsProcessedLast() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(MultiMetaImportConfigWithLocalImportWithBeanOverride.class);
ctx.refresh();
@ -73,7 +73,7 @@ public class ImportAnnotationDetectionTests {
}
@Test
public void importFromBean() throws Exception {
void importFromBean() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(ImportFromBean.class);
ctx.refresh();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -42,10 +42,10 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Juergen Hoeller
* @author Sam Brannen
*/
public class ImportResourceTests {
class ImportResourceTests {
@Test
public void importXml() {
void importXml() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlConfig.class);
assertThat(ctx.containsBean("javaDeclaredBean")).as("did not contain java-declared bean").isTrue();
assertThat(ctx.containsBean("xmlDeclaredBean")).as("did not contain xml-declared bean").isTrue();
@ -55,14 +55,14 @@ public class ImportResourceTests {
}
@Test
public void importXmlIsInheritedFromSuperclassDeclarations() {
void importXmlIsInheritedFromSuperclassDeclarations() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(FirstLevelSubConfig.class);
assertThat(ctx.containsBean("xmlDeclaredBean")).isTrue();
ctx.close();
}
@Test
public void importXmlIsMergedFromSuperclassDeclarations() {
void importXmlIsMergedFromSuperclassDeclarations() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SecondLevelSubConfig.class);
assertThat(ctx.containsBean("secondLevelXmlDeclaredBean")).as("failed to pick up second-level-declared XML bean").isTrue();
assertThat(ctx.containsBean("xmlDeclaredBean")).as("failed to pick up parent-declared XML bean").isTrue();
@ -70,7 +70,7 @@ public class ImportResourceTests {
}
@Test
public void importXmlWithNamespaceConfig() {
void importXmlWithNamespaceConfig() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlWithAopNamespaceConfig.class);
Object bean = ctx.getBean("proxiedXmlBean");
assertThat(AopUtils.isAopProxy(bean)).isTrue();
@ -78,7 +78,7 @@ public class ImportResourceTests {
}
@Test
public void importXmlWithOtherConfigurationClass() {
void importXmlWithOtherConfigurationClass() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlWithConfigurationClass.class);
assertThat(ctx.containsBean("javaDeclaredBean")).as("did not contain java-declared bean").isTrue();
assertThat(ctx.containsBean("xmlDeclaredBean")).as("did not contain xml-declared bean").isTrue();
@ -88,7 +88,7 @@ public class ImportResourceTests {
}
@Test
public void importWithPlaceholder() throws Exception {
void importWithPlaceholder() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
PropertySource<?> propertySource = new MapPropertySource("test",
Collections.<String, Object> singletonMap("test", "springframework"));
@ -100,7 +100,7 @@ public class ImportResourceTests {
}
@Test
public void importXmlWithAutowiredConfig() {
void importXmlWithAutowiredConfig() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlAutowiredConfig.class);
String name = ctx.getBean("xmlBeanName", String.class);
assertThat(name).isEqualTo("xml.declared");
@ -108,7 +108,7 @@ public class ImportResourceTests {
}
@Test
public void importNonXmlResource() {
void importNonXmlResource() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportNonXmlResourceConfig.class);
assertThat(ctx.containsBean("propertiesDeclaredBean")).isTrue();
ctx.close();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -33,12 +33,12 @@ import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Andy Wilkinson
*/
public class ImportWithConditionTests {
class ImportWithConditionTests {
private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
@Test
public void conditionalThenUnconditional() throws Exception {
void conditionalThenUnconditional() {
this.context.register(ConditionalThenUnconditional.class);
this.context.refresh();
assertThat(this.context.containsBean("beanTwo")).isFalse();
@ -46,7 +46,7 @@ public class ImportWithConditionTests {
}
@Test
public void unconditionalThenConditional() throws Exception {
void unconditionalThenConditional() {
this.context.register(UnconditionalThenConditional.class);
this.context.refresh();
assertThat(this.context.containsBean("beanTwo")).isFalse();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -49,7 +49,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Costin Leau
* @author Chris Beams
*/
public class ScopingTests {
class ScopingTests {
public static String flag = "1";
@ -61,13 +61,13 @@ public class ScopingTests {
@BeforeEach
public void setUp() throws Exception {
void setUp() {
customScope = new CustomScope();
ctx = createContext(ScopedConfigurationClass.class);
}
@AfterEach
public void tearDown() throws Exception {
void tearDown() {
if (ctx != null) {
ctx.close();
}
@ -86,16 +86,16 @@ public class ScopingTests {
@Test
public void testScopeOnClasses() throws Exception {
void testScopeOnClasses() {
genericTestScope("scopedClass");
}
@Test
public void testScopeOnInterfaces() throws Exception {
void testScopeOnInterfaces() {
genericTestScope("scopedInterface");
}
private void genericTestScope(String beanName) throws Exception {
private void genericTestScope(String beanName) {
String message = "scope is ignored";
Object bean1 = ctx.getBean(beanName);
Object bean2 = ctx.getBean(beanName);
@ -130,7 +130,7 @@ public class ScopingTests {
}
@Test
public void testSameScopeOnDifferentBeans() throws Exception {
void testSameScopeOnDifferentBeans() {
Object beanAInScope = ctx.getBean("scopedClass");
Object beanBInScope = ctx.getBean("scopedInterface");
@ -147,7 +147,7 @@ public class ScopingTests {
}
@Test
public void testRawScopes() throws Exception {
void testRawScopes() {
String beanName = "scopedProxyInterface";
// get hidden bean
@ -158,7 +158,7 @@ public class ScopingTests {
}
@Test
public void testScopedProxyConfiguration() throws Exception {
void testScopedProxyConfiguration() {
TestBean singleton = (TestBean) ctx.getBean("singletonWithScopedInterfaceDep");
ITestBean spouse = singleton.getSpouse();
boolean condition = spouse instanceof ScopedObject;
@ -191,7 +191,7 @@ public class ScopingTests {
}
@Test
public void testScopedProxyConfigurationWithClasses() throws Exception {
void testScopedProxyConfigurationWithClasses() {
TestBean singleton = (TestBean) ctx.getBean("singletonWithScopedClassDep");
ITestBean spouse = singleton.getSpouse();
boolean condition = spouse instanceof ScopedObject;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -31,10 +31,10 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Oliver Gierke
* @author Phillip Webb
*/
public class Spr10668Tests {
class Spr10668Tests {
@Test
public void testSelfInjectHierarchy() throws Exception {
void testSelfInjectHierarchy() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ChildConfig.class);
assertThat(context.getBean(MyComponent.class)).isNotNull();
context.close();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Phillip Webb
*/
public class Spr10744Tests {
class Spr10744Tests {
private static int createCount = 0;
@ -41,7 +41,7 @@ public class Spr10744Tests {
@Test
public void testSpr10744() throws Exception {
void testSpr10744() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.getBeanFactory().registerScope("myTestScope", new MyTestScope());
context.register(MyTestConfiguration.class);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -38,7 +38,7 @@ import org.springframework.context.support.GenericApplicationContext;
* @author Juergen Hoeller
* @since 3.0
*/
public class SpringAtInjectTckTests {
class SpringAtInjectTckTests {
@SuppressWarnings("unchecked")
public static Test suite() {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -31,11 +31,11 @@ import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Rob Winch
*/
public class Spr10546Tests {
class Spr10546Tests {
private ConfigurableApplicationContext context;
@AfterEach
public void closeContext() {
void closeContext() {
if (context != null) {
context.close();
}
@ -44,7 +44,7 @@ public class Spr10546Tests {
// These fail prior to fixing SPR-10546
@Test
public void enclosingConfigFirstParentDefinesBean() {
void enclosingConfigFirstParentDefinesBean() {
assertLoadsMyBean(AEnclosingConfig.class,AEnclosingConfig.ChildConfig.class);
}
@ -59,7 +59,7 @@ public class Spr10546Tests {
* classpath scanning implementation being used by the author of this test.
*/
@Test
public void enclosingConfigFirstParentDefinesBeanWithScanning() {
void enclosingConfigFirstParentDefinesBeanWithScanning() {
AnnotationConfigApplicationContext ctx= new AnnotationConfigApplicationContext();
context = ctx;
ctx.scan(AEnclosingConfig.class.getPackage().getName());
@ -68,7 +68,7 @@ public class Spr10546Tests {
}
@Test
public void enclosingConfigFirstParentDefinesBeanWithImportResource() {
void enclosingConfigFirstParentDefinesBeanWithImportResource() {
assertLoadsMyBean(AEnclosingWithImportResourceConfig.class,AEnclosingWithImportResourceConfig.ChildConfig.class);
}
@ -79,7 +79,7 @@ public class Spr10546Tests {
}
@Test
public void enclosingConfigFirstParentDefinesBeanWithComponentScan() {
void enclosingConfigFirstParentDefinesBeanWithComponentScan() {
assertLoadsMyBean(AEnclosingWithComponentScanConfig.class,AEnclosingWithComponentScanConfig.ChildConfig.class);
}
@ -90,7 +90,7 @@ public class Spr10546Tests {
}
@Test
public void enclosingConfigFirstParentWithParentDefinesBean() {
void enclosingConfigFirstParentWithParentDefinesBean() {
assertLoadsMyBean(AEnclosingWithGrandparentConfig.class,AEnclosingWithGrandparentConfig.ChildConfig.class);
}
@ -101,7 +101,7 @@ public class Spr10546Tests {
}
@Test
public void importChildConfigThenChildConfig() {
void importChildConfigThenChildConfig() {
assertLoadsMyBean(ImportChildConfig.class,ChildConfig.class);
}
@ -116,7 +116,7 @@ public class Spr10546Tests {
// These worked prior, but validating they continue to work
@Test
public void enclosingConfigFirstParentDefinesBeanWithImport() {
void enclosingConfigFirstParentDefinesBeanWithImport() {
assertLoadsMyBean(AEnclosingWithImportConfig.class,AEnclosingWithImportConfig.ChildConfig.class);
}
@ -127,17 +127,17 @@ public class Spr10546Tests {
}
@Test
public void childConfigFirst() {
void childConfigFirst() {
assertLoadsMyBean(AEnclosingConfig.ChildConfig.class, AEnclosingConfig.class);
}
@Test
public void enclosingConfigOnly() {
void enclosingConfigOnly() {
assertLoadsMyBean(AEnclosingConfig.class);
}
@Test
public void childConfigOnly() {
void childConfigOnly() {
assertLoadsMyBean(AEnclosingConfig.ChildConfig.class);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -35,10 +35,10 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
*
* @author Phillip Webb
*/
public class Spr12233Tests {
class Spr12233Tests {
@Test
public void spr12233() throws Exception {
void spr12233() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(PropertySourcesPlaceholderConfigurer.class);
ctx.register(ImportConfiguration.class);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -87,7 +87,7 @@ class AnnotationDrivenEventListenerTests {
@AfterEach
public void closeContext() {
void closeContext() {
if (this.context != null) {
this.context.close();
}
@ -196,8 +196,7 @@ class AnnotationDrivenEventListenerTests {
failingContext.register(BasicConfiguration.class,
InvalidMethodSignatureEventListener.class);
assertThatExceptionOfType(BeanInitializationException.class).isThrownBy(() ->
failingContext.refresh())
assertThatExceptionOfType(BeanInitializationException.class).isThrownBy(failingContext::refresh)
.withMessageContaining(InvalidMethodSignatureEventListener.class.getName())
.withMessageContaining("cannotBeCalled");
}
@ -680,14 +679,14 @@ class AnnotationDrivenEventListenerTests {
List<Class<?>> allClasses = new ArrayList<>();
allClasses.add(BasicConfiguration.class);
allClasses.addAll(Arrays.asList(classes));
doLoad(allClasses.toArray(new Class<?>[allClasses.size()]));
doLoad(allClasses.toArray(new Class<?>[0]));
}
private void loadAsync(Class<?>... classes) {
List<Class<?>> allClasses = new ArrayList<>();
allClasses.add(AsyncConfiguration.class);
allClasses.addAll(Arrays.asList(classes));
doLoad(allClasses.toArray(new Class<?>[allClasses.size()]));
doLoad(allClasses.toArray(new Class<?>[0]));
}
private void doLoad(Class<?>... classes) {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -78,10 +78,10 @@ import static org.springframework.context.support.AbstractApplicationContext.APP
* @author Stephane Nicoll
* @author Juergen Hoeller
*/
public class ApplicationContextEventTests extends AbstractApplicationEventListenerTests {
class ApplicationContextEventTests extends AbstractApplicationEventListenerTests {
@Test
public void multicastSimpleEvent() {
void multicastSimpleEvent() {
multicastEvent(true, ApplicationListener.class,
new ContextRefreshedEvent(new StaticApplicationContext()), null);
multicastEvent(true, ApplicationListener.class,
@ -89,40 +89,40 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void multicastGenericEvent() {
void multicastGenericEvent() {
multicastEvent(true, StringEventListener.class, createGenericTestEvent("test"),
ResolvableType.forClassWithGenerics(GenericTestEvent.class, String.class));
}
@Test
public void multicastGenericEventWrongType() {
void multicastGenericEventWrongType() {
multicastEvent(false, StringEventListener.class, createGenericTestEvent(123L),
ResolvableType.forClassWithGenerics(GenericTestEvent.class, Long.class));
}
@Test
public void multicastGenericEventWildcardSubType() {
void multicastGenericEventWildcardSubType() {
multicastEvent(false, StringEventListener.class, createGenericTestEvent("test"),
getGenericApplicationEventType("wildcardEvent"));
}
@Test
public void multicastConcreteTypeGenericListener() {
void multicastConcreteTypeGenericListener() {
multicastEvent(true, StringEventListener.class, new StringEvent(this, "test"), null);
}
@Test
public void multicastConcreteWrongTypeGenericListener() {
void multicastConcreteWrongTypeGenericListener() {
multicastEvent(false, StringEventListener.class, new LongEvent(this, 123L), null);
}
@Test
public void multicastSmartGenericTypeGenericListener() {
void multicastSmartGenericTypeGenericListener() {
multicastEvent(true, StringEventListener.class, new SmartGenericTestEvent<>(this, "test"), null);
}
@Test
public void multicastSmartGenericWrongTypeGenericListener() {
void multicastSmartGenericWrongTypeGenericListener() {
multicastEvent(false, StringEventListener.class, new SmartGenericTestEvent<>(this, 123L), null);
}
@ -144,7 +144,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void simpleApplicationEventMulticasterWithTaskExecutor() {
void simpleApplicationEventMulticasterWithTaskExecutor() {
@SuppressWarnings("unchecked")
ApplicationListener<ApplicationEvent> listener = mock();
willReturn(true).given(listener).supportsAsyncExecution();
@ -165,7 +165,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void simpleApplicationEventMulticasterWithTaskExecutorAndNonAsyncListener() {
void simpleApplicationEventMulticasterWithTaskExecutorAndNonAsyncListener() {
@SuppressWarnings("unchecked")
ApplicationListener<ApplicationEvent> listener = mock();
willReturn(false).given(listener).supportsAsyncExecution();
@ -186,7 +186,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void simpleApplicationEventMulticasterWithException() {
void simpleApplicationEventMulticasterWithException() {
@SuppressWarnings("unchecked")
ApplicationListener<ApplicationEvent> listener = mock();
ApplicationEvent evt = new ContextClosedEvent(new StaticApplicationContext());
@ -202,7 +202,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void simpleApplicationEventMulticasterWithErrorHandler() {
void simpleApplicationEventMulticasterWithErrorHandler() {
@SuppressWarnings("unchecked")
ApplicationListener<ApplicationEvent> listener = mock();
ApplicationEvent evt = new ContextClosedEvent(new StaticApplicationContext());
@ -216,7 +216,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void orderedListeners() {
void orderedListeners() {
MyOrderedListener1 listener1 = new MyOrderedListener1();
MyOrderedListener2 listener2 = new MyOrderedListener2(listener1);
@ -230,7 +230,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void orderedListenersWithAnnotation() {
void orderedListenersWithAnnotation() {
MyOrderedListener3 listener1 = new MyOrderedListener3();
MyOrderedListener4 listener2 = new MyOrderedListener4(listener1);
@ -289,7 +289,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
* were added to the list of application listener beans twice (both proxy and unwrapped target).
*/
@Test
public void eventForSelfInjectedProxiedListenerFiredOnlyOnce() {
void eventForSelfInjectedProxiedListenerFiredOnlyOnce() {
AbstractApplicationContext context = new AnnotationConfigApplicationContext(
MyAspect.class, MyEventListener.class, MyEventPublisher.class);
context.getBean(MyEventPublisher.class).publishMyEvent("hello");
@ -298,7 +298,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void testEventPublicationInterceptor() throws Throwable {
void testEventPublicationInterceptor() throws Throwable {
MethodInvocation invocation = mock();
ApplicationContext ctx = mock();
@ -314,7 +314,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void listenersInApplicationContext() {
void listenersInApplicationContext() {
StaticApplicationContext context = new StaticApplicationContext();
context.registerBeanDefinition("listener1", new RootBeanDefinition(MyOrderedListener1.class));
RootBeanDefinition listener2 = new RootBeanDefinition(MyOrderedListener2.class);
@ -351,7 +351,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void listenersInApplicationContextWithPayloadEvents() {
void listenersInApplicationContextWithPayloadEvents() {
StaticApplicationContext context = new StaticApplicationContext();
context.registerBeanDefinition("listener", new RootBeanDefinition(MyPayloadListener.class));
context.refresh();
@ -370,7 +370,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void listenersInApplicationContextWithNestedChild() {
void listenersInApplicationContextWithNestedChild() {
StaticApplicationContext context = new StaticApplicationContext();
RootBeanDefinition nestedChild = new RootBeanDefinition(StaticApplicationContext.class);
nestedChild.getPropertyValues().add("parent", context);
@ -394,7 +394,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void nonSingletonListenerInApplicationContext() {
void nonSingletonListenerInApplicationContext() {
StaticApplicationContext context = new StaticApplicationContext();
RootBeanDefinition listener = new RootBeanDefinition(MyNonSingletonListener.class);
listener.setScope(BeanDefinition.SCOPE_PROTOTYPE);
@ -426,7 +426,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void listenerAndBroadcasterWithCircularReference() {
void listenerAndBroadcasterWithCircularReference() {
StaticApplicationContext context = new StaticApplicationContext();
context.registerBeanDefinition("broadcaster", new RootBeanDefinition(BeanThatBroadcasts.class));
RootBeanDefinition listenerDef = new RootBeanDefinition(BeanThatListens.class);
@ -442,7 +442,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void innerBeanAsListener() {
void innerBeanAsListener() {
StaticApplicationContext context = new StaticApplicationContext();
RootBeanDefinition listenerDef = new RootBeanDefinition(TestBean.class);
listenerDef.getPropertyValues().add("friends", new RootBeanDefinition(BeanThatListens.class));
@ -458,7 +458,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void anonymousClassAsListener() {
void anonymousClassAsListener() {
final Set<MyEvent> seenEvents = new HashSet<>();
StaticApplicationContext context = new StaticApplicationContext();
context.addApplicationListener((MyEvent event) -> seenEvents.add(event));
@ -475,7 +475,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void lambdaAsListener() {
void lambdaAsListener() {
final Set<MyEvent> seenEvents = new HashSet<>();
StaticApplicationContext context = new StaticApplicationContext();
ApplicationListener<MyEvent> listener = seenEvents::add;
@ -493,7 +493,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void lambdaAsListenerWithErrorHandler() {
void lambdaAsListenerWithErrorHandler() {
final Set<MyEvent> seenEvents = new HashSet<>();
StaticApplicationContext context = new StaticApplicationContext();
SimpleApplicationEventMulticaster multicaster = new SimpleApplicationEventMulticaster();
@ -514,7 +514,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void lambdaAsListenerWithJava8StyleClassCastMessage() {
void lambdaAsListenerWithJava8StyleClassCastMessage() {
StaticApplicationContext context = new StaticApplicationContext();
ApplicationListener<ApplicationEvent> listener =
event -> { throw new ClassCastException(event.getClass().getName()); };
@ -526,7 +526,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void lambdaAsListenerWithJava9StyleClassCastMessage() {
void lambdaAsListenerWithJava9StyleClassCastMessage() {
StaticApplicationContext context = new StaticApplicationContext();
ApplicationListener<ApplicationEvent> listener =
event -> { throw new ClassCastException("spring.context/" + event.getClass().getName()); };
@ -552,7 +552,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void beanPostProcessorPublishesEvents() {
void beanPostProcessorPublishesEvents() {
GenericApplicationContext context = new GenericApplicationContext();
context.registerBeanDefinition("listener", new RootBeanDefinition(BeanThatListens.class));
context.registerBeanDefinition("messageSource", new RootBeanDefinition(StaticMessageSource.class));
@ -567,7 +567,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void initMethodPublishesEvent() {
void initMethodPublishesEvent() {
GenericApplicationContext context = new GenericApplicationContext();
context.registerBeanDefinition("listener", new RootBeanDefinition(BeanThatListens.class));
context.registerBeanDefinition("messageSource", new RootBeanDefinition(StaticMessageSource.class));
@ -582,7 +582,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Test
public void initMethodPublishesAsyncEvent() {
void initMethodPublishesAsyncEvent() {
GenericApplicationContext context = new GenericApplicationContext();
context.registerBeanDefinition("listener", new RootBeanDefinition(BeanThatListens.class));
context.registerBeanDefinition("messageSource", new RootBeanDefinition(StaticMessageSource.class));
@ -743,7 +743,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
}
@Override
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
this.publisher.publishEvent(new MyEvent(this));
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -51,7 +51,7 @@ import static org.mockito.Mockito.verify;
* @author Juergen Hoeller
* @author Simon Baslé
*/
public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEventListenerTests {
class ApplicationListenerMethodAdapterTests extends AbstractApplicationEventListenerTests {
private final SampleEvents sampleEvents = spy(new SampleEvents());
@ -59,89 +59,89 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
@Test
public void rawListener() {
void rawListener() {
Method method = ReflectionUtils.findMethod(SampleEvents.class, "handleRaw", ApplicationEvent.class);
supportsEventType(true, method, ResolvableType.forClass(ApplicationEvent.class));
}
@Test
public void rawListenerWithGenericEvent() {
void rawListenerWithGenericEvent() {
Method method = ReflectionUtils.findMethod(SampleEvents.class, "handleRaw", ApplicationEvent.class);
supportsEventType(true, method, ResolvableType.forClassWithGenerics(GenericTestEvent.class, String.class));
}
@Test
public void genericListener() {
void genericListener() {
Method method = ReflectionUtils.findMethod(
SampleEvents.class, "handleGenericString", GenericTestEvent.class);
supportsEventType(true, method, ResolvableType.forClassWithGenerics(GenericTestEvent.class, String.class));
}
@Test
public void genericListenerWrongParameterizedType() {
void genericListenerWrongParameterizedType() {
Method method = ReflectionUtils.findMethod(
SampleEvents.class, "handleGenericString", GenericTestEvent.class);
supportsEventType(false, method, ResolvableType.forClassWithGenerics(GenericTestEvent.class, Long.class));
}
@Test
public void genericListenerWithUnresolvedGenerics() {
void genericListenerWithUnresolvedGenerics() {
Method method = ReflectionUtils.findMethod(
SampleEvents.class, "handleGenericString", GenericTestEvent.class);
supportsEventType(true, method, ResolvableType.forClass(GenericTestEvent.class));
}
@Test
public void listenerWithPayloadAndGenericInformation() {
void listenerWithPayloadAndGenericInformation() {
Method method = ReflectionUtils.findMethod(SampleEvents.class, "handleString", String.class);
supportsEventType(true, method, createPayloadEventType(String.class));
}
@Test
public void listenerWithInvalidPayloadAndGenericInformation() {
void listenerWithInvalidPayloadAndGenericInformation() {
Method method = ReflectionUtils.findMethod(SampleEvents.class, "handleString", String.class);
supportsEventType(false, method, createPayloadEventType(Integer.class));
}
@Test
public void listenerWithPayloadTypeErasure() { // Always accept such event when the type is unknown
void listenerWithPayloadTypeErasure() { // Always accept such event when the type is unknown
Method method = ReflectionUtils.findMethod(SampleEvents.class, "handleString", String.class);
supportsEventType(true, method, ResolvableType.forClass(PayloadApplicationEvent.class));
}
@Test
public void listenerWithSubTypeSeveralGenerics() {
void listenerWithSubTypeSeveralGenerics() {
Method method = ReflectionUtils.findMethod(SampleEvents.class, "handleString", String.class);
supportsEventType(true, method, ResolvableType.forClass(PayloadTestEvent.class));
}
@Test
public void listenerWithSubTypeSeveralGenericsResolved() {
void listenerWithSubTypeSeveralGenericsResolved() {
Method method = ReflectionUtils.findMethod(SampleEvents.class, "handleString", String.class);
supportsEventType(true, method, ResolvableType.forClass(PayloadStringTestEvent.class));
}
@Test
public void listenerWithAnnotationValue() {
void listenerWithAnnotationValue() {
Method method = ReflectionUtils.findMethod(SampleEvents.class, "handleStringAnnotationValue");
supportsEventType(true, method, createPayloadEventType(String.class));
}
@Test
public void listenerWithAnnotationClasses() {
void listenerWithAnnotationClasses() {
Method method = ReflectionUtils.findMethod(SampleEvents.class, "handleStringAnnotationClasses");
supportsEventType(true, method, createPayloadEventType(String.class));
}
@Test
public void listenerWithAnnotationValueAndParameter() {
void listenerWithAnnotationValueAndParameter() {
Method method = ReflectionUtils.findMethod(
SampleEvents.class, "handleStringAnnotationValueAndParameter", String.class);
supportsEventType(true, method, createPayloadEventType(String.class));
}
@Test
public void listenerWithSeveralTypes() {
void listenerWithSeveralTypes() {
Method method = ReflectionUtils.findMethod(SampleEvents.class, "handleStringOrInteger");
supportsEventType(true, method, createPayloadEventType(String.class));
supportsEventType(true, method, createPayloadEventType(Integer.class));
@ -149,27 +149,27 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
}
@Test
public void listenerWithTooManyParameters() {
void listenerWithTooManyParameters() {
Method method = ReflectionUtils.findMethod(
SampleEvents.class, "tooManyParameters", String.class, String.class);
assertThatIllegalStateException().isThrownBy(() -> createTestInstance(method));
}
@Test
public void listenerWithNoParameter() {
void listenerWithNoParameter() {
Method method = ReflectionUtils.findMethod(SampleEvents.class, "noParameter");
assertThatIllegalStateException().isThrownBy(() -> createTestInstance(method));
}
@Test
public void listenerWithMoreThanOneParameter() {
void listenerWithMoreThanOneParameter() {
Method method = ReflectionUtils.findMethod(
SampleEvents.class, "moreThanOneParameter", String.class, Integer.class);
assertThatIllegalStateException().isThrownBy(() -> createTestInstance(method));
}
@Test
public void defaultOrder() {
void defaultOrder() {
Method method = ReflectionUtils.findMethod(
SampleEvents.class, "handleGenericString", GenericTestEvent.class);
ApplicationListenerMethodAdapter adapter = createTestInstance(method);
@ -177,7 +177,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
}
@Test
public void specifiedOrder() {
void specifiedOrder() {
Method method = ReflectionUtils.findMethod(
SampleEvents.class, "handleRaw", ApplicationEvent.class);
ApplicationListenerMethodAdapter adapter = createTestInstance(method);
@ -185,7 +185,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
}
@Test
public void invokeListener() {
void invokeListener() {
Method method = ReflectionUtils.findMethod(
SampleEvents.class, "handleGenericString", GenericTestEvent.class);
GenericTestEvent<String> event = createGenericTestEvent("test");
@ -194,7 +194,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
}
@Test
public void invokeListenerWithGenericEvent() {
void invokeListenerWithGenericEvent() {
Method method = ReflectionUtils.findMethod(
SampleEvents.class, "handleGenericString", GenericTestEvent.class);
GenericTestEvent<String> event = new SmartGenericTestEvent<>(this, "test");
@ -203,7 +203,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
}
@Test
public void invokeListenerWithGenericPayload() {
void invokeListenerWithGenericPayload() {
Method method = ReflectionUtils.findMethod(
SampleEvents.class, "handleGenericStringPayload", EntityWrapper.class);
EntityWrapper<String> payload = new EntityWrapper<>("test");
@ -212,7 +212,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
}
@Test
public void invokeListenerWithWrongGenericPayload() {
void invokeListenerWithWrongGenericPayload() {
Method method = ReflectionUtils.findMethod
(SampleEvents.class, "handleGenericStringPayload", EntityWrapper.class);
EntityWrapper<Integer> payload = new EntityWrapper<>(123);
@ -221,7 +221,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
}
@Test
public void invokeListenerWithAnyGenericPayload() {
void invokeListenerWithAnyGenericPayload() {
Method method = ReflectionUtils.findMethod(
SampleEvents.class, "handleGenericAnyPayload", EntityWrapper.class);
EntityWrapper<String> payload = new EntityWrapper<>("test");
@ -230,7 +230,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
}
@Test
public void invokeListenerRuntimeException() {
void invokeListenerRuntimeException() {
Method method = ReflectionUtils.findMethod(
SampleEvents.class, "generateRuntimeException", GenericTestEvent.class);
GenericTestEvent<String> event = createGenericTestEvent("fail");
@ -242,7 +242,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
}
@Test
public void invokeListenerCheckedException() {
void invokeListenerCheckedException() {
Method method = ReflectionUtils.findMethod(
SampleEvents.class, "generateCheckedException", GenericTestEvent.class);
GenericTestEvent<String> event = createGenericTestEvent("fail");
@ -253,7 +253,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
}
@Test
public void invokeListenerInvalidProxy() {
void invokeListenerInvalidProxy() {
Object target = new InvalidProxyTestBean();
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(target);
@ -270,7 +270,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
}
@Test
public void invokeListenerWithPayload() {
void invokeListenerWithPayload() {
Method method = ReflectionUtils.findMethod(SampleEvents.class, "handleString", String.class);
PayloadApplicationEvent<String> event = new PayloadApplicationEvent<>(this, "test");
invokeListener(method, event);
@ -278,7 +278,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
}
@Test
public void invokeListenerWithPayloadWrongType() {
void invokeListenerWithPayloadWrongType() {
Method method = ReflectionUtils.findMethod(SampleEvents.class, "handleString", String.class);
PayloadApplicationEvent<Long> event = new PayloadApplicationEvent<>(this, 123L);
invokeListener(method, event);
@ -286,7 +286,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
}
@Test
public void invokeListenerWithAnnotationValue() {
void invokeListenerWithAnnotationValue() {
Method method = ReflectionUtils.findMethod(SampleEvents.class, "handleStringAnnotationClasses");
PayloadApplicationEvent<String> event = new PayloadApplicationEvent<>(this, "test");
invokeListener(method, event);
@ -294,7 +294,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
}
@Test
public void invokeListenerWithAnnotationValueAndParameter() {
void invokeListenerWithAnnotationValueAndParameter() {
Method method = ReflectionUtils.findMethod(
SampleEvents.class, "handleStringAnnotationValueAndParameter", String.class);
PayloadApplicationEvent<String> event = new PayloadApplicationEvent<>(this, "test");
@ -303,7 +303,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
}
@Test
public void invokeListenerWithSeveralTypes() {
void invokeListenerWithSeveralTypes() {
Method method = ReflectionUtils.findMethod(SampleEvents.class, "handleStringOrInteger");
PayloadApplicationEvent<String> event = new PayloadApplicationEvent<>(this, "test");
invokeListener(method, event);
@ -317,7 +317,7 @@ public class ApplicationListenerMethodAdapterTests extends AbstractApplicationEv
}
@Test
public void beanInstanceRetrievedAtEveryInvocation() {
void beanInstanceRetrievedAtEveryInvocation() {
Method method = ReflectionUtils.findMethod(
SampleEvents.class, "handleGenericString", GenericTestEvent.class);
given(this.context.getBean("testBean")).willReturn(this.sampleEvents);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -32,10 +32,10 @@ import static org.mockito.Mockito.verify;
/**
* @author Stephane Nicoll
*/
public class GenericApplicationListenerAdapterTests extends AbstractApplicationEventListenerTests {
class GenericApplicationListenerAdapterTests extends AbstractApplicationEventListenerTests {
@Test
public void supportsEventTypeWithSmartApplicationListener() {
void supportsEventTypeWithSmartApplicationListener() {
SmartApplicationListener smartListener = mock();
GenericApplicationListenerAdapter listener = new GenericApplicationListenerAdapter(smartListener);
ResolvableType type = ResolvableType.forClass(ApplicationEvent.class);
@ -44,7 +44,7 @@ public class GenericApplicationListenerAdapterTests extends AbstractApplicationE
}
@Test
public void supportsSourceTypeWithSmartApplicationListener() {
void supportsSourceTypeWithSmartApplicationListener() {
SmartApplicationListener smartListener = mock();
GenericApplicationListenerAdapter listener = new GenericApplicationListenerAdapter(smartListener);
listener.supportsSourceType(Object.class);
@ -52,7 +52,7 @@ public class GenericApplicationListenerAdapterTests extends AbstractApplicationE
}
@Test
public void genericListenerStrictType() {
void genericListenerStrictType() {
supportsEventType(true, StringEventListener.class, ResolvableType.forClassWithGenerics(GenericTestEvent.class, String.class));
}
@ -84,44 +84,44 @@ public class GenericApplicationListenerAdapterTests extends AbstractApplicationE
}
@Test
public void genericListenerStrictTypeNotMatching() {
void genericListenerStrictTypeNotMatching() {
supportsEventType(false, StringEventListener.class, ResolvableType.forClassWithGenerics(GenericTestEvent.class, Long.class));
}
@Test
public void genericListenerStrictTypeEventSubTypeNotMatching() {
void genericListenerStrictTypeEventSubTypeNotMatching() {
LongEvent stringEvent = new LongEvent(this, 123L);
ResolvableType eventType = ResolvableType.forType(stringEvent.getClass());
supportsEventType(false, StringEventListener.class, eventType);
}
@Test
public void genericListenerStrictTypeNotMatchTypeErasure() {
void genericListenerStrictTypeNotMatchTypeErasure() {
GenericTestEvent<Long> longEvent = createGenericTestEvent(123L);
ResolvableType eventType = ResolvableType.forType(longEvent.getClass());
supportsEventType(false, StringEventListener.class, eventType);
}
@Test
public void genericListenerStrictTypeSubClass() {
void genericListenerStrictTypeSubClass() {
supportsEventType(false, ObjectEventListener.class,
ResolvableType.forClassWithGenerics(GenericTestEvent.class, Long.class));
}
@Test
public void genericListenerUpperBoundType() {
void genericListenerUpperBoundType() {
supportsEventType(true, UpperBoundEventListener.class,
ResolvableType.forClassWithGenerics(GenericTestEvent.class, IllegalStateException.class));
}
@Test
public void genericListenerUpperBoundTypeNotMatching() {
void genericListenerUpperBoundTypeNotMatching() {
supportsEventType(false, UpperBoundEventListener.class,
ResolvableType.forClassWithGenerics(GenericTestEvent.class, IOException.class));
}
@Test
public void genericListenerWildcardType() {
void genericListenerWildcardType() {
supportsEventType(true, GenericEventListener.class,
ResolvableType.forClassWithGenerics(GenericTestEvent.class, String.class));
}
@ -134,7 +134,7 @@ public class GenericApplicationListenerAdapterTests extends AbstractApplicationE
}
@Test
public void genericListenerRawType() {
void genericListenerRawType() {
supportsEventType(true, RawApplicationListener.class,
ResolvableType.forClassWithGenerics(GenericTestEvent.class, String.class));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -30,10 +30,10 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Mark Fisher
* @author Juergen Hoeller
*/
public class LifecycleEventTests {
class LifecycleEventTests {
@Test
public void contextStartedEvent() {
void contextStartedEvent() {
StaticApplicationContext context = new StaticApplicationContext();
context.registerSingleton("lifecycle", LifecycleTestBean.class);
context.registerSingleton("listener", LifecycleListener.class);
@ -49,7 +49,7 @@ public class LifecycleEventTests {
}
@Test
public void contextStoppedEvent() {
void contextStoppedEvent() {
StaticApplicationContext context = new StaticApplicationContext();
context.registerSingleton("lifecycle", LifecycleTestBean.class);
context.registerSingleton("listener", LifecycleListener.class);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -165,7 +165,7 @@ class PayloadApplicationEventTests {
void testProgrammaticEventListener() {
List<Auditable> events = new ArrayList<>();
ApplicationListener<AuditablePayloadEvent<String>> listener = events::add;
ApplicationListener<AuditablePayloadEvent<Integer>> mismatch = (event -> event.getPayload());
ApplicationListener<AuditablePayloadEvent<Integer>> mismatch = (PayloadApplicationEvent::getPayload);
ConfigurableApplicationContext ac = new GenericApplicationContext();
ac.addApplicationListener(listener);
@ -183,7 +183,7 @@ class PayloadApplicationEventTests {
void testProgrammaticEventListenerOnParentContext() {
List<Auditable> events = new ArrayList<>();
ApplicationListener<AuditablePayloadEvent<String>> listener = events::add;
ApplicationListener<AuditablePayloadEvent<Integer>> mismatch = (event -> event.getPayload());
ApplicationListener<AuditablePayloadEvent<Integer>> mismatch = (PayloadApplicationEvent::getPayload);
ConfigurableApplicationContext parent = new GenericApplicationContext();
parent.addApplicationListener(listener);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -35,12 +35,12 @@ import static org.mockito.Mockito.verify;
/**
* @author Stephane Nicoll
*/
public class CachedExpressionEvaluatorTests {
class CachedExpressionEvaluatorTests {
private final TestExpressionEvaluator expressionEvaluator = new TestExpressionEvaluator();
@Test
public void parseNewExpression() {
void parseNewExpression() {
Method method = ReflectionUtils.findMethod(getClass(), "toString");
Expression expression = expressionEvaluator.getTestExpression("true", method, getClass());
hasParsedExpression("true");
@ -49,7 +49,7 @@ public class CachedExpressionEvaluatorTests {
}
@Test
public void cacheExpression() {
void cacheExpression() {
Method method = ReflectionUtils.findMethod(getClass(), "toString");
expressionEvaluator.getTestExpression("true", method, getClass());
@ -60,7 +60,7 @@ public class CachedExpressionEvaluatorTests {
}
@Test
public void cacheExpressionBasedOnConcreteType() {
void cacheExpressionBasedOnConcreteType() {
Method method = ReflectionUtils.findMethod(getClass(), "toString");
expressionEvaluator.getTestExpression("true", method, getClass());
expressionEvaluator.getTestExpression("true", method, Object.class);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -34,10 +34,10 @@ import static org.springframework.beans.factory.support.BeanDefinitionBuilder.ge
*
* @author Chris Beams
*/
public class EnvironmentAccessorIntegrationTests {
class EnvironmentAccessorIntegrationTests {
@Test
public void braceAccess() {
void braceAccess() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.registerBeanDefinition("testBean",
genericBeanDefinition(TestBean.class)

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,7 +23,6 @@ import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.expression.FactoryBeanAccessTests.SimpleBeanResolver.CarFactoryBean;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.expression.AccessException;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
import org.springframework.expression.spel.standard.SpelExpressionParser;
@ -37,10 +36,10 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
*
* @author Andy Clement
*/
public class FactoryBeanAccessTests {
class FactoryBeanAccessTests {
@Test
public void factoryBeanAccess() { // SPR9511
void factoryBeanAccess() { // SPR9511
StandardEvaluationContext context = new StandardEvaluationContext();
context.setBeanResolver(new SimpleBeanResolver());
Expression expr = new SpelExpressionParser().parseRaw("@car.colour");
@ -110,8 +109,7 @@ public class FactoryBeanAccessTests {
}
@Override
public Object resolve(EvaluationContext context, String beanName)
throws AccessException {
public Object resolve(EvaluationContext context, String beanName) {
return ac.getBean(beanName);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -33,10 +33,10 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Andy Clement
*/
public class MapAccessorTests {
class MapAccessorTests {
@Test
public void mapAccessorCompilable() {
void mapAccessorCompilable() {
Map<String, Object> testMap = getSimpleTestMap();
StandardEvaluationContext sec = new StandardEvaluationContext();
sec.addPropertyAccessor(new MapAccessor());

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