Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3f3e419

Browse files
committed
Migrate rest of test suite from JUnit 4 to JUnit Jupiter
This commit migrates the rest of Spring's test suite to JUnit Jupiter, except spring-test which will be migrated in a separate commit. See spring-projectsgh-23451
1 parent 3df85c7 commit 3f3e419

File tree

1,487 files changed

+5457
-4811
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,487 files changed

+5457
-4811
lines changed

spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverAnnotationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package org.springframework.aop.aspectj;
1818

1919
import org.aspectj.lang.ProceedingJoinPoint;
20-
import org.junit.Test;
20+
import org.junit.jupiter.api.Test;
2121

2222
/**
2323
* Additional parameter name discover tests that need Java 5.

spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import java.lang.reflect.Method;
2020

2121
import org.aspectj.lang.JoinPoint;
22-
import org.junit.Test;
22+
import org.junit.jupiter.api.Test;
2323

2424
import org.springframework.aop.aspectj.AspectJAdviceParameterNameDiscoverer.AmbiguousBindingException;
2525

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
import org.aspectj.weaver.tools.PointcutExpression;
2424
import org.aspectj.weaver.tools.PointcutPrimitive;
2525
import org.aspectj.weaver.tools.UnsupportedPointcutPrimitiveException;
26-
import org.junit.Before;
27-
import org.junit.Test;
26+
import org.junit.jupiter.api.BeforeEach;
27+
import org.junit.jupiter.api.Test;
2828

2929
import org.springframework.aop.ClassFilter;
3030
import org.springframework.aop.MethodMatcher;
@@ -57,7 +57,7 @@ public class AspectJExpressionPointcutTests {
5757
private Method setSomeNumber;
5858

5959

60-
@Before
60+
@BeforeEach
6161
public void setUp() throws NoSuchMethodException {
6262
getAge = TestBean.class.getMethod("getAge");
6363
setAge = TestBean.class.getMethod("setAge", int.class);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.aop.aspectj;
1818

19-
import org.junit.Test;
19+
import org.junit.jupiter.api.Test;
2020

2121
import org.springframework.tests.sample.beans.TestBean;
2222

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import org.aspectj.lang.reflect.MethodSignature;
2727
import org.aspectj.lang.reflect.SourceLocation;
2828
import org.aspectj.runtime.reflect.Factory;
29-
import org.junit.Test;
29+
import org.junit.jupiter.api.Test;
3030

3131
import org.springframework.aop.MethodBeforeAdvice;
3232
import org.springframework.aop.framework.AopContext;

spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJAdviceParameterNameDiscovererTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.aop.aspectj;
1818

19-
import org.junit.Test;
19+
import org.junit.jupiter.api.Test;
2020

2121
import org.springframework.aop.aspectj.AspectJAdviceParameterNameDiscoverer.AmbiguousBindingException;
2222

spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import java.util.List;
2222
import java.util.Map;
2323

24-
import org.junit.Before;
25-
import org.junit.Test;
24+
import org.junit.jupiter.api.BeforeEach;
25+
import org.junit.jupiter.api.Test;
2626
import test.annotation.EmptySpringAnnotation;
2727
import test.annotation.transaction.Tx;
2828

@@ -44,7 +44,7 @@ public class TigerAspectJExpressionPointcutTests {
4444
private final Map<String, Method> methodsOnHasGeneric = new HashMap<>();
4545

4646

47-
@Before
47+
@BeforeEach
4848
public void setup() throws NoSuchMethodException {
4949
getAge = TestBean.class.getMethod("getAge");
5050
// Assumes no overloading

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import java.lang.annotation.Target;
2525
import java.lang.reflect.Method;
2626

27-
import org.junit.Test;
27+
import org.junit.jupiter.api.Test;
2828

2929
import org.springframework.aop.Advisor;
3030
import org.springframework.aop.MethodBeforeAdvice;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.aop.aspectj;
1818

19-
import org.junit.Test;
19+
import org.junit.jupiter.api.Test;
2020

2121
import org.springframework.beans.factory.BeanFactory;
2222
import org.springframework.beans.factory.support.DefaultListableBeanFactory;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
import org.aspectj.lang.annotation.DeclarePrecedence;
3939
import org.aspectj.lang.annotation.Pointcut;
4040
import org.aspectj.lang.reflect.MethodSignature;
41-
import org.junit.Ignore;
42-
import org.junit.Test;
41+
import org.junit.jupiter.api.Disabled;
42+
import org.junit.jupiter.api.Test;
4343
import test.aop.DefaultLockable;
4444
import test.aop.Lockable;
4545
import test.aop.PerTargetAspect;
@@ -414,7 +414,7 @@ public void testIntroductionBasedOnAnnotationMatch_SPR5307() {
414414

415415
// TODO: Why does this test fail? It hasn't been run before, so it maybe never actually passed...
416416
@Test
417-
@Ignore
417+
@Disabled
418418
public void testIntroductionWithArgumentBinding() {
419419
TestBean target = new TestBean();
420420

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.aspectj.lang.annotation.Around;
2525
import org.aspectj.lang.annotation.Aspect;
2626
import org.aspectj.lang.annotation.Pointcut;
27-
import org.junit.Test;
27+
import org.junit.jupiter.api.Test;
2828

2929
import org.springframework.aop.aspectj.AspectJAdviceParameterNameDiscoverer;
3030
import org.springframework.tests.sample.beans.ITestBean;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.aop.aspectj.annotation;
1818

19-
import org.junit.Test;
19+
import org.junit.jupiter.api.Test;
2020
import test.aop.PerTargetAspect;
2121

2222
import org.springframework.aop.Pointcut;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package org.springframework.aop.aspectj.annotation;
1818

1919
import org.aspectj.lang.reflect.PerClauseKind;
20-
import org.junit.Test;
20+
import org.junit.jupiter.api.Test;
2121
import test.aop.PerTargetAspect;
2222

2323
import org.springframework.aop.Pointcut;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.aspectj.lang.ProceedingJoinPoint;
2424
import org.aspectj.lang.annotation.Around;
2525
import org.aspectj.lang.annotation.Aspect;
26-
import org.junit.Test;
26+
import org.junit.jupiter.api.Test;
2727
import test.aop.PerThisAspect;
2828

2929
import org.springframework.util.SerializationTestUtils;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
package org.springframework.aop.aspectj.autoproxy;
1818

19-
import org.junit.Before;
20-
import org.junit.Test;
19+
import org.junit.jupiter.api.BeforeEach;
20+
import org.junit.jupiter.api.Test;
2121

2222
import org.springframework.aop.config.AopConfigUtils;
2323
import org.springframework.aop.config.AopNamespaceUtils;
@@ -46,7 +46,7 @@ public class AspectJNamespaceHandlerTests {
4646
private BeanDefinitionRegistry registry = new DefaultListableBeanFactory();
4747

4848

49-
@Before
49+
@BeforeEach
5050
public void setUp() throws Exception {
5151
SourceExtractor sourceExtractor = new PassThroughSourceExtractor();
5252
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.registry);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
import java.lang.reflect.Method;
2020

21-
import org.junit.Before;
22-
import org.junit.Test;
21+
import org.junit.jupiter.api.BeforeEach;
22+
import org.junit.jupiter.api.Test;
2323

2424
import org.springframework.aop.Advisor;
2525
import org.springframework.aop.AfterReturningAdvice;
@@ -56,7 +56,7 @@ public class AspectJPrecedenceComparatorTests {
5656
private AspectJExpressionPointcut anyOldPointcut;
5757

5858

59-
@Before
59+
@BeforeEach
6060
public void setUp() throws Exception {
6161
this.comparator = new AspectJPrecedenceComparator();
6262
this.anyOldMethod = getClass().getMethods()[0];

spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
import java.util.HashSet;
2020
import java.util.Set;
2121

22-
import org.junit.Before;
23-
import org.junit.Test;
22+
import org.junit.jupiter.api.BeforeEach;
23+
import org.junit.jupiter.api.Test;
2424

2525
import org.springframework.beans.factory.config.BeanDefinition;
2626
import org.springframework.beans.factory.config.BeanReference;
@@ -56,7 +56,7 @@ public class AopNamespaceHandlerEventTests {
5656
private XmlBeanDefinitionReader reader;
5757

5858

59-
@Before
59+
@BeforeEach
6060
public void setup() {
6161
this.reader = new XmlBeanDefinitionReader(this.beanFactory);
6262
this.reader.setEventListener(this.eventListener);

spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.aop.config;
1818

19-
import org.junit.Test;
19+
import org.junit.jupiter.api.Test;
2020

2121
import org.springframework.beans.factory.BeanDefinitionStoreException;
2222
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;

spring-aop/src/test/java/org/springframework/aop/config/TopLevelAopTagTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.aop.config;
1818

19-
import org.junit.Test;
19+
import org.junit.jupiter.api.Test;
2020

2121
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
2222
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;

spring-aop/src/test/java/org/springframework/aop/framework/AopProxyUtilsTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import java.util.Arrays;
2121
import java.util.List;
2222

23-
import org.junit.Test;
23+
import org.junit.jupiter.api.Test;
2424

2525
import org.springframework.aop.SpringProxy;
2626
import org.springframework.tests.sample.beans.ITestBean;

spring-aop/src/test/java/org/springframework/aop/framework/IntroductionBenchmarkTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.aop.framework;
1818

19-
import org.junit.Test;
19+
import org.junit.jupiter.api.Test;
2020

2121
import org.springframework.aop.support.DelegatingIntroductionInterceptor;
2222
import org.springframework.tests.sample.beans.ITestBean;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
import org.aopalliance.intercept.MethodInterceptor;
2424
import org.aopalliance.intercept.MethodInvocation;
25-
import org.junit.Test;
25+
import org.junit.jupiter.api.Test;
2626

2727
import org.springframework.tests.sample.beans.TestBean;
2828

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import org.aopalliance.intercept.MethodInterceptor;
2020
import org.aopalliance.intercept.MethodInvocation;
21-
import org.junit.Test;
21+
import org.junit.jupiter.api.Test;
2222

2323
import org.springframework.aop.AopInvocationException;
2424

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import org.aopalliance.intercept.MethodInterceptor;
2020
import org.aopalliance.intercept.MethodInvocation;
21-
import org.junit.Test;
21+
import org.junit.jupiter.api.Test;
2222

2323
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
2424
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;

spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424

2525
import org.aopalliance.intercept.MethodInterceptor;
2626
import org.aopalliance.intercept.MethodInvocation;
27-
import org.junit.Ignore;
28-
import org.junit.Test;
27+
import org.junit.jupiter.api.Disabled;
28+
import org.junit.jupiter.api.Test;
2929

3030
import org.springframework.aop.Advisor;
3131
import org.springframework.aop.interceptor.DebugInterceptor;
@@ -325,7 +325,7 @@ public void testProxyTargetClassWithConcreteClassAsTarget() {
325325
}
326326

327327
@Test
328-
@Ignore("Not implemented yet, see https://jira.springframework.org/browse/SPR-5708")
328+
@Disabled("Not implemented yet, see https://jira.springframework.org/browse/SPR-5708")
329329
public void testExclusionOfNonPublicInterfaces() {
330330
JFrame frame = new JFrame();
331331
ProxyFactory proxyFactory = new ProxyFactory(frame);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import java.rmi.RemoteException;
2424

2525
import org.aopalliance.intercept.MethodInvocation;
26-
import org.junit.Test;
26+
import org.junit.jupiter.api.Test;
2727

2828
import org.springframework.aop.ThrowsAdvice;
2929
import org.springframework.tests.aop.advice.MethodCounter;

spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import org.apache.commons.logging.Log;
2020
import org.apache.commons.logging.LogFactory;
21-
import org.junit.Test;
21+
import org.junit.jupiter.api.Test;
2222

2323
import org.springframework.aop.framework.Advised;
2424
import org.springframework.aop.framework.ProxyFactory;

spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import org.aopalliance.intercept.MethodInvocation;
2020
import org.apache.commons.logging.Log;
21-
import org.junit.Test;
21+
import org.junit.jupiter.api.Test;
2222

2323
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
2424
import static org.mockito.ArgumentMatchers.anyString;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import org.aopalliance.intercept.MethodInvocation;
2020
import org.apache.commons.logging.Log;
21-
import org.junit.Test;
21+
import org.junit.jupiter.api.Test;
2222

2323
import static org.assertj.core.api.Assertions.assertThat;
2424
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.aop.interceptor;
1818

19-
import org.junit.Test;
19+
import org.junit.jupiter.api.Test;
2020

2121
import org.springframework.aop.framework.ProxyFactory;
2222
import org.springframework.beans.factory.NamedBean;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package org.springframework.aop.interceptor;
1818

1919
import org.aopalliance.intercept.MethodInvocation;
20-
import org.junit.Test;
20+
import org.junit.jupiter.api.Test;
2121

2222
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
2323
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;

spring-aop/src/test/java/org/springframework/aop/interceptor/JamonPerformanceMonitorInterceptorTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
import com.jamonapi.MonitorFactory;
2020
import org.aopalliance.intercept.MethodInvocation;
2121
import org.apache.commons.logging.Log;
22-
import org.junit.After;
23-
import org.junit.Before;
24-
import org.junit.Test;
22+
import org.junit.jupiter.api.AfterEach;
23+
import org.junit.jupiter.api.BeforeEach;
24+
import org.junit.jupiter.api.Test;
2525

2626
import static org.assertj.core.api.Assertions.assertThat;
2727
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
@@ -41,12 +41,12 @@ public class JamonPerformanceMonitorInterceptorTests {
4141
private final Log log = mock(Log.class);
4242

4343

44-
@Before
44+
@BeforeEach
4545
public void setUp() {
4646
MonitorFactory.reset();
4747
}
4848

49-
@After
49+
@AfterEach
5050
public void tearDown() {
5151
MonitorFactory.reset();
5252
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import org.aopalliance.intercept.MethodInvocation;
2020
import org.apache.commons.logging.Log;
21-
import org.junit.Test;
21+
import org.junit.jupiter.api.Test;
2222

2323
import static org.assertj.core.api.Assertions.assertThat;
2424
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;

0 commit comments

Comments
 (0)