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;

View File

@ -16,7 +16,7 @@
package org.springframework.aop.aspectj.autoproxy;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

View File

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

View File

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

View File

@ -16,7 +16,7 @@
package org.springframework.cache.aspectj;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.cache.Cache;
import org.springframework.cache.config.AbstractCacheAnnotationTests;

View File

@ -16,9 +16,9 @@
package org.springframework.cache.aspectj;
import org.junit.After;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.cache.CacheManager;
@ -57,7 +57,7 @@ public class AspectJEnableCachingIsolatedTests {
this.ctx = new AnnotationConfigApplicationContext(config);
}
@After
@AfterEach
public void closeContext() {
if (this.ctx != null) {
this.ctx.close();
@ -126,7 +126,7 @@ public class AspectJEnableCachingIsolatedTests {
}
@Test
@Ignore("AspectJ has some sort of caching that makes this one fail")
@Disabled("AspectJ has some sort of caching that makes this one fail")
public void emptyConfigSupport() {
load(EmptyConfigSupportConfig.class);
AnnotationCacheAspect aspect = this.ctx.getBean(AnnotationCacheAspect.class);

View File

@ -16,7 +16,7 @@
package org.springframework.context.annotation.aspectj;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.aspectj.ShouldBeConfiguredBySpring;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

View File

@ -22,8 +22,8 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler;
@ -55,7 +55,7 @@ public class AnnotationAsyncExecutionAspectTests {
private CountingExecutor executor;
@Before
@BeforeEach
public void setUp() {
Assume.group(TestGroup.PERFORMANCE);

View File

@ -18,9 +18,9 @@ package org.springframework.scheduling.aspectj;
import java.util.function.Supplier;
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.beans.DirectFieldAccessor;
import org.springframework.context.ConfigurableApplicationContext;
@ -36,13 +36,13 @@ public class AnnotationDrivenBeanDefinitionParserTests {
private ConfigurableApplicationContext context;
@Before
@BeforeEach
public void setup() {
this.context = new ClassPathXmlApplicationContext(
"annotationDrivenContext.xml", AnnotationDrivenBeanDefinitionParserTests.class);
}
@After
@AfterEach
public void after() {
if (this.context != null) {
this.context.close();

View File

@ -19,15 +19,15 @@ package org.springframework.transaction.aspectj;
import java.io.IOException;
import javax.transaction.Transactional;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.tests.transaction.CallCountingTransactionManager;
import static org.assertj.core.api.Assertions.assertThat;
@ -37,14 +37,14 @@ import static org.assertj.core.api.Assertions.assertThatIOException;
/**
* @author Stephane Nicoll
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = JtaTransactionAspectsTests.Config.class)
public class JtaTransactionAspectsTests {
@Autowired
private CallCountingTransactionManager txManager;
@Before
@BeforeEach
public void setUp() {
this.txManager.clear();
}

View File

@ -16,8 +16,8 @@
package org.springframework.transaction.aspectj;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.tests.transaction.CallCountingTransactionManager;
@ -47,7 +47,7 @@ public class TransactionAspectTests {
new MethodAnnotationOnClassWithNoInterface();
@Before
@BeforeEach
public void initContext() {
AnnotationTransactionAspect.aspectOf().setTransactionManager(txManager);
}

View File

@ -36,7 +36,7 @@ import java.util.TreeMap;
import java.util.TreeSet;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.propertyeditors.CustomNumberEditor;
@ -76,14 +76,12 @@ import static org.assertj.core.api.Assertions.within;
*/
public abstract class AbstractPropertyAccessorTests {
protected abstract AbstractPropertyAccessor createAccessor(Object target);
@Test
public void createWithNullTarget() {
assertThatIllegalArgumentException().isThrownBy(() ->
createAccessor(null));
assertThatIllegalArgumentException().isThrownBy(() -> createAccessor(null));
}
@Test
@ -114,8 +112,7 @@ public abstract class AbstractPropertyAccessorTests {
public void isReadablePropertyNull() {
AbstractPropertyAccessor accessor = createAccessor(new NoRead());
assertThatIllegalArgumentException().isThrownBy(() ->
accessor.isReadableProperty(null));
assertThatIllegalArgumentException().isThrownBy(() -> accessor.isReadableProperty(null));
}
@Test
@ -129,8 +126,7 @@ public abstract class AbstractPropertyAccessorTests {
public void isWritablePropertyNull() {
AbstractPropertyAccessor accessor = createAccessor(new NoRead());
assertThatIllegalArgumentException().isThrownBy(() ->
accessor.isWritableProperty(null));
assertThatIllegalArgumentException().isThrownBy(() -> accessor.isWritableProperty(null));
}
@Test
@ -519,7 +515,6 @@ public abstract class AbstractPropertyAccessorTests {
assertThat(target.getSpouse() == null).as("spouse is now null").isTrue();
}
@Test
public void setIndexedPropertyIgnored() {
MutablePropertyValues values = new MutablePropertyValues();
@ -692,7 +687,6 @@ public abstract class AbstractPropertyAccessorTests {
assertThat(target.getMyPrimitiveDouble()).isCloseTo(Double.MAX_VALUE, within(0.001));
assertThat(target.getMyDouble().doubleValue()).isCloseTo(Double.MAX_VALUE, within(0.001));
}
@Test
@ -1105,7 +1099,6 @@ public abstract class AbstractPropertyAccessorTests {
assertThat(target.getObject()).isEqualTo(array);
}
@Test
public void setCollectionProperty() {
IndexedTestBean target = new IndexedTestBean();
@ -1918,7 +1911,6 @@ public abstract class AbstractPropertyAccessorTests {
// class to test naming of beans in a error message
}
@SuppressWarnings("unused")
private static class NumberPropertyBean {

View File

@ -22,7 +22,7 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.propertyeditors.CustomDateEditor;

View File

@ -19,8 +19,8 @@ package org.springframework.beans;
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 static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@ -36,7 +36,7 @@ public class BeanWrapperAutoGrowingTests {
private final BeanWrapperImpl wrapper = new BeanWrapperImpl(bean);
@Before
@BeforeEach
public void setUp() {
wrapper.setAutoGrowNestedPaths(true);
}

View File

@ -19,7 +19,7 @@ package org.springframework.beans;
import java.util.LinkedHashMap;
import java.util.Map;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.tests.sample.beans.CustomEnum;

View File

@ -29,7 +29,7 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.propertyeditors.CustomNumberEditor;
import org.springframework.beans.propertyeditors.StringTrimmerEditor;

View File

@ -20,7 +20,7 @@ import java.util.Collections;
import java.util.Map;
import java.util.Optional;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.tests.sample.beans.TestBean;

View File

@ -20,7 +20,7 @@ import java.beans.BeanInfo;
import java.beans.PropertyDescriptor;
import java.util.ArrayList;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.OverridingClassLoader;
import org.springframework.tests.sample.beans.TestBean;

View File

@ -26,7 +26,7 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

View File

@ -16,7 +16,7 @@
package org.springframework.beans;
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.beans;
import java.beans.IntrospectionException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

View File

@ -23,7 +23,7 @@ import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.math.BigDecimal;
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.beans;
import java.util.Iterator;
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.assertThatExceptionOfType;

View File

@ -16,7 +16,7 @@
package org.springframework.beans;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

View File

@ -16,7 +16,7 @@
package org.springframework.beans;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

View File

@ -21,7 +21,7 @@ import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

View File

@ -20,8 +20,8 @@ import java.util.Arrays;
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 org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.StaticListableBeanFactory;
@ -58,7 +58,7 @@ public class BeanFactoryUtilsTests {
private DefaultListableBeanFactory dependentBeansFactory;
@Before
@BeforeEach
public void setUp() {
// Interesting hierarchical factory to test counts.
// Slow to read so we cache it.

View File

@ -27,8 +27,8 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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;
@ -71,7 +71,7 @@ public class ConcurrentBeanFactoryTests {
private Throwable ex;
@Before
@BeforeEach
public void setup() throws Exception {
Assume.group(TestGroup.PERFORMANCE);

View File

@ -43,8 +43,9 @@ import javax.security.auth.Subject;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.springframework.beans.BeansException;
import org.springframework.beans.MutablePropertyValues;
@ -2329,7 +2330,7 @@ public class DefaultListableBeanFactoryTests {
}
@Test
@Ignore // TODO re-enable when ConstructorResolver TODO sorted out
@Disabled // TODO re-enable when ConstructorResolver TODO sorted out
public void testPrototypeCreationWithConstructorArgumentsIsFastEnough() {
Assume.group(TestGroup.PERFORMANCE);
Assume.notLogging(factoryLog);
@ -2794,7 +2795,8 @@ public class DefaultListableBeanFactoryTests {
* under the 1000 ms timeout, usually ~= 300ms. With caching removed and on the same
* hardware the method will take ~13000 ms. See SPR-6870.
*/
@Test(timeout = 1000)
@Test
@Timeout(1)
public void testByTypeLookupIsFastEnough() {
Assume.group(TestGroup.PERFORMANCE);
@ -2810,7 +2812,8 @@ public class DefaultListableBeanFactoryTests {
}
}
@Test(timeout = 1000)
@Test
@Timeout(1)
public void testRegistrationOfManyBeanDefinitionsIsFastEnough() {
Assume.group(TestGroup.PERFORMANCE);
lbf.registerBeanDefinition("b", new RootBeanDefinition(B.class));
@ -2821,7 +2824,8 @@ public class DefaultListableBeanFactoryTests {
}
}
@Test(timeout = 1000)
@Test
@Timeout(1)
public void testRegistrationOfManySingletonsIsFastEnough() {
Assume.group(TestGroup.PERFORMANCE);
lbf.registerBeanDefinition("b", new RootBeanDefinition(B.class));

View File

@ -16,8 +16,8 @@
package org.springframework.beans.factory;
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.AbstractFactoryBean;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class FactoryBeanLookupTests {
private BeanFactory beanFactory;
@Before
@BeforeEach
public void setUp() {
beanFactory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory).loadBeanDefinitions(

View File

@ -20,7 +20,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.BeanPostProcessor;

View File

@ -16,7 +16,7 @@
package org.springframework.beans.factory;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConstructorArgumentValues;

View File

@ -16,7 +16,7 @@
package org.springframework.beans.factory.annotation;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.wiring.BeanWiringInfo;

View File

@ -40,10 +40,10 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.beans.factory.BeanCreationException;
@ -92,7 +92,7 @@ public class AutowiredAnnotationBeanPostProcessorTests {
private AutowiredAnnotationBeanPostProcessor bpp;
@Before
@BeforeEach
public void setup() {
bf = new DefaultListableBeanFactory();
bf.registerResolvableDependency(BeanFactory.class, bf);
@ -103,7 +103,7 @@ public class AutowiredAnnotationBeanPostProcessorTests {
bf.setDependencyComparator(AnnotationAwareOrderComparator.INSTANCE);
}
@After
@AfterEach
public void close() {
bf.destroySingletons();
}
@ -2052,7 +2052,7 @@ public class AutowiredAnnotationBeanPostProcessorTests {
}
@Test
@Ignore // SPR-11521
@Disabled // SPR-11521
@SuppressWarnings("rawtypes")
public void testGenericsBasedInjectionIntoTypeVariableSelectingBestMatchAgainstFactoryMethodSignature() {
RootBeanDefinition bd = new RootBeanDefinition(GenericInterface1Impl.class);

View File

@ -16,7 +16,7 @@
package org.springframework.beans.factory.annotation;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.config.BeanDefinitionHolder;
import org.springframework.beans.factory.config.DependencyDescriptor;

View File

@ -26,9 +26,9 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
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.beans.factory.BeanCreationException;
import org.springframework.beans.factory.BeanFactory;
@ -62,7 +62,7 @@ public class InjectAnnotationBeanPostProcessorTests {
private AutowiredAnnotationBeanPostProcessor bpp;
@Before
@BeforeEach
public void setup() {
bf = new DefaultListableBeanFactory();
bf.registerResolvableDependency(BeanFactory.class, bf);
@ -72,7 +72,7 @@ public class InjectAnnotationBeanPostProcessorTests {
bf.setAutowireCandidateResolver(new QualifierAnnotationAutowireCandidateResolver());
}
@After
@AfterEach
public void close() {
bf.destroySingletons();
}

View File

@ -16,8 +16,8 @@
package org.springframework.beans.factory.annotation;
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.support.RootBeanDefinition;
@ -35,7 +35,7 @@ public class LookupAnnotationTests {
private DefaultListableBeanFactory beanFactory;
@Before
@BeforeEach
public void setUp() {
beanFactory = new DefaultListableBeanFactory();
AutowiredAnnotationBeanPostProcessor aabpp = new AutowiredAnnotationBeanPostProcessor();

View File

@ -21,7 +21,7 @@ import java.lang.reflect.Executable;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.beans.factory.config.DependencyDescriptor;

View File

@ -21,7 +21,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.BeanFactory;

View File

@ -25,7 +25,7 @@ import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.PropertyEditorRegistrar;

View File

@ -19,7 +19,7 @@ package org.springframework.beans.factory.config;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;

View File

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

View File

@ -18,7 +18,7 @@ package org.springframework.beans.factory.config;
import java.sql.Connection;
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.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
import org.springframework.beans.support.ArgumentConvertingMethodInvoker;

View File

@ -19,9 +19,9 @@ package org.springframework.beans.factory.config;
import java.util.Date;
import javax.inject.Provider;
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.beans.factory.BeanFactory;
import org.springframework.beans.factory.ObjectFactory;
@ -46,7 +46,7 @@ public class ObjectFactoryCreatingFactoryBeanTests {
private DefaultListableBeanFactory beanFactory;
@Before
@BeforeEach
public void setup() {
this.beanFactory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions(
@ -54,7 +54,7 @@ public class ObjectFactoryCreatingFactoryBeanTests {
this.beanFactory.setSerializationId("test");
}
@After
@AfterEach
public void close() {
this.beanFactory.setSerializationId(null);
}

View File

@ -18,7 +18,7 @@ package org.springframework.beans.factory.config;
import java.util.Properties;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.Resource;

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