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 gh-23451
This commit is contained in:
Sam Brannen
2019-08-13 12:57:37 +02:00
parent 3df85c783f
commit 3f3e41923f
1487 changed files with 5428 additions and 4782 deletions

View File

@@ -17,7 +17,7 @@
package org.springframework.aop.aspectj;
import org.aspectj.lang.ProceedingJoinPoint;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Additional parameter name discover tests that need Java 5.

View File

@@ -19,7 +19,7 @@ package org.springframework.aop.aspectj;
import java.lang.reflect.Method;
import org.aspectj.lang.JoinPoint;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.aspectj.AspectJAdviceParameterNameDiscoverer.AmbiguousBindingException;

View File

@@ -23,8 +23,8 @@ import org.aopalliance.intercept.MethodInvocation;
import org.aspectj.weaver.tools.PointcutExpression;
import org.aspectj.weaver.tools.PointcutPrimitive;
import org.aspectj.weaver.tools.UnsupportedPointcutPrimitiveException;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.aop.ClassFilter;
import org.springframework.aop.MethodMatcher;
@@ -57,7 +57,7 @@ public class AspectJExpressionPointcutTests {
private Method setSomeNumber;
@Before
@BeforeEach
public void setUp() throws NoSuchMethodException {
getAge = TestBean.class.getMethod("getAge");
setAge = TestBean.class.getMethod("setAge", int.class);

View File

@@ -16,7 +16,7 @@
package org.springframework.aop.aspectj;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.tests.sample.beans.TestBean;

View File

@@ -26,7 +26,7 @@ import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.reflect.MethodSignature;
import org.aspectj.lang.reflect.SourceLocation;
import org.aspectj.runtime.reflect.Factory;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.MethodBeforeAdvice;
import org.springframework.aop.framework.AopContext;

View File

@@ -16,7 +16,7 @@
package org.springframework.aop.aspectj;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.aspectj.AspectJAdviceParameterNameDiscoverer.AmbiguousBindingException;

View File

@@ -21,8 +21,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import test.annotation.EmptySpringAnnotation;
import test.annotation.transaction.Tx;
@@ -44,7 +44,7 @@ public class TigerAspectJExpressionPointcutTests {
private final Map<String, Method> methodsOnHasGeneric = new HashMap<>();
@Before
@BeforeEach
public void setup() throws NoSuchMethodException {
getAge = TestBean.class.getMethod("getAge");
// Assumes no overloading

View File

@@ -24,7 +24,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Method;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.Advisor;
import org.springframework.aop.MethodBeforeAdvice;

View File

@@ -16,7 +16,7 @@
package org.springframework.aop.aspectj;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;

View File

@@ -38,8 +38,8 @@ import org.aspectj.lang.annotation.DeclareParents;
import org.aspectj.lang.annotation.DeclarePrecedence;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import test.aop.DefaultLockable;
import test.aop.Lockable;
import test.aop.PerTargetAspect;
@@ -414,7 +414,7 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
// TODO: Why does this test fail? It hasn't been run before, so it maybe never actually passed...
@Test
@Ignore
@Disabled
public void testIntroductionWithArgumentBinding() {
TestBean target = new TestBean();

View File

@@ -24,7 +24,7 @@ import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.aspectj.AspectJAdviceParameterNameDiscoverer;
import org.springframework.tests.sample.beans.ITestBean;

View File

@@ -16,7 +16,7 @@
package org.springframework.aop.aspectj.annotation;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import test.aop.PerTargetAspect;
import org.springframework.aop.Pointcut;

View File

@@ -17,7 +17,7 @@
package org.springframework.aop.aspectj.annotation;
import org.aspectj.lang.reflect.PerClauseKind;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import test.aop.PerTargetAspect;
import org.springframework.aop.Pointcut;

View File

@@ -23,7 +23,7 @@ import org.apache.commons.logging.LogFactory;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import test.aop.PerThisAspect;
import org.springframework.util.SerializationTestUtils;

View File

@@ -16,8 +16,8 @@
package org.springframework.aop.aspectj.autoproxy;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.aop.config.AopConfigUtils;
import org.springframework.aop.config.AopNamespaceUtils;
@@ -46,7 +46,7 @@ public class AspectJNamespaceHandlerTests {
private BeanDefinitionRegistry registry = new DefaultListableBeanFactory();
@Before
@BeforeEach
public void setUp() throws Exception {
SourceExtractor sourceExtractor = new PassThroughSourceExtractor();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.registry);

View File

@@ -18,8 +18,8 @@ package org.springframework.aop.aspectj.autoproxy;
import java.lang.reflect.Method;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.aop.Advisor;
import org.springframework.aop.AfterReturningAdvice;
@@ -56,7 +56,7 @@ public class AspectJPrecedenceComparatorTests {
private AspectJExpressionPointcut anyOldPointcut;
@Before
@BeforeEach
public void setUp() throws Exception {
this.comparator = new AspectJPrecedenceComparator();
this.anyOldMethod = getClass().getMethods()[0];

View File

@@ -19,8 +19,8 @@ package org.springframework.aop.config;
import java.util.HashSet;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanReference;
@@ -56,7 +56,7 @@ public class AopNamespaceHandlerEventTests {
private XmlBeanDefinitionReader reader;
@Before
@BeforeEach
public void setup() {
this.reader = new XmlBeanDefinitionReader(this.beanFactory);
this.reader.setEventListener(this.eventListener);

View File

@@ -16,7 +16,7 @@
package org.springframework.aop.config;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;

View File

@@ -16,7 +16,7 @@
package org.springframework.aop.config;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;

View File

@@ -20,7 +20,7 @@ import java.lang.reflect.Proxy;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.SpringProxy;
import org.springframework.tests.sample.beans.ITestBean;

View File

@@ -16,7 +16,7 @@
package org.springframework.aop.framework;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.support.DelegatingIntroductionInterceptor;
import org.springframework.tests.sample.beans.ITestBean;

View File

@@ -22,7 +22,7 @@ import java.util.List;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.tests.sample.beans.TestBean;

View File

@@ -18,7 +18,7 @@ package org.springframework.aop.framework;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.AopInvocationException;

View File

@@ -18,7 +18,7 @@ package org.springframework.aop.framework;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;

View File

@@ -24,8 +24,8 @@ import javax.swing.RootPaneContainer;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.aop.Advisor;
import org.springframework.aop.interceptor.DebugInterceptor;
@@ -325,7 +325,7 @@ public class ProxyFactoryTests {
}
@Test
@Ignore("Not implemented yet, see https://jira.springframework.org/browse/SPR-5708")
@Disabled("Not implemented yet, see https://jira.springframework.org/browse/SPR-5708")
public void testExclusionOfNonPublicInterfaces() {
JFrame frame = new JFrame();
ProxyFactory proxyFactory = new ProxyFactory(frame);

View File

@@ -23,7 +23,7 @@ import java.rmi.ConnectException;
import java.rmi.RemoteException;
import org.aopalliance.intercept.MethodInvocation;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.ThrowsAdvice;
import org.springframework.tests.aop.advice.MethodCounter;

View File

@@ -18,7 +18,7 @@ package org.springframework.aop.interceptor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.framework.ProxyFactory;

View File

@@ -18,7 +18,7 @@ package org.springframework.aop.interceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.ArgumentMatchers.anyString;

View File

@@ -18,7 +18,7 @@ package org.springframework.aop.interceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;

View File

@@ -16,7 +16,7 @@
package org.springframework.aop.interceptor;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.beans.factory.NamedBean;

View File

@@ -17,7 +17,7 @@
package org.springframework.aop.interceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;

View File

@@ -19,9 +19,9 @@ package org.springframework.aop.interceptor;
import com.jamonapi.MonitorFactory;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
@@ -41,12 +41,12 @@ public class JamonPerformanceMonitorInterceptorTests {
private final Log log = mock(Log.class);
@Before
@BeforeEach
public void setUp() {
MonitorFactory.reset();
}
@After
@AfterEach
public void tearDown() {
MonitorFactory.reset();
}

View File

@@ -18,7 +18,7 @@ package org.springframework.aop.interceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;

View File

@@ -18,7 +18,7 @@ package org.springframework.aop.interceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.ArgumentMatchers.anyString;

View File

@@ -16,7 +16,7 @@
package org.springframework.aop.scope;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;

View File

@@ -18,7 +18,7 @@ package org.springframework.aop.scope;
import java.util.Arrays;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;

View File

@@ -18,8 +18,8 @@ package org.springframework.aop.support;
import java.io.IOException;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.util.SerializationTestUtils;
@@ -35,7 +35,7 @@ public abstract class AbstractRegexpMethodPointcutTests {
private AbstractRegexpMethodPointcut rpc;
@Before
@BeforeEach
public void setUp() {
rpc = getRegexpMethodPointcut();
}

View File

@@ -18,7 +18,7 @@ package org.springframework.aop.support;
import java.lang.reflect.Method;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.ClassFilter;
import org.springframework.aop.MethodMatcher;

View File

@@ -16,7 +16,7 @@
package org.springframework.aop.support;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.ClassFilter;
import org.springframework.core.NestedRuntimeException;

View File

@@ -15,7 +15,7 @@
*/
package org.springframework.aop.support;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.tests.sample.beans.TestBean;

View File

@@ -18,7 +18,7 @@ package org.springframework.aop.support;
import java.lang.reflect.Method;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.ClassFilter;
import org.springframework.aop.MethodMatcher;

View File

@@ -16,7 +16,7 @@
package org.springframework.aop.support;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.Pointcut;
import org.springframework.aop.framework.ProxyFactory;

View File

@@ -19,7 +19,7 @@ package org.springframework.aop.support;
import java.io.Serializable;
import org.aopalliance.intercept.MethodInterceptor;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.IntroductionAdvisor;
import org.springframework.aop.IntroductionInterceptor;

View File

@@ -18,7 +18,7 @@ package org.springframework.aop.support;
import java.lang.reflect.Method;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.MethodMatcher;
import org.springframework.lang.Nullable;

View File

@@ -16,8 +16,8 @@
package org.springframework.aop.support;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.framework.ProxyFactory;
@@ -45,7 +45,7 @@ public class NameMatchMethodPointcutTests {
/**
* Create an empty pointcut, populating instance variables.
*/
@Before
@BeforeEach
public void setup() {
ProxyFactory pf = new ProxyFactory(new SerializablePerson());
nop = new SerializableNopInterceptor();

View File

@@ -18,7 +18,7 @@ package org.springframework.aop.support;
import java.lang.reflect.Method;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.ClassFilter;
import org.springframework.aop.Pointcut;

View File

@@ -16,7 +16,7 @@
package org.springframework.aop.support;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.Advised;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;

View File

@@ -16,7 +16,7 @@
package org.springframework.aop.target;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;

View File

@@ -16,9 +16,9 @@
package org.springframework.aop.target;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.framework.ProxyFactory;
@@ -47,7 +47,7 @@ public class HotSwappableTargetSourceTests {
private DefaultListableBeanFactory beanFactory;
@Before
@BeforeEach
public void setup() {
this.beanFactory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions(
@@ -57,7 +57,7 @@ public class HotSwappableTargetSourceTests {
/**
* We must simulate container shutdown, which should clear threads.
*/
@After
@AfterEach
public void close() {
// Will call pool.close()
this.beanFactory.destroySingletons();

View File

@@ -16,7 +16,7 @@
package org.springframework.aop.target;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.TargetSource;
import org.springframework.aop.framework.ProxyFactory;

View File

@@ -18,7 +18,7 @@ package org.springframework.aop.target;
import java.util.Set;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;

View File

@@ -16,7 +16,7 @@
package org.springframework.aop.target;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.TargetSource;
import org.springframework.beans.MutablePropertyValues;

View File

@@ -16,8 +16,8 @@
package org.springframework.aop.target;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
@@ -38,7 +38,7 @@ public class PrototypeTargetSourceTests {
private DefaultListableBeanFactory beanFactory;
@Before
@BeforeEach
public void setup() {
this.beanFactory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions(

View File

@@ -16,8 +16,8 @@
package org.springframework.aop.target;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
@@ -39,7 +39,7 @@ public class ThreadLocalTargetSourceTests {
private DefaultListableBeanFactory beanFactory;
@Before
@BeforeEach
public void setup() {
this.beanFactory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions(

View File

@@ -16,7 +16,7 @@
package org.springframework.aop.target.dynamic;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.tests.Assume;
import org.springframework.tests.TestGroup;