diff --git a/build.gradle b/build.gradle index 4341457d3c1..c3f625e7962 100644 --- a/build.gradle +++ b/build.gradle @@ -308,6 +308,7 @@ configure([rootProject] + javaProjects) { project -> group = "org.springframework" apply plugin: "java" + apply plugin: "java-test-fixtures" apply plugin: "checkstyle" apply plugin: 'org.springframework.build.compile' apply from: "${rootDir}/gradle/ide.gradle" diff --git a/buildSrc/src/main/java/org/springframework/build/testsources/TestSourcesPlugin.java b/buildSrc/src/main/java/org/springframework/build/testsources/TestSourcesPlugin.java index 68b97661902..b93ca0f77df 100644 --- a/buildSrc/src/main/java/org/springframework/build/testsources/TestSourcesPlugin.java +++ b/buildSrc/src/main/java/org/springframework/build/testsources/TestSourcesPlugin.java @@ -55,9 +55,16 @@ public class TestSourcesPlugin implements Plugin { OptionalDependenciesPlugin.OPTIONAL_CONFIGURATION_NAME, JavaPlugin.TEST_COMPILE_CONFIGURATION_NAME); + /** + * Projects which will not be automatically added as a test dependency. + *

This is used to assist with the migration to Gradle test fixtures. + */ + private static final List excludedProjects = Arrays.asList("spring-core"); + + @Override public void apply(Project project) { - project.getPlugins().withType(JavaPlugin.class, (plugin) -> addTestSourcesToProject(project)); + project.getPlugins().withType(JavaPlugin.class, plugin -> addTestSourcesToProject(project)); } private void addTestSourcesToProject(Project project) { @@ -83,13 +90,17 @@ public class TestSourcesPlugin implements Plugin { } } - private void addTestSourcesFromDependency(final Project currentProject, ProjectDependency dependency) { + @SuppressWarnings("deprecation") + private void addTestSourcesFromDependency(Project currentProject, ProjectDependency dependency) { Project dependencyProject = dependency.getDependencyProject(); - dependencyProject.getPlugins().withType(JavaPlugin.class, plugin -> { - final JavaPluginConvention javaPlugin = dependencyProject.getConvention() - .getPlugin(JavaPluginConvention.class); - SourceSetOutput test = javaPlugin.getSourceSets().findByName(SourceSet.TEST_SOURCE_SET_NAME).getOutput(); - currentProject.getDependencies().add(JavaPlugin.TEST_COMPILE_CONFIGURATION_NAME, test); - }); + if (!excludedProjects.contains(dependencyProject.getName())) { + dependencyProject.getPlugins().withType(JavaPlugin.class, plugin -> { + JavaPluginConvention javaPlugin = dependencyProject.getConvention().getPlugin(JavaPluginConvention.class); + SourceSetOutput test = javaPlugin.getSourceSets().findByName(SourceSet.TEST_SOURCE_SET_NAME).getOutput(); + // System.err.println(String.format("Adding test source dependencies from %s to %s", currentProject.getName(), dependencyProject.getName())); + currentProject.getDependencies().add(JavaPlugin.TEST_COMPILE_CONFIGURATION_NAME, test); + }); + } } + } diff --git a/integration-tests/integration-tests.gradle b/integration-tests/integration-tests.gradle index ab3bba7354b..afaa939a61b 100644 --- a/integration-tests/integration-tests.gradle +++ b/integration-tests/integration-tests.gradle @@ -7,6 +7,7 @@ dependencies { testCompile(project(":spring-beans")) testCompile(project(":spring-context")) testCompile(project(":spring-core")) + testCompile(testFixtures(project(":spring-core"))) testCompile(project(":spring-expression")) testCompile(project(":spring-jdbc")) testCompile(project(":spring-orm")) diff --git a/integration-tests/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java b/integration-tests/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java index 29f6e050812..173da6e54d7 100644 --- a/integration-tests/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java +++ b/integration-tests/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java @@ -21,12 +21,12 @@ import org.junit.jupiter.api.Test; import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpSession; import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import org.springframework.tests.sample.beans.ITestBean; import org.springframework.tests.sample.beans.TestBean; -import org.springframework.util.SerializationTestUtils; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; diff --git a/integration-tests/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java b/integration-tests/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java index 95d897138f4..77f1145de82 100644 --- a/integration-tests/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java +++ b/integration-tests/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java @@ -28,10 +28,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; import org.springframework.dao.support.PersistenceExceptionTranslator; import org.springframework.stereotype.Repository; -import org.springframework.tests.EnabledForTestGroups; import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; @@ -40,7 +40,7 @@ import org.springframework.transaction.annotation.Transactional; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.mockito.Mockito.mock; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * Integration tests cornering bug SPR-8651, which revealed that @Scheduled methods may diff --git a/spring-aop/spring-aop.gradle b/spring-aop/spring-aop.gradle index e4c20542e2c..3d000edc2d4 100644 --- a/spring-aop/spring-aop.gradle +++ b/spring-aop/spring-aop.gradle @@ -6,4 +6,5 @@ dependencies { optional("org.aspectj:aspectjweaver") optional("org.apache.commons:commons-pool2") optional("com.jamonapi:jamon") + testCompile(testFixtures(project(":spring-core"))) } diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java index 0c4d6ff1d8d..e445598dd28 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java @@ -26,7 +26,7 @@ import org.aspectj.lang.annotation.Aspect; import org.junit.jupiter.api.Test; import test.aop.PerThisAspect; -import org.springframework.util.SerializationTestUtils; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests.java b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests.java index c31d5a396d0..d713be7450f 100644 --- a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests.java @@ -33,7 +33,7 @@ import org.springframework.core.io.Resource; import org.springframework.tests.beans.CollectingReaderEventListener; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * @author Rob Harrop diff --git a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java index 7b07a2f793e..67cc99823d7 100644 --- a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java @@ -24,7 +24,7 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * @author Mark Fisher diff --git a/spring-aop/src/test/java/org/springframework/aop/config/TopLevelAopTagTests.java b/spring-aop/src/test/java/org/springframework/aop/config/TopLevelAopTagTests.java index 95732b92a1d..c8e21cb8c40 100644 --- a/spring-aop/src/test/java/org/springframework/aop/config/TopLevelAopTagTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/config/TopLevelAopTagTests.java @@ -22,7 +22,7 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * Tests that the <aop:config/> element can be used as a top level element. diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java index 6174c02a0c1..dd99d98d647 100644 --- a/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java @@ -25,7 +25,7 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * @author Juergen Hoeller diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java index 7372468f9c3..06545b23b00 100644 --- a/spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java @@ -36,7 +36,7 @@ import org.springframework.aop.support.DefaultPointcutAdvisor; import org.springframework.aop.support.DelegatingIntroductionInterceptor; import org.springframework.core.annotation.AnnotationAwareOrderComparator; import org.springframework.core.annotation.Order; -import org.springframework.tests.TimeStamped; +import org.springframework.core.test.fixtures.TimeStamped; import org.springframework.tests.aop.advice.CountingBeforeAdvice; import org.springframework.tests.aop.interceptor.NopInterceptor; import org.springframework.tests.sample.beans.IOther; diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java index 9477df4ca01..316d212c12d 100644 --- a/spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java @@ -22,10 +22,10 @@ import org.junit.jupiter.api.Test; import org.springframework.aop.framework.Advised; import org.springframework.aop.framework.ProxyFactory; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.tests.sample.beans.DerivedTestBean; import org.springframework.tests.sample.beans.ITestBean; import org.springframework.tests.sample.beans.TestBean; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java index 76b682bf093..aaba0ed6231 100644 --- a/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java @@ -25,7 +25,7 @@ import org.springframework.tests.sample.beans.ITestBean; import org.springframework.tests.sample.beans.TestBean; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * Non-XML tests are in AbstractAopProxyTests diff --git a/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java b/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java index 42f32fa1eb0..7c09bbb7c5a 100644 --- a/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java @@ -24,7 +24,7 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * @author Mark Fisher diff --git a/spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java index f13ebf47fea..1b32923d4da 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java @@ -21,8 +21,8 @@ import java.io.IOException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.tests.sample.beans.TestBean; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java b/spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java index 63778647deb..09d88705f80 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java @@ -25,10 +25,10 @@ import org.springframework.aop.MethodMatcher; import org.springframework.aop.Pointcut; import org.springframework.aop.interceptor.ExposeInvocationInterceptor; import org.springframework.aop.target.EmptyTargetSource; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.lang.Nullable; import org.springframework.tests.aop.interceptor.NopInterceptor; import org.springframework.tests.sample.beans.TestBean; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java index a165be41a40..55da6fee78b 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java @@ -24,7 +24,8 @@ import org.junit.jupiter.api.Test; import org.springframework.aop.IntroductionAdvisor; import org.springframework.aop.IntroductionInterceptor; import org.springframework.aop.framework.ProxyFactory; -import org.springframework.tests.TimeStamped; +import org.springframework.core.test.fixtures.TimeStamped; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.tests.aop.interceptor.SerializableNopInterceptor; import org.springframework.tests.sample.beans.INestedTestBean; import org.springframework.tests.sample.beans.ITestBean; @@ -32,7 +33,6 @@ import org.springframework.tests.sample.beans.NestedTestBean; import org.springframework.tests.sample.beans.Person; import org.springframework.tests.sample.beans.SerializablePerson; import org.springframework.tests.sample.beans.TestBean; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java b/spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java index f860ef72d4e..b69e8450b49 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java @@ -21,11 +21,11 @@ import java.lang.reflect.Method; import org.junit.jupiter.api.Test; import org.springframework.aop.MethodMatcher; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.lang.Nullable; import org.springframework.tests.sample.beans.IOther; import org.springframework.tests.sample.beans.ITestBean; import org.springframework.tests.sample.beans.TestBean; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java b/spring-aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java index 91517e6831c..87241091caf 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java @@ -21,11 +21,11 @@ import org.junit.jupiter.api.Test; import org.springframework.aop.framework.Advised; import org.springframework.aop.framework.ProxyFactory; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.tests.aop.interceptor.NopInterceptor; import org.springframework.tests.aop.interceptor.SerializableNopInterceptor; import org.springframework.tests.sample.beans.Person; import org.springframework.tests.sample.beans.SerializablePerson; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java b/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java index da9699a305b..34fd0e47775 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java @@ -22,15 +22,15 @@ import org.springframework.aop.framework.Advised; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.tests.aop.interceptor.NopInterceptor; import org.springframework.tests.aop.interceptor.SerializableNopInterceptor; import org.springframework.tests.sample.beans.ITestBean; import org.springframework.tests.sample.beans.Person; import org.springframework.tests.sample.beans.TestBean; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * @author Rod Johnson diff --git a/spring-aop/src/test/java/org/springframework/aop/target/CommonsPool2TargetSourceProxyTests.java b/spring-aop/src/test/java/org/springframework/aop/target/CommonsPool2TargetSourceProxyTests.java index 31afac2e099..5536a17c8f0 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/CommonsPool2TargetSourceProxyTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/CommonsPool2TargetSourceProxyTests.java @@ -25,7 +25,7 @@ import org.springframework.core.io.Resource; import org.springframework.tests.sample.beans.ITestBean; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * @author Stephane Nicoll diff --git a/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java index ef7bea56dae..a5298674de7 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java @@ -25,15 +25,15 @@ import org.springframework.aop.framework.ProxyFactory; import org.springframework.aop.support.DefaultPointcutAdvisor; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.tests.aop.interceptor.SerializableNopInterceptor; import org.springframework.tests.sample.beans.Person; import org.springframework.tests.sample.beans.SerializablePerson; import org.springframework.tests.sample.beans.SideEffectBean; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * @author Rod Johnson diff --git a/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java index 0efaa5165e6..54ea0552c76 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java @@ -26,7 +26,7 @@ import org.springframework.core.io.Resource; import org.springframework.tests.sample.beans.ITestBean; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * @author Juergen Hoeller diff --git a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java index a8b7d812ab2..a4006bd888e 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java @@ -23,9 +23,9 @@ import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RootBeanDefinition; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.tests.sample.beans.SerializablePerson; import org.springframework.tests.sample.beans.TestBean; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java index edcf3379a7c..37bf57a2741 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java @@ -24,7 +24,7 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.tests.sample.beans.SideEffectBean; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * @author Rod Johnson diff --git a/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java index bb5e6579d83..1ff3816db8b 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java @@ -25,7 +25,7 @@ import org.springframework.tests.sample.beans.ITestBean; import org.springframework.tests.sample.beans.SideEffectBean; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * @author Rod Johnson diff --git a/spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java index dbfe7024c45..23c1c56f048 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java @@ -18,10 +18,10 @@ package org.springframework.aop.target.dynamic; import org.junit.jupiter.api.Test; -import org.springframework.tests.EnabledForTestGroups; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * @author Rob Harrop diff --git a/spring-aop/src/test/java/org/springframework/tests/aop/interceptor/TimestampIntroductionInterceptor.java b/spring-aop/src/test/java/org/springframework/tests/aop/interceptor/TimestampIntroductionInterceptor.java index 8e665dba656..41e79f3e5c9 100644 --- a/spring-aop/src/test/java/org/springframework/tests/aop/interceptor/TimestampIntroductionInterceptor.java +++ b/spring-aop/src/test/java/org/springframework/tests/aop/interceptor/TimestampIntroductionInterceptor.java @@ -17,7 +17,7 @@ package org.springframework.tests.aop.interceptor; import org.springframework.aop.support.DelegatingIntroductionInterceptor; -import org.springframework.tests.TimeStamped; +import org.springframework.core.test.fixtures.TimeStamped; @SuppressWarnings("serial") public class TimestampIntroductionInterceptor extends DelegatingIntroductionInterceptor diff --git a/spring-aspects/spring-aspects.gradle b/spring-aspects/spring-aspects.gradle index b30a8107f98..fbb21964377 100644 --- a/spring-aspects/spring-aspects.gradle +++ b/spring-aspects/spring-aspects.gradle @@ -24,6 +24,7 @@ dependencies { optional("javax.transaction:javax.transaction-api") // for @javax.transaction.Transactional support testCompile(project(":spring-core")) // for CodeStyleAspect testCompile(project(":spring-test")) + testCompile(testFixtures(project(":spring-core"))) testCompile("javax.mail:javax.mail-api") testCompileOnly("org.aspectj:aspectjrt") } diff --git a/spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspectTests.java b/spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspectTests.java index 62dceafaede..940c3e044b2 100644 --- a/spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspectTests.java +++ b/spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspectTests.java @@ -30,15 +30,15 @@ import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.core.task.SimpleAsyncTaskExecutor; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.AsyncResult; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import org.springframework.tests.EnabledForTestGroups; import org.springframework.util.ReflectionUtils; import org.springframework.util.concurrent.ListenableFuture; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * Unit tests for {@link AnnotationAsyncExecutionAspect}. diff --git a/spring-beans/spring-beans.gradle b/spring-beans/spring-beans.gradle index 0409b9e910d..9ab23dedff8 100644 --- a/spring-beans/spring-beans.gradle +++ b/spring-beans/spring-beans.gradle @@ -10,6 +10,7 @@ dependencies { optional("org.codehaus.groovy:groovy-xml") optional("org.jetbrains.kotlin:kotlin-reflect") optional("org.jetbrains.kotlin:kotlin-stdlib") + testCompile(testFixtures(project(":spring-core"))) testCompile("javax.annotation:javax.annotation-api") } diff --git a/spring-beans/src/test/java/org/springframework/beans/AbstractPropertyAccessorTests.java b/spring-beans/src/test/java/org/springframework/beans/AbstractPropertyAccessorTests.java index 0b7576bad4c..723ee31c238 100644 --- a/spring-beans/src/test/java/org/springframework/beans/AbstractPropertyAccessorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/AbstractPropertyAccessorTests.java @@ -47,9 +47,9 @@ import org.springframework.core.convert.ConversionFailedException; import org.springframework.core.convert.TypeDescriptor; import org.springframework.core.convert.support.DefaultConversionService; import org.springframework.core.convert.support.GenericConversionService; +import org.springframework.core.test.fixtures.Assume; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.lang.Nullable; -import org.springframework.tests.Assume; -import org.springframework.tests.EnabledForTestGroups; import org.springframework.tests.sample.beans.BooleanTestBean; import org.springframework.tests.sample.beans.ITestBean; import org.springframework.tests.sample.beans.IndexedTestBean; @@ -62,7 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.within; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * Shared tests for property accessors. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java index 47aa95f8a92..4f7a9659bc0 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java @@ -37,7 +37,7 @@ import org.springframework.tests.sample.beans.factory.DummyFactory; import org.springframework.util.ObjectUtils; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * @author Rod Johnson diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java index 87f7e0089a3..2587d05e4e6 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java @@ -33,11 +33,11 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.beans.propertyeditors.CustomDateEditor; -import org.springframework.tests.EnabledForTestGroups; -import org.springframework.tests.TestGroup; +import org.springframework.core.test.fixtures.EnabledForTestGroups; +import org.springframework.core.test.fixtures.TestGroup; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * @author Guillaume Poirier diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java index 2c38c122e68..20fde13c848 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java @@ -86,10 +86,11 @@ import org.springframework.core.convert.support.DefaultConversionService; import org.springframework.core.convert.support.GenericConversionService; import org.springframework.core.io.Resource; import org.springframework.core.io.UrlResource; +import org.springframework.core.test.fixtures.Assume; +import org.springframework.core.test.fixtures.EnabledForTestGroups; +import org.springframework.core.test.fixtures.TestGroup; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.lang.Nullable; -import org.springframework.tests.Assume; -import org.springframework.tests.EnabledForTestGroups; -import org.springframework.tests.TestGroup; import org.springframework.tests.sample.beans.DependenciesBean; import org.springframework.tests.sample.beans.DerivedTestBean; import org.springframework.tests.sample.beans.ITestBean; @@ -98,7 +99,6 @@ import org.springframework.tests.sample.beans.NestedTestBean; import org.springframework.tests.sample.beans.SideEffectBean; import org.springframework.tests.sample.beans.TestBean; import org.springframework.tests.sample.beans.factory.DummyFactory; -import org.springframework.util.SerializationTestUtils; import org.springframework.util.StopWatch; import org.springframework.util.StringValueResolver; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java index 3bffa8ca1fa..427161efb3b 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java @@ -27,11 +27,11 @@ import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; -import org.springframework.stereotype.Component; +import org.springframework.core.test.fixtures.stereotype.Component; import org.springframework.util.Assert; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * @author Rob Harrop diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java index 8f650ffc360..2a552309f63 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java @@ -68,12 +68,12 @@ import org.springframework.core.Ordered; import org.springframework.core.ResolvableType; import org.springframework.core.annotation.AnnotationAwareOrderComparator; import org.springframework.core.annotation.Order; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.tests.sample.beans.ITestBean; import org.springframework.tests.sample.beans.IndexedTestBean; import org.springframework.tests.sample.beans.NestedTestBean; import org.springframework.tests.sample.beans.TestBean; import org.springframework.util.ReflectionUtils; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurerTests.java index 3454c28d9c2..259132d5ff9 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurerTests.java @@ -25,7 +25,7 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * Unit tests for {@link CustomAutowireConfigurer}. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java index 8f498f3889e..2a39ac4fbaf 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java @@ -40,11 +40,11 @@ import org.springframework.beans.factory.support.AutowireCandidateQualifier; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.GenericBeanDefinition; import org.springframework.beans.factory.support.RootBeanDefinition; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.tests.sample.beans.ITestBean; import org.springframework.tests.sample.beans.IndexedTestBean; import org.springframework.tests.sample.beans.NestedTestBean; import org.springframework.tests.sample.beans.TestBean; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests.java index cc20dc84e4d..770a6bddd0b 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests.java @@ -25,7 +25,7 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.tests.sample.beans.TestBean; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * Unit tests for {@link FieldRetrievingFactoryBean}. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java index 02066e98a45..d045f1d9619 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java @@ -28,13 +28,13 @@ import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.ObjectFactory; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; -import org.springframework.util.SerializationTestUtils; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * @author Colin Sampaleanu diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertiesFactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertiesFactoryBeanTests.java index e7b68287893..cdd9778c134 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertiesFactoryBeanTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertiesFactoryBeanTests.java @@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test; import org.springframework.core.io.Resource; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * Unit tests for {@link PropertiesFactoryBean}. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java index 0c7fcc4a4c1..c9ba85ae21b 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java @@ -25,7 +25,7 @@ import org.springframework.tests.sample.beans.ITestBean; import org.springframework.tests.sample.beans.TestBean; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * Unit tests for {@link PropertyPathFactoryBean}. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java index 9d5b3909ce6..cf8cf8ac18a 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java @@ -47,7 +47,7 @@ import org.springframework.util.StringUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.springframework.beans.factory.support.BeanDefinitionBuilder.genericBeanDefinition; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * Unit tests for various {@link PropertyResourceConfigurer} implementations including: diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests.java index 297c4a655ca..5844bb08069 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests.java @@ -28,7 +28,7 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.tests.sample.beans.TestBean; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * Simple test to illustrate and verify scope usage. diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java index 33caa90d573..c8287913ef8 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java @@ -27,7 +27,7 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.tests.sample.beans.TestBean; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestResourceUtils.qualifiedResource; +import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource; /** * @author Rob Harrop diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java index d848f90a7e5..e89a49b4b3b 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java @@ -49,7 +49,7 @@ import org.springframework.core.annotation.AnnotationAwareOrderComparator; import org.springframework.core.annotation.Order; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.UrlResource; -import org.springframework.tests.EnabledForTestGroups; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.tests.sample.beans.GenericBean; import org.springframework.tests.sample.beans.GenericIntegerBean; import org.springframework.tests.sample.beans.GenericSetOfIntegerBean; @@ -57,7 +57,7 @@ import org.springframework.tests.sample.beans.TestBean; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.springframework.tests.TestGroup.LONG_RUNNING; +import static org.springframework.core.test.fixtures.TestGroup.LONG_RUNNING; /** * @author Juergen Hoeller diff --git a/spring-context-indexer/src/test/java/org/springframework/context/index/sample/SampleNone.java b/spring-context-indexer/src/test/java/org/springframework/context/index/sample/SampleNone.java index bd1cd72401f..f81de9365b8 100644 --- a/spring-context-indexer/src/test/java/org/springframework/context/index/sample/SampleNone.java +++ b/spring-context-indexer/src/test/java/org/springframework/context/index/sample/SampleNone.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2019 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. @@ -17,7 +17,6 @@ package org.springframework.context.index.sample; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.core.type.Scope; /** * Candidate with no matching annotation. diff --git a/spring-context-indexer/src/test/java/org/springframework/context/index/sample/Scope.java b/spring-context-indexer/src/test/java/org/springframework/context/index/sample/Scope.java new file mode 100644 index 00000000000..b96de613937 --- /dev/null +++ b/spring-context-indexer/src/test/java/org/springframework/context/index/sample/Scope.java @@ -0,0 +1,33 @@ +/* + * Copyright 2002-2009 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.context.index.sample; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Copy of the {@code @Scope} annotation for testing purposes. + */ +@Target({ ElementType.TYPE, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +public @interface Scope { + + String value() default "singleton"; + +} diff --git a/spring-context-support/spring-context-support.gradle b/spring-context-support/spring-context-support.gradle index 54bf50e4333..f2fb5feedeb 100644 --- a/spring-context-support/spring-context-support.gradle +++ b/spring-context-support/spring-context-support.gradle @@ -15,6 +15,7 @@ dependencies { optional("org.codehaus.fabric3.api:commonj") optional("org.freemarker:freemarker") testCompile(project(":spring-context")) + testCompile(testFixtures(project(":spring-core"))) testCompile("org.hsqldb:hsqldb") testCompile("org.hibernate:hibernate-validator") testCompile("javax.annotation:javax.annotation-api") diff --git a/spring-context-support/src/test/java/org/springframework/cache/ehcache/EhCacheCacheTests.java b/spring-context-support/src/test/java/org/springframework/cache/ehcache/EhCacheCacheTests.java index df0e02b72ae..b35768a7bf9 100644 --- a/spring-context-support/src/test/java/org/springframework/cache/ehcache/EhCacheCacheTests.java +++ b/spring-context-support/src/test/java/org/springframework/cache/ehcache/EhCacheCacheTests.java @@ -26,10 +26,10 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.cache.AbstractCacheTests; -import org.springframework.tests.EnabledForTestGroups; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestGroup.LONG_RUNNING; +import static org.springframework.core.test.fixtures.TestGroup.LONG_RUNNING; /** * @author Costin Leau diff --git a/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java b/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java index b2503fb7db3..3e22f848352 100644 --- a/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java +++ b/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java @@ -37,8 +37,8 @@ import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.support.StaticApplicationContext; import org.springframework.core.task.TaskExecutor; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.tests.EnabledForTestGroups; import org.springframework.tests.sample.beans.TestBean; import static org.assertj.core.api.Assertions.assertThat; @@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * @author Juergen Hoeller diff --git a/spring-context-support/src/test/java/org/springframework/validation/beanvalidation2/SpringValidatorAdapterTests.java b/spring-context-support/src/test/java/org/springframework/validation/beanvalidation2/SpringValidatorAdapterTests.java index 7639b6704b4..deb14733357 100644 --- a/spring-context-support/src/test/java/org/springframework/validation/beanvalidation2/SpringValidatorAdapterTests.java +++ b/spring-context-support/src/test/java/org/springframework/validation/beanvalidation2/SpringValidatorAdapterTests.java @@ -52,8 +52,8 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.BeanWrapper; import org.springframework.beans.BeanWrapperImpl; import org.springframework.context.support.StaticMessageSource; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.util.ObjectUtils; -import org.springframework.util.SerializationTestUtils; import org.springframework.validation.BeanPropertyBindingResult; import org.springframework.validation.FieldError; import org.springframework.validation.beanvalidation.SpringValidatorAdapter; diff --git a/spring-context/spring-context.gradle b/spring-context/spring-context.gradle index 54ee48da69a..0894c8d55f0 100644 --- a/spring-context/spring-context.gradle +++ b/spring-context/spring-context.gradle @@ -26,6 +26,7 @@ dependencies { optional("org.jetbrains.kotlin:kotlin-reflect") optional("org.jetbrains.kotlin:kotlin-stdlib") optional("org.reactivestreams:reactive-streams") + testCompile(testFixtures(project(":spring-core"))) testCompile("io.projectreactor:reactor-core") testCompile("org.codehaus.groovy:groovy-jsr223") testCompile("org.codehaus.groovy:groovy-test") diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java index 341b25f3eb9..8c88ad34b78 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java @@ -50,10 +50,10 @@ import org.springframework.core.NestedRuntimeException; import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; import org.springframework.core.io.ClassPathResource; +import org.springframework.core.test.fixtures.Assume; +import org.springframework.core.test.fixtures.EnabledForTestGroups; +import org.springframework.core.test.fixtures.TestGroup; import org.springframework.lang.Nullable; -import org.springframework.tests.Assume; -import org.springframework.tests.EnabledForTestGroups; -import org.springframework.tests.TestGroup; import org.springframework.tests.sample.beans.INestedTestBean; import org.springframework.tests.sample.beans.ITestBean; import org.springframework.tests.sample.beans.NestedTestBean; diff --git a/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java b/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java index b5b151c0833..8fb952e12f0 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java @@ -57,10 +57,11 @@ import org.springframework.aop.support.Pointcuts; import org.springframework.aop.support.StaticMethodMatcherPointcutAdvisor; import org.springframework.aop.target.HotSwappableTargetSource; import org.springframework.aop.target.SingletonTargetSource; +import org.springframework.core.test.fixtures.EnabledForTestGroups; +import org.springframework.core.test.fixtures.TestGroup; +import org.springframework.core.test.fixtures.TimeStamped; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.lang.Nullable; -import org.springframework.tests.EnabledForTestGroups; -import org.springframework.tests.TestGroup; -import org.springframework.tests.TimeStamped; import org.springframework.tests.aop.advice.CountingAfterReturningAdvice; import org.springframework.tests.aop.advice.CountingBeforeAdvice; import org.springframework.tests.aop.advice.MethodCounter; @@ -73,7 +74,6 @@ import org.springframework.tests.sample.beans.ITestBean; import org.springframework.tests.sample.beans.Person; import org.springframework.tests.sample.beans.SerializablePerson; import org.springframework.tests.sample.beans.TestBean; -import org.springframework.util.SerializationTestUtils; import org.springframework.util.StopWatch; import static org.assertj.core.api.Assertions.assertThat; @@ -765,7 +765,7 @@ public abstract class AbstractAopProxyTests { @SuppressWarnings("serial") class MyDi extends DelegatingIntroductionInterceptor implements TimeStamped { /** - * @see test.util.TimeStamped#getTimeStamp() + * @see org.springframework.core.test.fixtures.util.TimeStamped#getTimeStamp() */ @Override public long getTimeStamp() { diff --git a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java index a026401340c..24c744ccba7 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java @@ -48,8 +48,9 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.ApplicationListener; import org.springframework.context.TestListener; import org.springframework.core.io.ClassPathResource; +import org.springframework.core.test.fixtures.TimeStamped; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.lang.Nullable; -import org.springframework.tests.TimeStamped; import org.springframework.tests.aop.advice.CountingBeforeAdvice; import org.springframework.tests.aop.advice.MyThrowsHandler; import org.springframework.tests.aop.interceptor.NopInterceptor; @@ -58,7 +59,6 @@ import org.springframework.tests.sample.beans.ITestBean; import org.springframework.tests.sample.beans.Person; import org.springframework.tests.sample.beans.SideEffectBean; import org.springframework.tests.sample.beans.TestBean; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorTests.java b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorTests.java index 1e1ba357f80..1af446bf16f 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorTests.java @@ -26,7 +26,7 @@ import org.springframework.aop.support.AopUtils; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.FactoryBean; import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.springframework.tests.TimeStamped; +import org.springframework.core.test.fixtures.TimeStamped; import org.springframework.tests.aop.advice.CountingBeforeAdvice; import org.springframework.tests.aop.interceptor.NopInterceptor; import org.springframework.tests.sample.beans.ITestBean; diff --git a/spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java b/spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java index ff966c8f9e3..82e9f010043 100644 --- a/spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java +++ b/spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java @@ -27,10 +27,10 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.support.GenericApplicationContext; import org.springframework.core.io.ClassPathResource; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.tests.context.SimpleMapScope; import org.springframework.tests.sample.beans.ITestBean; import org.springframework.tests.sample.beans.TestBean; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-context/src/test/java/org/springframework/aop/target/CommonsPool2TargetSourceTests.java b/spring-context/src/test/java/org/springframework/aop/target/CommonsPool2TargetSourceTests.java index df0cec9921f..beb840ae6ca 100644 --- a/spring-context/src/test/java/org/springframework/aop/target/CommonsPool2TargetSourceTests.java +++ b/spring-context/src/test/java/org/springframework/aop/target/CommonsPool2TargetSourceTests.java @@ -27,10 +27,10 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.support.StaticApplicationContext; import org.springframework.core.io.ClassPathResource; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.tests.sample.beans.Person; import org.springframework.tests.sample.beans.SerializablePerson; import org.springframework.tests.sample.beans.SideEffectBean; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java index f273716e553..d820baa1356 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java @@ -55,6 +55,7 @@ import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.UrlResource; import org.springframework.core.io.support.EncodedResource; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.tests.sample.beans.DependenciesBean; import org.springframework.tests.sample.beans.DerivedTestBean; import org.springframework.tests.sample.beans.ITestBean; @@ -64,7 +65,6 @@ import org.springframework.tests.sample.beans.TestBean; import org.springframework.tests.sample.beans.factory.DummyFactory; import org.springframework.util.ClassUtils; import org.springframework.util.FileCopyUtils; -import org.springframework.util.SerializationTestUtils; import org.springframework.util.StopWatch; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java index db76843b48a..bf789c11205 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java @@ -34,13 +34,13 @@ import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.support.GenericApplicationContext; -import org.springframework.tests.Assume; -import org.springframework.tests.EnabledForTestGroups; +import org.springframework.core.test.fixtures.Assume; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.tests.sample.beans.ITestBean; import org.springframework.tests.sample.beans.TestBean; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * @author Juergen Hoeller diff --git a/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java b/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java index 646393f0d1f..96b9d1f7874 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java @@ -37,13 +37,13 @@ import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.support.GenericApplicationContext; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.jndi.support.SimpleJndiBeanFactory; import org.springframework.tests.mock.jndi.ExpectedLookupTemplate; import org.springframework.tests.sample.beans.INestedTestBean; import org.springframework.tests.sample.beans.ITestBean; import org.springframework.tests.sample.beans.NestedTestBean; import org.springframework.tests.sample.beans.TestBean; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanAnnotationIntegrationTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanAnnotationIntegrationTests.java index 86b60772928..4f13113e52f 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanAnnotationIntegrationTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanAnnotationIntegrationTests.java @@ -55,11 +55,11 @@ import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.Environment; import org.springframework.core.env.Profiles; import org.springframework.core.io.ResourceLoader; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.core.type.classreading.MetadataReader; import org.springframework.core.type.classreading.MetadataReaderFactory; import org.springframework.core.type.filter.TypeFilter; import org.springframework.tests.context.SimpleMapScope; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.springframework.beans.factory.support.BeanDefinitionBuilder.genericBeanDefinition; diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserScopedProxyTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserScopedProxyTests.java index 67480997a35..4c3f6baef11 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserScopedProxyTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserScopedProxyTests.java @@ -23,8 +23,8 @@ import org.junit.jupiter.api.Test; import org.springframework.aop.support.AopUtils; import org.springframework.beans.factory.parsing.BeanDefinitionParsingException; import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.tests.context.SimpleMapScope; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java b/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java index adf27cd2db6..0c1e65b76f8 100644 --- a/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java +++ b/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java @@ -51,15 +51,15 @@ import org.springframework.core.convert.support.GenericConversionService; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.core.io.support.EncodedResource; -import org.springframework.tests.Assume; -import org.springframework.tests.EnabledForTestGroups; +import org.springframework.core.test.fixtures.Assume; +import org.springframework.core.test.fixtures.EnabledForTestGroups; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.tests.sample.beans.TestBean; import org.springframework.util.FileCopyUtils; -import org.springframework.util.SerializationTestUtils; import org.springframework.util.StopWatch; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * @author Juergen Hoeller diff --git a/spring-context/src/test/java/org/springframework/context/expression/EnvironmentAccessorIntegrationTests.java b/spring-context/src/test/java/org/springframework/context/expression/EnvironmentAccessorIntegrationTests.java index 5f4600e82a4..a68066125eb 100644 --- a/spring-context/src/test/java/org/springframework/context/expression/EnvironmentAccessorIntegrationTests.java +++ b/spring-context/src/test/java/org/springframework/context/expression/EnvironmentAccessorIntegrationTests.java @@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.GenericApplicationContext; -import org.springframework.mock.env.MockPropertySource; +import org.springframework.core.test.fixtures.env.MockPropertySource; import org.springframework.tests.sample.beans.TestBean; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-context/src/test/java/org/springframework/context/support/DefaultLifecycleProcessorTests.java b/spring-context/src/test/java/org/springframework/context/support/DefaultLifecycleProcessorTests.java index 6538d05bc5f..f24be678c73 100644 --- a/spring-context/src/test/java/org/springframework/context/support/DefaultLifecycleProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/DefaultLifecycleProcessorTests.java @@ -27,10 +27,10 @@ import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.Lifecycle; import org.springframework.context.LifecycleProcessor; import org.springframework.context.SmartLifecycle; -import org.springframework.tests.EnabledForTestGroups; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * @author Mark Fisher diff --git a/spring-context/src/test/java/org/springframework/context/support/EnvironmentSecurityManagerIntegrationTests.java b/spring-context/src/test/java/org/springframework/context/support/EnvironmentSecurityManagerIntegrationTests.java index 584f242e7d9..190ba795821 100644 --- a/spring-context/src/test/java/org/springframework/context/support/EnvironmentSecurityManagerIntegrationTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/EnvironmentSecurityManagerIntegrationTests.java @@ -28,13 +28,12 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.context.annotation.AnnotatedBeanDefinitionReader; import org.springframework.context.annotation.Profile; import org.springframework.core.env.AbstractEnvironment; -import org.springframework.core.env.StandardEnvironmentTests; +import org.springframework.core.test.fixtures.env.EnvironmentTestUtils; import org.springframework.stereotype.Component; import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; - /** * Tests integration between Environment and SecurityManagers. See SPR-9970. * @@ -50,7 +49,7 @@ public class EnvironmentSecurityManagerIntegrationTests { @BeforeEach public void setUp() { originalSecurityManager = System.getSecurityManager(); - env = StandardEnvironmentTests.getModifiableSystemEnvironment(); + env = EnvironmentTestUtils.getModifiableSystemEnvironment(); env.put(AbstractEnvironment.ACTIVE_PROFILES_PROPERTY_NAME, "p1"); } diff --git a/spring-context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java b/spring-context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java index c08b49210eb..fb1f12ac195 100644 --- a/spring-context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java +++ b/spring-context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java @@ -29,8 +29,8 @@ import org.springframework.core.env.PropertySource; import org.springframework.core.env.StandardEnvironment; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; +import org.springframework.core.test.fixtures.env.MockPropertySource; import org.springframework.mock.env.MockEnvironment; -import org.springframework.mock.env.MockPropertySource; import org.springframework.tests.sample.beans.TestBean; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-context/src/test/java/org/springframework/mock/env/MockEnvironment.java b/spring-context/src/test/java/org/springframework/mock/env/MockEnvironment.java index f518bd40c86..bb23db28d4a 100644 --- a/spring-context/src/test/java/org/springframework/mock/env/MockEnvironment.java +++ b/spring-context/src/test/java/org/springframework/mock/env/MockEnvironment.java @@ -18,6 +18,7 @@ package org.springframework.mock.env; import org.springframework.core.env.AbstractEnvironment; import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.core.test.fixtures.env.MockPropertySource; /** * Simple {@link ConfigurableEnvironment} implementation exposing diff --git a/spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java b/spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java index 6911a0b37e0..6a155d4cc89 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java @@ -26,16 +26,16 @@ import org.junit.jupiter.api.Test; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.scheduling.config.IntervalTask; import org.springframework.scheduling.config.ScheduledTaskHolder; import org.springframework.scheduling.config.ScheduledTaskRegistrar; import org.springframework.scheduling.config.TaskManagementConfigUtils; -import org.springframework.tests.EnabledForTestGroups; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * Tests use of @EnableScheduling on @Configuration classes. diff --git a/spring-context/src/test/java/org/springframework/scheduling/concurrent/ScheduledExecutorFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/scheduling/concurrent/ScheduledExecutorFactoryBeanTests.java index cb3099cccec..c35995d0f6b 100644 --- a/spring-context/src/test/java/org/springframework/scheduling/concurrent/ScheduledExecutorFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/scheduling/concurrent/ScheduledExecutorFactoryBeanTests.java @@ -23,7 +23,7 @@ import java.util.concurrent.ThreadFactory; import org.junit.jupiter.api.Test; import org.springframework.core.task.NoOpRunnable; -import org.springframework.tests.EnabledForTestGroups; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; @@ -32,7 +32,7 @@ import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * @author Rick Evans diff --git a/spring-context/src/test/java/org/springframework/scripting/support/ScriptFactoryPostProcessorTests.java b/spring-context/src/test/java/org/springframework/scripting/support/ScriptFactoryPostProcessorTests.java index 88adb4e7bdf..65c9bfdb5e6 100644 --- a/spring-context/src/test/java/org/springframework/scripting/support/ScriptFactoryPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/scripting/support/ScriptFactoryPostProcessorTests.java @@ -24,16 +24,16 @@ import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.support.GenericApplicationContext; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.scripting.Messenger; import org.springframework.scripting.ScriptCompilationException; import org.springframework.scripting.groovy.GroovyScriptFactory; -import org.springframework.tests.EnabledForTestGroups; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; import static org.mockito.Mockito.mock; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * @author Rick Evans diff --git a/spring-context/src/test/java/org/springframework/validation/beanvalidation/SpringValidatorAdapterTests.java b/spring-context/src/test/java/org/springframework/validation/beanvalidation/SpringValidatorAdapterTests.java index 4e7eaf4d09f..0145e155b78 100644 --- a/spring-context/src/test/java/org/springframework/validation/beanvalidation/SpringValidatorAdapterTests.java +++ b/spring-context/src/test/java/org/springframework/validation/beanvalidation/SpringValidatorAdapterTests.java @@ -50,8 +50,8 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.BeanWrapper; import org.springframework.beans.BeanWrapperImpl; import org.springframework.context.support.StaticMessageSource; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.util.ObjectUtils; -import org.springframework.util.SerializationTestUtils; import org.springframework.validation.BeanPropertyBindingResult; import org.springframework.validation.FieldError; diff --git a/spring-context/src/test/kotlin/org/springframework/context/support/BeanDefinitionDslTests.kt b/spring-context/src/test/kotlin/org/springframework/context/support/BeanDefinitionDslTests.kt index f54c7c94625..d9fc98990ae 100644 --- a/spring-context/src/test/kotlin/org/springframework/context/support/BeanDefinitionDslTests.kt +++ b/spring-context/src/test/kotlin/org/springframework/context/support/BeanDefinitionDslTests.kt @@ -25,7 +25,7 @@ import org.springframework.beans.factory.getBean import org.springframework.context.support.BeanDefinitionDsl.* import org.springframework.core.env.SimpleCommandLinePropertySource import org.springframework.core.env.get -import org.springframework.mock.env.MockPropertySource +import org.springframework.core.test.fixtures.env.MockPropertySource import java.util.stream.Collectors @Suppress("UNUSED_EXPRESSION") diff --git a/spring-core/spring-core.gradle b/spring-core/spring-core.gradle index 48fd9976b50..a84b8e75370 100644 --- a/spring-core/spring-core.gradle +++ b/spring-core/spring-core.gradle @@ -60,6 +60,12 @@ dependencies { testCompile("javax.xml.bind:jaxb-api") testCompile("com.fasterxml.woodstox:woodstox-core") testCompile(project(":kotlin-coroutines")) + testFixturesApi("org.junit.jupiter:junit-jupiter-api") + testFixturesApi("org.junit.jupiter:junit-jupiter-params") + testFixturesImplementation("com.google.code.findbugs:jsr305") + testFixturesImplementation("io.projectreactor:reactor-test") + testFixturesImplementation("org.assertj:assertj-core") + testFixturesImplementation("org.xmlunit:xmlunit-assertj") } jar { diff --git a/spring-core/src/test/java/example/type/AspectJTypeFilterTestsTypes.java b/spring-core/src/test/java/example/type/AspectJTypeFilterTestsTypes.java index d4151647525..bf17886f9b7 100644 --- a/spring-core/src/test/java/example/type/AspectJTypeFilterTestsTypes.java +++ b/spring-core/src/test/java/example/type/AspectJTypeFilterTestsTypes.java @@ -16,7 +16,7 @@ package example.type; -import org.springframework.stereotype.Component; +import org.springframework.core.test.fixtures.stereotype.Component; /** * We must use a standalone set of types to ensure that no one else is loading diff --git a/spring-core/src/test/java/org/springframework/core/annotation/AnnotatedElementUtilsTests.java b/spring-core/src/test/java/org/springframework/core/annotation/AnnotatedElementUtilsTests.java index 1b1bc2b0f98..0aca2ed6077 100644 --- a/spring-core/src/test/java/org/springframework/core/annotation/AnnotatedElementUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/core/annotation/AnnotatedElementUtilsTests.java @@ -42,10 +42,10 @@ import org.springframework.core.annotation.AnnotationUtilsTests.ExtendsBaseClass import org.springframework.core.annotation.AnnotationUtilsTests.ImplementsInterfaceWithGenericAnnotatedMethod; import org.springframework.core.annotation.AnnotationUtilsTests.WebController; import org.springframework.core.annotation.AnnotationUtilsTests.WebMapping; +import org.springframework.core.test.fixtures.stereotype.Component; +import org.springframework.core.test.fixtures.stereotype.Indexed; import org.springframework.lang.NonNullApi; import org.springframework.lang.Nullable; -import org.springframework.stereotype.Component; -import org.springframework.stereotype.Indexed; import org.springframework.util.MultiValueMap; import static java.util.Arrays.asList; diff --git a/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java b/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java index 6270f108841..78ec17e6b8c 100644 --- a/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java @@ -39,8 +39,8 @@ import org.junit.jupiter.api.Test; import org.springframework.core.Ordered; import org.springframework.core.annotation.subpackage.NonPublicAnnotatedClass; +import org.springframework.core.test.fixtures.stereotype.Component; import org.springframework.lang.NonNullApi; -import org.springframework.stereotype.Component; import static java.util.Arrays.asList; import static java.util.Arrays.stream; @@ -928,7 +928,7 @@ class AnnotationUtilsTests { Map map = Collections.singletonMap(VALUE, 42L); assertThatIllegalStateException().isThrownBy(() -> synthesizeAnnotation(map, Component.class, null).value()) - .withMessageContaining("Attribute 'value' in annotation org.springframework.stereotype.Component " + .withMessageContaining("Attribute 'value' in annotation org.springframework.core.test.fixtures.stereotype.Component " + "should be compatible with java.lang.String but a java.lang.Long value was returned"); } diff --git a/spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsTests.java b/spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsTests.java index 6241039c40f..956f93f549a 100644 --- a/spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsTests.java +++ b/spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsTests.java @@ -43,9 +43,9 @@ import org.springframework.core.Ordered; import org.springframework.core.annotation.MergedAnnotation.Adapt; import org.springframework.core.annotation.MergedAnnotations.SearchStrategy; import org.springframework.core.annotation.subpackage.NonPublicAnnotatedClass; +import org.springframework.core.test.fixtures.stereotype.Component; +import org.springframework.core.test.fixtures.stereotype.Indexed; import org.springframework.lang.Nullable; -import org.springframework.stereotype.Component; -import org.springframework.stereotype.Indexed; import org.springframework.util.ClassUtils; import org.springframework.util.MultiValueMap; import org.springframework.util.ReflectionUtils; @@ -1770,7 +1770,7 @@ class MergedAnnotationsTests { MergedAnnotation annotation = MergedAnnotation.of(Component.class, map); assertThatIllegalStateException().isThrownBy(() -> annotation.synthesize().value()) .withMessage("Attribute 'value' in annotation " + - "org.springframework.stereotype.Component should be " + + "org.springframework.core.test.fixtures.stereotype.Component should be " + "compatible with java.lang.String but a java.lang.Long value was returned"); } diff --git a/spring-core/src/test/java/org/springframework/core/codec/ByteArrayDecoderTests.java b/spring-core/src/test/java/org/springframework/core/codec/ByteArrayDecoderTests.java index 1eb50b011b9..c41874ef083 100644 --- a/spring-core/src/test/java/org/springframework/core/codec/ByteArrayDecoderTests.java +++ b/spring-core/src/test/java/org/springframework/core/codec/ByteArrayDecoderTests.java @@ -24,6 +24,7 @@ import reactor.core.publisher.Flux; import org.springframework.core.ResolvableType; import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.test.fixtures.codec.AbstractDecoderTests; import org.springframework.util.MimeTypeUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-core/src/test/java/org/springframework/core/codec/ByteArrayEncoderTests.java b/spring-core/src/test/java/org/springframework/core/codec/ByteArrayEncoderTests.java index 2c44c1a8381..12d40d64aad 100644 --- a/spring-core/src/test/java/org/springframework/core/codec/ByteArrayEncoderTests.java +++ b/spring-core/src/test/java/org/springframework/core/codec/ByteArrayEncoderTests.java @@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import org.springframework.core.ResolvableType; +import org.springframework.core.test.fixtures.codec.AbstractEncoderTests; import org.springframework.util.MimeTypeUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-core/src/test/java/org/springframework/core/codec/ByteBufferDecoderTests.java b/spring-core/src/test/java/org/springframework/core/codec/ByteBufferDecoderTests.java index 2563ff8c9fa..1d0215ee58e 100644 --- a/spring-core/src/test/java/org/springframework/core/codec/ByteBufferDecoderTests.java +++ b/spring-core/src/test/java/org/springframework/core/codec/ByteBufferDecoderTests.java @@ -25,6 +25,7 @@ import reactor.core.publisher.Flux; import org.springframework.core.ResolvableType; import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.test.fixtures.codec.AbstractDecoderTests; import org.springframework.util.MimeTypeUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-core/src/test/java/org/springframework/core/codec/ByteBufferEncoderTests.java b/spring-core/src/test/java/org/springframework/core/codec/ByteBufferEncoderTests.java index aa18e0e1ecf..066aa9051d9 100644 --- a/spring-core/src/test/java/org/springframework/core/codec/ByteBufferEncoderTests.java +++ b/spring-core/src/test/java/org/springframework/core/codec/ByteBufferEncoderTests.java @@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import org.springframework.core.ResolvableType; +import org.springframework.core.test.fixtures.codec.AbstractEncoderTests; import org.springframework.util.MimeTypeUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-core/src/test/java/org/springframework/core/codec/CharSequenceEncoderTests.java b/spring-core/src/test/java/org/springframework/core/codec/CharSequenceEncoderTests.java index c0a85d0816c..6356dfc810e 100644 --- a/spring-core/src/test/java/org/springframework/core/codec/CharSequenceEncoderTests.java +++ b/spring-core/src/test/java/org/springframework/core/codec/CharSequenceEncoderTests.java @@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import org.springframework.core.ResolvableType; +import org.springframework.core.test.fixtures.codec.AbstractEncoderTests; import org.springframework.util.MimeTypeUtils; import static java.nio.charset.StandardCharsets.ISO_8859_1; diff --git a/spring-core/src/test/java/org/springframework/core/codec/DataBufferDecoderTests.java b/spring-core/src/test/java/org/springframework/core/codec/DataBufferDecoderTests.java index efde8b15eb7..ec0ccdda086 100644 --- a/spring-core/src/test/java/org/springframework/core/codec/DataBufferDecoderTests.java +++ b/spring-core/src/test/java/org/springframework/core/codec/DataBufferDecoderTests.java @@ -25,6 +25,7 @@ import reactor.core.publisher.Flux; import org.springframework.core.ResolvableType; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferUtils; +import org.springframework.core.test.fixtures.codec.AbstractDecoderTests; import org.springframework.util.MimeTypeUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-core/src/test/java/org/springframework/core/codec/DataBufferEncoderTests.java b/spring-core/src/test/java/org/springframework/core/codec/DataBufferEncoderTests.java index c9322af3c7e..cb6242c7182 100644 --- a/spring-core/src/test/java/org/springframework/core/codec/DataBufferEncoderTests.java +++ b/spring-core/src/test/java/org/springframework/core/codec/DataBufferEncoderTests.java @@ -24,6 +24,7 @@ import reactor.core.publisher.Mono; import org.springframework.core.ResolvableType; import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.test.fixtures.codec.AbstractEncoderTests; import org.springframework.util.MimeTypeUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-core/src/test/java/org/springframework/core/codec/ResourceDecoderTests.java b/spring-core/src/test/java/org/springframework/core/codec/ResourceDecoderTests.java index f05b34fbbbb..409d9c693e9 100644 --- a/spring-core/src/test/java/org/springframework/core/codec/ResourceDecoderTests.java +++ b/spring-core/src/test/java/org/springframework/core/codec/ResourceDecoderTests.java @@ -28,6 +28,7 @@ import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.InputStreamResource; import org.springframework.core.io.Resource; import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.test.fixtures.codec.AbstractDecoderTests; import org.springframework.util.MimeTypeUtils; import org.springframework.util.StreamUtils; diff --git a/spring-core/src/test/java/org/springframework/core/codec/ResourceEncoderTests.java b/spring-core/src/test/java/org/springframework/core/codec/ResourceEncoderTests.java index 193c705a7ad..b99bcb3812c 100644 --- a/spring-core/src/test/java/org/springframework/core/codec/ResourceEncoderTests.java +++ b/spring-core/src/test/java/org/springframework/core/codec/ResourceEncoderTests.java @@ -28,6 +28,7 @@ import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.InputStreamResource; import org.springframework.core.io.Resource; import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.test.fixtures.codec.AbstractEncoderTests; import org.springframework.lang.Nullable; import org.springframework.util.MimeType; import org.springframework.util.MimeTypeUtils; diff --git a/spring-core/src/test/java/org/springframework/core/codec/ResourceRegionEncoderTests.java b/spring-core/src/test/java/org/springframework/core/codec/ResourceRegionEncoderTests.java index ce83d5bebdf..8148ecf64e0 100644 --- a/spring-core/src/test/java/org/springframework/core/codec/ResourceRegionEncoderTests.java +++ b/spring-core/src/test/java/org/springframework/core/codec/ResourceRegionEncoderTests.java @@ -29,11 +29,11 @@ import reactor.test.StepVerifier; import org.springframework.core.ResolvableType; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; -import org.springframework.core.io.buffer.AbstractLeakCheckingTests; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferUtils; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; import org.springframework.core.io.support.ResourceRegion; +import org.springframework.core.test.fixtures.io.buffer.AbstractLeakCheckingTests; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import org.springframework.util.MimeType; import org.springframework.util.MimeTypeUtils; diff --git a/spring-core/src/test/java/org/springframework/core/codec/StringDecoderTests.java b/spring-core/src/test/java/org/springframework/core/codec/StringDecoderTests.java index a17ae084c2f..bcfc43b498f 100644 --- a/spring-core/src/test/java/org/springframework/core/codec/StringDecoderTests.java +++ b/spring-core/src/test/java/org/springframework/core/codec/StringDecoderTests.java @@ -30,6 +30,7 @@ import reactor.test.StepVerifier; import org.springframework.core.ResolvableType; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferLimitException; +import org.springframework.core.test.fixtures.codec.AbstractDecoderTests; import org.springframework.util.MimeType; import org.springframework.util.MimeTypeUtils; diff --git a/spring-core/src/test/java/org/springframework/core/convert/converter/DefaultConversionServiceTests.java b/spring-core/src/test/java/org/springframework/core/convert/converter/DefaultConversionServiceTests.java index 8deb6d3f3cf..f5a932bacbd 100644 --- a/spring-core/src/test/java/org/springframework/core/convert/converter/DefaultConversionServiceTests.java +++ b/spring-core/src/test/java/org/springframework/core/convert/converter/DefaultConversionServiceTests.java @@ -51,13 +51,13 @@ import org.springframework.core.convert.ConversionFailedException; import org.springframework.core.convert.ConverterNotFoundException; import org.springframework.core.convert.TypeDescriptor; import org.springframework.core.convert.support.DefaultConversionService; -import org.springframework.tests.EnabledForTestGroups; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.util.ClassUtils; import org.springframework.util.StopWatch; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * Unit tests for {@link DefaultConversionService}. diff --git a/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java b/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java index a91c64bb320..fd2271d26f6 100644 --- a/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java +++ b/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java @@ -43,8 +43,8 @@ import org.springframework.core.convert.converter.ConverterFactory; import org.springframework.core.convert.converter.GenericConverter; import org.springframework.core.io.DescriptiveResource; import org.springframework.core.io.Resource; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.lang.Nullable; -import org.springframework.tests.EnabledForTestGroups; import org.springframework.util.StopWatch; import org.springframework.util.StringUtils; @@ -54,7 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * Unit tests for {@link GenericConversionService}. diff --git a/spring-core/src/test/java/org/springframework/core/env/MutablePropertySourcesTests.java b/spring-core/src/test/java/org/springframework/core/env/MutablePropertySourcesTests.java index fa79f180440..9d04dcbd246 100644 --- a/spring-core/src/test/java/org/springframework/core/env/MutablePropertySourcesTests.java +++ b/spring-core/src/test/java/org/springframework/core/env/MutablePropertySourcesTests.java @@ -20,7 +20,7 @@ import java.util.Iterator; import org.junit.jupiter.api.Test; -import org.springframework.mock.env.MockPropertySource; +import org.springframework.core.test.fixtures.env.MockPropertySource; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/spring-core/src/test/java/org/springframework/core/env/PropertySourcesPropertyResolverTests.java b/spring-core/src/test/java/org/springframework/core/env/PropertySourcesPropertyResolverTests.java index d3eaa2804fb..bed53fce1f4 100644 --- a/spring-core/src/test/java/org/springframework/core/env/PropertySourcesPropertyResolverTests.java +++ b/spring-core/src/test/java/org/springframework/core/env/PropertySourcesPropertyResolverTests.java @@ -24,7 +24,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.core.convert.ConverterNotFoundException; -import org.springframework.mock.env.MockPropertySource; +import org.springframework.core.test.fixtures.env.MockPropertySource; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/spring-core/src/test/java/org/springframework/core/env/StandardEnvironmentTests.java b/spring-core/src/test/java/org/springframework/core/env/StandardEnvironmentTests.java index f7218b9c48b..24bb7143ebe 100644 --- a/spring-core/src/test/java/org/springframework/core/env/StandardEnvironmentTests.java +++ b/spring-core/src/test/java/org/springframework/core/env/StandardEnvironmentTests.java @@ -16,17 +16,16 @@ package org.springframework.core.env; -import java.lang.reflect.Field; import java.security.AccessControlException; import java.security.Permission; import java.util.Arrays; -import java.util.Collections; import java.util.Map; import org.junit.jupiter.api.Test; import org.springframework.core.SpringProperties; -import org.springframework.mock.env.MockPropertySource; +import org.springframework.core.test.fixtures.env.EnvironmentTestUtils; +import org.springframework.core.test.fixtures.env.MockPropertySource; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; @@ -465,8 +464,8 @@ public class StandardEnvironmentTests { @Test void getSystemEnvironment_withAndWithoutSecurityManager() { - getModifiableSystemEnvironment().put(ALLOWED_PROPERTY_NAME, ALLOWED_PROPERTY_VALUE); - getModifiableSystemEnvironment().put(DISALLOWED_PROPERTY_NAME, DISALLOWED_PROPERTY_VALUE); + EnvironmentTestUtils.getModifiableSystemEnvironment().put(ALLOWED_PROPERTY_NAME, ALLOWED_PROPERTY_VALUE); + EnvironmentTestUtils.getModifiableSystemEnvironment().put(DISALLOWED_PROPERTY_NAME, DISALLOWED_PROPERTY_VALUE); { Map systemEnvironment = environment.getSystemEnvironment(); @@ -500,68 +499,8 @@ public class StandardEnvironmentTests { } System.setSecurityManager(oldSecurityManager); - getModifiableSystemEnvironment().remove(ALLOWED_PROPERTY_NAME); - getModifiableSystemEnvironment().remove(DISALLOWED_PROPERTY_NAME); - } - - - @SuppressWarnings("unchecked") - public static Map getModifiableSystemEnvironment() { - // for os x / linux - Class[] classes = Collections.class.getDeclaredClasses(); - Map env = System.getenv(); - for (Class cl : classes) { - if ("java.util.Collections$UnmodifiableMap".equals(cl.getName())) { - try { - Field field = cl.getDeclaredField("m"); - field.setAccessible(true); - Object obj = field.get(env); - if (obj != null && obj.getClass().getName().equals("java.lang.ProcessEnvironment$StringEnvironment")) { - return (Map) obj; - } - } - catch (Exception ex) { - throw new RuntimeException(ex); - } - } - } - - // for windows - Class processEnvironmentClass; - try { - processEnvironmentClass = Class.forName("java.lang.ProcessEnvironment"); - } - catch (Exception ex) { - throw new IllegalStateException(ex); - } - - try { - Field theCaseInsensitiveEnvironmentField = processEnvironmentClass.getDeclaredField("theCaseInsensitiveEnvironment"); - theCaseInsensitiveEnvironmentField.setAccessible(true); - Object obj = theCaseInsensitiveEnvironmentField.get(null); - return (Map) obj; - } - catch (NoSuchFieldException ex) { - // do nothing - } - catch (Exception ex) { - throw new IllegalStateException(ex); - } - - try { - Field theEnvironmentField = processEnvironmentClass.getDeclaredField("theEnvironment"); - theEnvironmentField.setAccessible(true); - Object obj = theEnvironmentField.get(null); - return (Map) obj; - } - catch (NoSuchFieldException ex) { - // do nothing - } - catch (Exception ex) { - throw new IllegalStateException(ex); - } - - throw new IllegalStateException(); + EnvironmentTestUtils.getModifiableSystemEnvironment().remove(ALLOWED_PROPERTY_NAME); + EnvironmentTestUtils.getModifiableSystemEnvironment().remove(DISALLOWED_PROPERTY_NAME); } } diff --git a/spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferTests.java b/spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferTests.java index f39c87d445e..2d006cd45a7 100644 --- a/spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferTests.java +++ b/spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferTests.java @@ -22,6 +22,8 @@ import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.Arrays; +import org.springframework.core.test.fixtures.io.buffer.AbstractDataBufferAllocatingTests; + import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferUtilsTests.java b/spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferUtilsTests.java index 27067179cdc..168a6df23e8 100644 --- a/spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferUtilsTests.java @@ -45,7 +45,8 @@ import reactor.test.StepVerifier; import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.test.fixtures.io.buffer.AbstractDataBufferAllocatingTests; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; diff --git a/spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBufferFactoryTests.java b/spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBufferFactoryTests.java index ef329ea62bb..37d941dde6f 100644 --- a/spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBufferFactoryTests.java +++ b/spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBufferFactoryTests.java @@ -18,6 +18,8 @@ package org.springframework.core.io.buffer; import org.junit.jupiter.api.Test; +import org.springframework.core.test.fixtures.io.buffer.LeakAwareDataBufferFactory; + import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.springframework.core.io.buffer.DataBufferUtils.release; diff --git a/spring-core/src/test/java/org/springframework/core/io/buffer/support/DataBufferTestUtilsTests.java b/spring-core/src/test/java/org/springframework/core/io/buffer/support/DataBufferTestUtilsTests.java index 5100feb3ffc..576df265588 100644 --- a/spring-core/src/test/java/org/springframework/core/io/buffer/support/DataBufferTestUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/core/io/buffer/support/DataBufferTestUtilsTests.java @@ -18,9 +18,10 @@ package org.springframework.core.io.buffer.support; import java.nio.charset.StandardCharsets; -import org.springframework.core.io.buffer.AbstractDataBufferAllocatingTests; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferFactory; +import org.springframework.core.test.fixtures.io.buffer.AbstractDataBufferAllocatingTests; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-core/src/test/java/org/springframework/tests/TestGroupTests.java b/spring-core/src/test/java/org/springframework/core/test/fixtures/TestGroupParsingTests.java similarity index 95% rename from spring-core/src/test/java/org/springframework/tests/TestGroupTests.java rename to spring-core/src/test/java/org/springframework/core/test/fixtures/TestGroupParsingTests.java index 5377c4b5f74..097fd19c8c7 100644 --- a/spring-core/src/test/java/org/springframework/tests/TestGroupTests.java +++ b/spring-core/src/test/java/org/springframework/core/test/fixtures/TestGroupParsingTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.tests; +package org.springframework.core.test.fixtures; import java.util.Collections; import java.util.EnumSet; @@ -26,12 +26,12 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; /** - * Tests for {@link TestGroup}. + * Tests for {@link TestGroup} parsing. * * @author Phillip Webb * @author Sam Brannen */ -class TestGroupTests { +class TestGroupParsingTests { @Test void parseNull() { diff --git a/spring-core/src/test/java/org/springframework/tests/AssumeTests.java b/spring-core/src/test/java/org/springframework/core/test/fixtures/TestGroupTests.java similarity index 76% rename from spring-core/src/test/java/org/springframework/tests/AssumeTests.java rename to spring-core/src/test/java/org/springframework/core/test/fixtures/TestGroupTests.java index f077ffe6170..84eda4984c5 100644 --- a/spring-core/src/test/java/org/springframework/tests/AssumeTests.java +++ b/spring-core/src/test/java/org/springframework/core/test/fixtures/TestGroupTests.java @@ -14,9 +14,10 @@ * limitations under the License. */ -package org.springframework.tests; +package org.springframework.core.test.fixtures; import java.util.Arrays; +import java.util.Set; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -28,17 +29,20 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.springframework.tests.Assume.TEST_GROUPS_SYSTEM_PROPERTY; -import static org.springframework.tests.TestGroup.LONG_RUNNING; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.junit.jupiter.api.Assumptions.assumeTrue; +import static org.springframework.core.test.fixtures.TestGroup.LONG_RUNNING; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** - * Tests for {@link Assume}. + * Tests for {@link TestGroup}. * * @author Sam Brannen * @since 5.0 */ -class AssumeTests { +class TestGroupTests { + + private static final String TEST_GROUPS_SYSTEM_PROPERTY = "testGroups"; + private String originalTestGroups; @@ -59,25 +63,22 @@ class AssumeTests { } @Test - @SuppressWarnings("deprecation") void assumeGroupWithNoActiveTestGroups() { setTestGroups(""); - assertThatExceptionOfType(TestAbortedException.class).isThrownBy(() -> Assume.group(LONG_RUNNING)); + assertThatExceptionOfType(TestAbortedException.class).isThrownBy(() -> assumeGroup(LONG_RUNNING)); } @Test - @SuppressWarnings("deprecation") void assumeGroupWithNoMatchingActiveTestGroup() { setTestGroups(PERFORMANCE); - assertThatExceptionOfType(TestAbortedException.class).isThrownBy(() -> Assume.group(LONG_RUNNING)); + assertThatExceptionOfType(TestAbortedException.class).isThrownBy(() -> assumeGroup(LONG_RUNNING)); } @Test - @SuppressWarnings("deprecation") void assumeGroupWithMatchingActiveTestGroup() { setTestGroups(LONG_RUNNING); - assertThatCode(() -> Assume.group(LONG_RUNNING)) + assertThatCode(() -> assumeGroup(LONG_RUNNING)) .as("assumption should NOT have failed") .doesNotThrowAnyException(); } @@ -92,7 +93,6 @@ class AssumeTests { assertBogusActiveTestGroupBehavior("all-bogus"); } - @SuppressWarnings("deprecation") private void assertBogusActiveTestGroupBehavior(String testGroups) { // Should result in something similar to the following: // @@ -102,7 +102,7 @@ class AssumeTests { setTestGroups(testGroups); assertThatIllegalStateException() - .isThrownBy(() -> Assume.group(LONG_RUNNING)) + .isThrownBy(() -> assumeGroup(LONG_RUNNING)) .withMessageStartingWith("Failed to parse '" + TEST_GROUPS_SYSTEM_PROPERTY + "' system property: ") .withCauseInstanceOf(IllegalArgumentException.class) .satisfies(ex -> @@ -119,4 +119,15 @@ class AssumeTests { System.setProperty(TEST_GROUPS_SYSTEM_PROPERTY, testGroups); } + /** + * Assume that a particular {@link TestGroup} is active. + * @param group the group that must be active + * @throws org.opentest4j.TestAbortedException if the assumption fails + */ + private static void assumeGroup(TestGroup group) { + Set testGroups = TestGroup.loadTestGroups(); + assumeTrue(testGroups.contains(group), + () -> "Requires inactive test group " + group + "; active test groups: " + testGroups); + } + } diff --git a/spring-core/src/test/java/org/springframework/core/type/AnnotationMetadataTests.java b/spring-core/src/test/java/org/springframework/core/type/AnnotationMetadataTests.java index 571440dfaa7..0881e55de54 100644 --- a/spring-core/src/test/java/org/springframework/core/type/AnnotationMetadataTests.java +++ b/spring-core/src/test/java/org/springframework/core/type/AnnotationMetadataTests.java @@ -33,10 +33,10 @@ import org.junit.jupiter.api.Test; import org.springframework.core.annotation.AliasFor; import org.springframework.core.annotation.AnnotationAttributes; +import org.springframework.core.test.fixtures.stereotype.Component; import org.springframework.core.type.classreading.MetadataReader; import org.springframework.core.type.classreading.MetadataReaderFactory; import org.springframework.core.type.classreading.SimpleMetadataReaderFactory; -import org.springframework.stereotype.Component; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-core/src/test/java/org/springframework/core/type/AnnotationTypeFilterTests.java b/spring-core/src/test/java/org/springframework/core/type/AnnotationTypeFilterTests.java index 0fc09ecdf4f..d1c7d1652f6 100644 --- a/spring-core/src/test/java/org/springframework/core/type/AnnotationTypeFilterTests.java +++ b/spring-core/src/test/java/org/springframework/core/type/AnnotationTypeFilterTests.java @@ -21,11 +21,11 @@ import example.type.InheritedAnnotation; import example.type.NonInheritedAnnotation; import org.junit.jupiter.api.Test; +import org.springframework.core.test.fixtures.stereotype.Component; import org.springframework.core.type.classreading.MetadataReader; import org.springframework.core.type.classreading.MetadataReaderFactory; import org.springframework.core.type.classreading.SimpleMetadataReaderFactory; import org.springframework.core.type.filter.AnnotationTypeFilter; -import org.springframework.stereotype.Component; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-core/src/test/java/org/springframework/core/type/AspectJTypeFilterTests.java b/spring-core/src/test/java/org/springframework/core/type/AspectJTypeFilterTests.java index f1fc05a2082..a3dfed9fcc9 100644 --- a/spring-core/src/test/java/org/springframework/core/type/AspectJTypeFilterTests.java +++ b/spring-core/src/test/java/org/springframework/core/type/AspectJTypeFilterTests.java @@ -88,7 +88,7 @@ class AspectJTypeFilterTests { @Test void annotationPatternMatches() throws Exception { assertMatch("example.type.AspectJTypeFilterTestsTypes$SomeClassAnnotatedWithComponent", - "@org.springframework.stereotype.Component *..*"); + "@org.springframework.core.test.fixtures.stereotype.Component *..*"); assertMatch("example.type.AspectJTypeFilterTestsTypes$SomeClassAnnotatedWithComponent", "@* *..*"); assertMatch("example.type.AspectJTypeFilterTestsTypes$SomeClassAnnotatedWithComponent", @@ -96,9 +96,9 @@ class AspectJTypeFilterTests { assertMatch("example.type.AspectJTypeFilterTestsTypes$SomeClassAnnotatedWithComponent", "@*..*Component *..*"); assertMatch("example.type.AspectJTypeFilterTestsTypes$SomeClassAnnotatedWithComponent", - "@org.springframework.stereotype.Component *..*Component"); + "@org.springframework.core.test.fixtures.stereotype.Component *..*Component"); assertMatch("example.type.AspectJTypeFilterTestsTypes$SomeClassAnnotatedWithComponent", - "@org.springframework.stereotype.Component *"); + "@org.springframework.core.test.fixtures.stereotype.Component *"); } @Test diff --git a/spring-core/src/test/java/org/springframework/core/type/CachingMetadataReaderLeakTests.java b/spring-core/src/test/java/org/springframework/core/type/CachingMetadataReaderLeakTests.java index 9f61f132828..405a742034b 100644 --- a/spring-core/src/test/java/org/springframework/core/type/CachingMetadataReaderLeakTests.java +++ b/spring-core/src/test/java/org/springframework/core/type/CachingMetadataReaderLeakTests.java @@ -22,13 +22,13 @@ import org.junit.jupiter.api.Test; import org.springframework.core.io.Resource; import org.springframework.core.io.UrlResource; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.core.type.classreading.CachingMetadataReaderFactory; import org.springframework.core.type.classreading.MetadataReader; import org.springframework.core.type.classreading.MetadataReaderFactory; -import org.springframework.tests.EnabledForTestGroups; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestGroup.LONG_RUNNING; +import static org.springframework.core.test.fixtures.TestGroup.LONG_RUNNING; /** * Unit tests for checking the behaviour of {@link CachingMetadataReaderFactory} under diff --git a/spring-core/src/test/java/org/springframework/core/type/Scope.java b/spring-core/src/test/java/org/springframework/core/type/Scope.java index 0a169a2e5f5..eb581928a96 100644 --- a/spring-core/src/test/java/org/springframework/core/type/Scope.java +++ b/spring-core/src/test/java/org/springframework/core/type/Scope.java @@ -16,21 +16,18 @@ package org.springframework.core.type; -import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -@Target({ElementType.TYPE, ElementType.METHOD}) +/** + * Copy of the {@code @Scope} annotation for testing purposes. + */ +@Target({ ElementType.TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) -@Documented public @interface Scope { - /** - * Specifies the scope to use for instances of the annotated class. - * @return the desired scope - */ String value() default "singleton"; } diff --git a/spring-core/src/test/java/org/springframework/tests/Assume.java b/spring-core/src/test/java/org/springframework/tests/Assume.java deleted file mode 100644 index 76503c01b2c..00000000000 --- a/spring-core/src/test/java/org/springframework/tests/Assume.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2002-2019 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.tests; - -import java.util.Set; - -import org.apache.commons.logging.Log; - -import static org.junit.jupiter.api.Assumptions.assumeFalse; -import static org.junit.jupiter.api.Assumptions.assumeTrue; - -/** - * Provides utility methods that allow JUnit tests to assume certain conditions - * hold {@code true}. If the assumption fails, it means the test should be - * aborted. - * - *

Tests can be categorized into {@link TestGroup}s. Active groups are enabled using - * the 'testGroups' system property, usually activated from the gradle command line: - * - *

- * gradle test -PtestGroups="performance"
- * 
- * - *

Groups can be activated as a comma separated list of values, or using the - * pseudo group 'all'. See {@link TestGroup} for a list of valid groups. - * - * @author Rob Winch - * @author Phillip Webb - * @author Sam Brannen - * @since 3.2 - * @see EnabledForTestGroups @EnabledForTestGroups - * @see #notLogging(Log) - * @see TestGroup - */ -public abstract class Assume { - - static final String TEST_GROUPS_SYSTEM_PROPERTY = "testGroups"; - - - /** - * Assume that a particular {@link TestGroup} is active. - * @param group the group that must be active - * @throws org.opentest4j.TestAbortedException if the assumption fails - * @deprecated as of Spring Framework 5.2 in favor of {@link EnabledForTestGroups} - */ - @Deprecated - public static void group(TestGroup group) { - Set testGroups = TestGroup.loadTestGroups(); - assumeTrue(testGroups.contains(group), - () -> "Requires inactive test group " + group + "; active test groups: " + testGroups); - } - - /** - * Assume that the specified log is not set to Trace or Debug. - * @param log the log to test - * @throws org.opentest4j.TestAbortedException if the assumption fails - */ - public static void notLogging(Log log) { - assumeFalse(log.isTraceEnabled()); - assumeFalse(log.isDebugEnabled()); - } - -} diff --git a/spring-core/src/test/java/org/springframework/util/AutoPopulatingListTests.java b/spring-core/src/test/java/org/springframework/util/AutoPopulatingListTests.java index 4401096721c..416ad92d2db 100644 --- a/spring-core/src/test/java/org/springframework/util/AutoPopulatingListTests.java +++ b/spring-core/src/test/java/org/springframework/util/AutoPopulatingListTests.java @@ -20,6 +20,7 @@ import java.util.LinkedList; import org.junit.jupiter.api.Test; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.tests.sample.objects.TestObject; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-core/src/test/java/org/springframework/util/ReflectionUtilsTests.java b/spring-core/src/test/java/org/springframework/util/ReflectionUtilsTests.java index cf8629948d5..4bef1397a21 100644 --- a/spring-core/src/test/java/org/springframework/util/ReflectionUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/ReflectionUtilsTests.java @@ -27,12 +27,12 @@ import java.util.List; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.springframework.tests.EnabledForTestGroups; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.tests.sample.objects.TestObject; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * @author Rob Harrop diff --git a/spring-core/src/test/java/org/springframework/util/SerializationUtilsTests.java b/spring-core/src/test/java/org/springframework/util/SerializationUtilsTests.java index 98abc6b718b..d48b00b32f4 100644 --- a/spring-core/src/test/java/org/springframework/util/SerializationUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/SerializationUtilsTests.java @@ -25,14 +25,14 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException import static org.assertj.core.api.Assertions.assertThatIllegalStateException; /** - * Test for static utility to help with serialization. + * Unit tests for {@link SerializationUtils}. * * @author Dave Syer * @since 3.0.5 */ class SerializationUtilsTests { - private static BigInteger FOO = new BigInteger( + private static final BigInteger FOO = new BigInteger( "-9702942423549012526722364838327831379660941553432801565505143675386108883970811292563757558516603356009681061" + "5697574744209306031461371833798723505120163874786203211176873686513374052845353833564048"); @@ -44,21 +44,17 @@ class SerializationUtilsTests { @Test void deserializeUndefined() throws Exception { - byte[] bytes = FOO.toByteArray(); - assertThatIllegalStateException().isThrownBy(() -> - SerializationUtils.deserialize(bytes)); + assertThatIllegalStateException().isThrownBy(() -> SerializationUtils.deserialize(FOO.toByteArray())); } @Test void serializeNonSerializable() throws Exception { - assertThatIllegalArgumentException().isThrownBy(() -> - SerializationUtils.serialize(new Object())); + assertThatIllegalArgumentException().isThrownBy(() -> SerializationUtils.serialize(new Object())); } @Test void deserializeNonSerializable() throws Exception { - assertThatIllegalArgumentException().isThrownBy(() -> - SerializationUtils.deserialize("foo".getBytes())); + assertThatIllegalArgumentException().isThrownBy(() -> SerializationUtils.deserialize("foo".getBytes())); } @Test diff --git a/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxHandlerTests.java b/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxHandlerTests.java index b127bce0067..2592d12a4a8 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxHandlerTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxHandlerTests.java @@ -34,7 +34,7 @@ import org.xml.sax.InputSource; import org.xml.sax.XMLReader; import org.xmlunit.util.Predicate; -import org.springframework.tests.XmlContent; +import org.springframework.core.test.fixtures.xml.XmlContent; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-core/src/test/java/org/springframework/util/xml/DomContentHandlerTests.java b/spring-core/src/test/java/org/springframework/util/xml/DomContentHandlerTests.java index a32eb4a3474..a7fe73634c8 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/DomContentHandlerTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/DomContentHandlerTests.java @@ -28,7 +28,7 @@ import org.w3c.dom.Element; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; -import org.springframework.tests.XmlContent; +import org.springframework.core.test.fixtures.xml.XmlContent; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-core/src/test/java/org/springframework/util/xml/ListBasedXMLEventReaderTests.java b/spring-core/src/test/java/org/springframework/util/xml/ListBasedXMLEventReaderTests.java index 8a019329eb0..0049180a3c5 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/ListBasedXMLEventReaderTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/ListBasedXMLEventReaderTests.java @@ -30,7 +30,7 @@ import javax.xml.stream.events.XMLEvent; import org.junit.jupiter.api.Test; -import org.springframework.tests.XmlContent; +import org.springframework.core.test.fixtures.xml.XmlContent; import static javax.xml.stream.XMLStreamConstants.END_DOCUMENT; import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; diff --git a/spring-core/src/test/java/org/springframework/util/xml/StaxResultTests.java b/spring-core/src/test/java/org/springframework/util/xml/StaxResultTests.java index 78188adcbde..000307e318c 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/StaxResultTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/StaxResultTests.java @@ -31,7 +31,7 @@ import javax.xml.transform.stream.StreamSource; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.springframework.tests.XmlContent; +import org.springframework.core.test.fixtures.xml.XmlContent; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-core/src/test/java/org/springframework/util/xml/StaxSourceTests.java b/spring-core/src/test/java/org/springframework/util/xml/StaxSourceTests.java index fb5ad8dcadb..908dfd3d1b9 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/StaxSourceTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/StaxSourceTests.java @@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test; import org.w3c.dom.Document; import org.xml.sax.InputSource; -import org.springframework.tests.XmlContent; +import org.springframework.core.test.fixtures.xml.XmlContent; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-core/src/test/java/org/springframework/util/xml/XMLEventStreamReaderTests.java b/spring-core/src/test/java/org/springframework/util/xml/XMLEventStreamReaderTests.java index 832784168d2..7d9719a3473 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/XMLEventStreamReaderTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/XMLEventStreamReaderTests.java @@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test; import org.w3c.dom.Node; import org.xmlunit.util.Predicate; -import org.springframework.tests.XmlContent; +import org.springframework.core.test.fixtures.xml.XmlContent; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-core/src/test/java/org/springframework/util/xml/XMLEventStreamWriterTests.java b/spring-core/src/test/java/org/springframework/util/xml/XMLEventStreamWriterTests.java index e35807870a6..7ed978406b4 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/XMLEventStreamWriterTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/XMLEventStreamWriterTests.java @@ -27,7 +27,7 @@ import org.junit.jupiter.api.Test; import org.w3c.dom.Node; import org.xmlunit.util.Predicate; -import org.springframework.tests.XmlContent; +import org.springframework.core.test.fixtures.xml.XmlContent; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/Assume.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/Assume.java new file mode 100644 index 00000000000..1537f459a2a --- /dev/null +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/Assume.java @@ -0,0 +1,46 @@ +/* + * Copyright 2002-2019 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.core.test.fixtures; + +import org.apache.commons.logging.Log; + +import static org.junit.jupiter.api.Assumptions.assumeFalse; + +/** + * Utility methods that allow JUnit tests to assume certain conditions hold + * {@code true}. If an assumption fails, it means the test should be aborted. + * + * @author Rob Winch + * @author Phillip Webb + * @author Sam Brannen + * @since 3.2 + * @see #notLogging(Log) + * @see EnabledForTestGroups @EnabledForTestGroups + */ +public abstract class Assume { + + /** + * Assume that the specified log is not set to Trace or Debug. + * @param log the log to test + * @throws org.opentest4j.TestAbortedException if the assumption fails + */ + public static void notLogging(Log log) { + assumeFalse(log.isTraceEnabled()); + assumeFalse(log.isDebugEnabled()); + } + +} diff --git a/spring-core/src/test/java/org/springframework/tests/EnabledForTestGroups.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/EnabledForTestGroups.java similarity index 96% rename from spring-core/src/test/java/org/springframework/tests/EnabledForTestGroups.java rename to spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/EnabledForTestGroups.java index 4ae6637caa4..5fd5eeab920 100644 --- a/spring-core/src/test/java/org/springframework/tests/EnabledForTestGroups.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/EnabledForTestGroups.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.tests; +package org.springframework.core.test.fixtures; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/spring-core/src/test/java/org/springframework/tests/TestGroup.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/TestGroup.java similarity index 98% rename from spring-core/src/test/java/org/springframework/tests/TestGroup.java rename to spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/TestGroup.java index f04c47bc182..0203908775b 100644 --- a/spring-core/src/test/java/org/springframework/tests/TestGroup.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/TestGroup.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.tests; +package org.springframework.core.test.fixtures; import java.util.Collections; import java.util.EnumSet; @@ -29,7 +29,6 @@ import static java.lang.String.format; * A test group used to limit when certain tests are run. * * @see EnabledForTestGroups @EnabledForTestGroups - * @see Assume#group(TestGroup) * @author Phillip Webb * @author Chris Beams * @author Sam Brannen diff --git a/spring-core/src/test/java/org/springframework/tests/TestGroupsCondition.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/TestGroupsCondition.java similarity index 97% rename from spring-core/src/test/java/org/springframework/tests/TestGroupsCondition.java rename to spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/TestGroupsCondition.java index 90850b0acdf..e17d446033c 100644 --- a/spring-core/src/test/java/org/springframework/tests/TestGroupsCondition.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/TestGroupsCondition.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.tests; +package org.springframework.core.test.fixtures; import java.util.Arrays; import java.util.Optional; diff --git a/spring-core/src/test/java/org/springframework/tests/TimeStamped.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/TimeStamped.java similarity index 95% rename from spring-core/src/test/java/org/springframework/tests/TimeStamped.java rename to spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/TimeStamped.java index 20904c8b9ab..27fe1634002 100644 --- a/spring-core/src/test/java/org/springframework/tests/TimeStamped.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/TimeStamped.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.tests; +package org.springframework.core.test.fixtures; /** * This interface can be implemented by cacheable objects or cache entries, diff --git a/spring-core/src/test/java/org/springframework/core/codec/AbstractDecoderTests.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/codec/AbstractDecoderTests.java similarity index 98% rename from spring-core/src/test/java/org/springframework/core/codec/AbstractDecoderTests.java rename to spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/codec/AbstractDecoderTests.java index de9598edafd..72fece41b7e 100644 --- a/spring-core/src/test/java/org/springframework/core/codec/AbstractDecoderTests.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/codec/AbstractDecoderTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.core.codec; +package org.springframework.core.test.fixtures.codec; import java.time.Duration; import java.util.Map; @@ -27,8 +27,9 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import org.springframework.core.ResolvableType; -import org.springframework.core.io.buffer.AbstractLeakCheckingTests; +import org.springframework.core.codec.Decoder; import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.test.fixtures.io.buffer.AbstractLeakCheckingTests; import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.MimeType; @@ -43,7 +44,6 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @author Arjen Poutsma * @since 5.1.3 */ -@SuppressWarnings("ProtectedField") public abstract class AbstractDecoderTests> extends AbstractLeakCheckingTests { /** diff --git a/spring-core/src/test/java/org/springframework/core/codec/AbstractEncoderTests.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/codec/AbstractEncoderTests.java similarity index 98% rename from spring-core/src/test/java/org/springframework/core/codec/AbstractEncoderTests.java rename to spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/codec/AbstractEncoderTests.java index 4eb7c811a59..33af4bb64b0 100644 --- a/spring-core/src/test/java/org/springframework/core/codec/AbstractEncoderTests.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/codec/AbstractEncoderTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.core.codec; +package org.springframework.core.test.fixtures.codec; import java.util.Map; import java.util.function.Consumer; @@ -25,9 +25,10 @@ import reactor.core.publisher.Flux; import reactor.test.StepVerifier; import org.springframework.core.ResolvableType; -import org.springframework.core.io.buffer.AbstractLeakCheckingTests; +import org.springframework.core.codec.Encoder; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferUtils; +import org.springframework.core.test.fixtures.io.buffer.AbstractLeakCheckingTests; import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.MimeType; @@ -44,7 +45,6 @@ import static org.springframework.core.io.buffer.DataBufferUtils.release; * @author Arjen Poutsma * @since 5.1.3 */ -@SuppressWarnings("ProtectedField") public abstract class AbstractEncoderTests> extends AbstractLeakCheckingTests { /** diff --git a/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/env/EnvironmentTestUtils.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/env/EnvironmentTestUtils.java new file mode 100644 index 00000000000..227c70a84b7 --- /dev/null +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/env/EnvironmentTestUtils.java @@ -0,0 +1,92 @@ +/* + * Copyright 2002-2019 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.core.test.fixtures.env; + +import java.lang.reflect.Field; +import java.util.Collections; +import java.util.Map; + +import org.springframework.core.env.StandardEnvironment; + +/** + * Test utilities for {@link StandardEnvironment}. + * + * @author Chris Beams + * @author Juergen Hoeller + */ +public class EnvironmentTestUtils { + + @SuppressWarnings("unchecked") + public static Map getModifiableSystemEnvironment() { + // for os x / linux + Class[] classes = Collections.class.getDeclaredClasses(); + Map env = System.getenv(); + for (Class cl : classes) { + if ("java.util.Collections$UnmodifiableMap".equals(cl.getName())) { + try { + Field field = cl.getDeclaredField("m"); + field.setAccessible(true); + Object obj = field.get(env); + if (obj != null && obj.getClass().getName().equals("java.lang.ProcessEnvironment$StringEnvironment")) { + return (Map) obj; + } + } + catch (Exception ex) { + throw new RuntimeException(ex); + } + } + } + + // for windows + Class processEnvironmentClass; + try { + processEnvironmentClass = Class.forName("java.lang.ProcessEnvironment"); + } + catch (Exception ex) { + throw new IllegalStateException(ex); + } + + try { + Field theCaseInsensitiveEnvironmentField = processEnvironmentClass.getDeclaredField("theCaseInsensitiveEnvironment"); + theCaseInsensitiveEnvironmentField.setAccessible(true); + Object obj = theCaseInsensitiveEnvironmentField.get(null); + return (Map) obj; + } + catch (NoSuchFieldException ex) { + // do nothing + } + catch (Exception ex) { + throw new IllegalStateException(ex); + } + + try { + Field theEnvironmentField = processEnvironmentClass.getDeclaredField("theEnvironment"); + theEnvironmentField.setAccessible(true); + Object obj = theEnvironmentField.get(null); + return (Map) obj; + } + catch (NoSuchFieldException ex) { + // do nothing + } + catch (Exception ex) { + throw new IllegalStateException(ex); + } + + throw new IllegalStateException(); + } + +} diff --git a/spring-core/src/test/java/org/springframework/mock/env/MockPropertySource.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/env/MockPropertySource.java similarity index 98% rename from spring-core/src/test/java/org/springframework/mock/env/MockPropertySource.java rename to spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/env/MockPropertySource.java index b2dc34a41e6..9037af3d5b8 100644 --- a/spring-core/src/test/java/org/springframework/mock/env/MockPropertySource.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/env/MockPropertySource.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.mock.env; +package org.springframework.core.test.fixtures.env; import java.util.Properties; diff --git a/spring-core/src/test/java/org/springframework/tests/TestResourceUtils.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/ResourceTestUtils.java similarity index 89% rename from spring-core/src/test/java/org/springframework/tests/TestResourceUtils.java rename to spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/ResourceTestUtils.java index 6f2a67f58ad..3925c486876 100644 --- a/spring-core/src/test/java/org/springframework/tests/TestResourceUtils.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/ResourceTestUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2019 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.tests; +package org.springframework.core.test.fixtures.io; import org.springframework.core.io.ClassPathResource; @@ -23,7 +23,7 @@ import org.springframework.core.io.ClassPathResource; * * @author Chris Beams */ -public abstract class TestResourceUtils { +public abstract class ResourceTestUtils { /** * Load a {@link ClassPathResource} qualified by the simple name of clazz, diff --git a/spring-core/src/test/java/org/springframework/util/SerializationTestUtils.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/SerializationTestUtils.java similarity index 97% rename from spring-core/src/test/java/org/springframework/util/SerializationTestUtils.java rename to spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/SerializationTestUtils.java index 38c48dea347..798dc834776 100644 --- a/spring-core/src/test/java/org/springframework/util/SerializationTestUtils.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/SerializationTestUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.util; +package org.springframework.core.test.fixtures.io; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/spring-core/src/test/java/org/springframework/core/io/buffer/AbstractDataBufferAllocatingTests.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/buffer/AbstractDataBufferAllocatingTests.java similarity index 92% rename from spring-core/src/test/java/org/springframework/core/io/buffer/AbstractDataBufferAllocatingTests.java rename to spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/buffer/AbstractDataBufferAllocatingTests.java index dc8717e0df4..e8f40a82e1f 100644 --- a/spring-core/src/test/java/org/springframework/core/io/buffer/AbstractDataBufferAllocatingTests.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/buffer/AbstractDataBufferAllocatingTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.core.io.buffer; +package org.springframework.core.test.fixtures.io.buffer; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; @@ -40,7 +40,11 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import reactor.core.publisher.Mono; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.io.buffer.DataBufferFactory; +import org.springframework.core.io.buffer.DataBufferUtils; +import org.springframework.core.io.buffer.DefaultDataBufferFactory; +import org.springframework.core.io.buffer.NettyDataBufferFactory; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.params.provider.Arguments.arguments; @@ -144,7 +148,7 @@ public abstract class AbstractDataBufferAllocatingTests { @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) @ParameterizedTest(name = "[{index}] {0}") - @MethodSource("org.springframework.core.io.buffer.AbstractDataBufferAllocatingTests#dataBufferFactories()") + @MethodSource("org.springframework.core.test.fixtures.io.buffer.AbstractDataBufferAllocatingTests#dataBufferFactories()") public @interface ParameterizedDataBufferAllocatingTest { } diff --git a/spring-core/src/test/java/org/springframework/core/io/buffer/AbstractLeakCheckingTests.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/buffer/AbstractLeakCheckingTests.java similarity index 92% rename from spring-core/src/test/java/org/springframework/core/io/buffer/AbstractLeakCheckingTests.java rename to spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/buffer/AbstractLeakCheckingTests.java index 13c8207f1ec..e6b5f3b425a 100644 --- a/spring-core/src/test/java/org/springframework/core/io/buffer/AbstractLeakCheckingTests.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/buffer/AbstractLeakCheckingTests.java @@ -14,10 +14,12 @@ * limitations under the License. */ -package org.springframework.core.io.buffer; +package org.springframework.core.test.fixtures.io.buffer; import org.junit.jupiter.api.AfterEach; +import org.springframework.core.io.buffer.DataBufferFactory; + /** * Abstract base class for unit tests that allocate data buffers via a {@link DataBufferFactory}. * After each unit test, this base class checks whether all created buffers have been released, @@ -32,7 +34,6 @@ public abstract class AbstractLeakCheckingTests { /** * The data buffer factory. */ - @SuppressWarnings("ProtectedField") protected final LeakAwareDataBufferFactory bufferFactory = new LeakAwareDataBufferFactory(); /** diff --git a/spring-core/src/test/java/org/springframework/core/io/buffer/support/DataBufferTestUtils.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/buffer/DataBufferTestUtils.java similarity index 97% rename from spring-core/src/test/java/org/springframework/core/io/buffer/support/DataBufferTestUtils.java rename to spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/buffer/DataBufferTestUtils.java index dc331d73144..d66fca19479 100644 --- a/spring-core/src/test/java/org/springframework/core/io/buffer/support/DataBufferTestUtils.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/buffer/DataBufferTestUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.core.io.buffer.support; +package org.springframework.core.test.fixtures.io.buffer; import java.nio.charset.Charset; diff --git a/spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBuffer.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/buffer/LeakAwareDataBuffer.java similarity index 92% rename from spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBuffer.java rename to spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/buffer/LeakAwareDataBuffer.java index 80879f82eb4..cb42a0468e4 100644 --- a/spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBuffer.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/buffer/LeakAwareDataBuffer.java @@ -14,8 +14,11 @@ * limitations under the License. */ -package org.springframework.core.io.buffer; +package org.springframework.core.test.fixtures.io.buffer; +import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.io.buffer.DataBufferWrapper; +import org.springframework.core.io.buffer.PooledDataBuffer; import org.springframework.util.Assert; /** diff --git a/spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBufferFactory.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/buffer/LeakAwareDataBufferFactory.java similarity index 93% rename from spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBufferFactory.java rename to spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/buffer/LeakAwareDataBufferFactory.java index 4769e3a23aa..e3c8dced702 100644 --- a/spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBufferFactory.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/io/buffer/LeakAwareDataBufferFactory.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.core.io.buffer; +package org.springframework.core.test.fixtures.io.buffer; import java.nio.ByteBuffer; import java.time.Duration; @@ -28,6 +28,10 @@ import io.netty.buffer.PooledByteBufAllocator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.io.buffer.DataBufferFactory; +import org.springframework.core.io.buffer.DefaultDataBufferFactory; +import org.springframework.core.io.buffer.NettyDataBufferFactory; import org.springframework.util.Assert; /** diff --git a/spring-core/src/test/java/org/springframework/stereotype/Component.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/stereotype/Component.java similarity index 84% rename from spring-core/src/test/java/org/springframework/stereotype/Component.java rename to spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/stereotype/Component.java index 16dc18dcd67..04bf3e0fc7e 100644 --- a/spring-core/src/test/java/org/springframework/stereotype/Component.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/stereotype/Component.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.stereotype; +package org.springframework.core.test.fixtures.stereotype; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; @@ -23,9 +23,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * Indicates that an annotated class is a "component". - * Such classes are considered as candidates for auto-detection - * when using annotation-based configuration and classpath scanning. + * Copy of the standard {@code Component} annotation for testing purposes. * * @author Mark Fisher * @since 2.5 diff --git a/spring-core/src/test/java/org/springframework/stereotype/Indexed.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/stereotype/Indexed.java similarity index 94% rename from spring-core/src/test/java/org/springframework/stereotype/Indexed.java rename to spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/stereotype/Indexed.java index 63502acaf80..2da265f6cb7 100644 --- a/spring-core/src/test/java/org/springframework/stereotype/Indexed.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/stereotype/Indexed.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.stereotype; +package org.springframework.core.test.fixtures.stereotype; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/spring-core/src/test/java/org/springframework/tests/XmlContent.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/xml/XmlContent.java similarity index 94% rename from spring-core/src/test/java/org/springframework/tests/XmlContent.java rename to spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/xml/XmlContent.java index df4342a68ed..becbae6d2c7 100644 --- a/spring-core/src/test/java/org/springframework/tests/XmlContent.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/xml/XmlContent.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.tests; +package org.springframework.core.test.fixtures.xml; import java.io.StringWriter; @@ -29,7 +29,7 @@ import org.xmlunit.assertj.XmlAssert; */ public class XmlContent implements AssertProvider { - private Object source; + private final Object source; private XmlContent(Object source) { this.source = source; diff --git a/spring-core/src/test/java/org/springframework/tests/XmlContentAssert.java b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/xml/XmlContentAssert.java similarity index 77% rename from spring-core/src/test/java/org/springframework/tests/XmlContentAssert.java rename to spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/xml/XmlContentAssert.java index b598f5f3634..c76d1cb3a5c 100644 --- a/spring-core/src/test/java/org/springframework/tests/XmlContentAssert.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/test/fixtures/xml/XmlContentAssert.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.tests; +package org.springframework.core.test.fixtures.xml; import org.assertj.core.api.AbstractAssert; import org.w3c.dom.Node; @@ -35,30 +35,30 @@ public class XmlContentAssert extends AbstractAssert { } public XmlContentAssert isSimilarTo(Object control) { - XmlAssert.assertThat(actual).and(control).areSimilar(); + XmlAssert.assertThat(super.actual).and(control).areSimilar(); return this; } public XmlContentAssert isSimilarTo(Object control, Predicate nodeFilter) { - XmlAssert.assertThat(actual).and(control).withNodeFilter(nodeFilter).areSimilar(); + XmlAssert.assertThat(super.actual).and(control).withNodeFilter(nodeFilter).areSimilar(); return this; } public XmlContentAssert isSimilarTo(String control, DifferenceEvaluator differenceEvaluator) { - XmlAssert.assertThat(actual).and(control).withDifferenceEvaluator( + XmlAssert.assertThat(super.actual).and(control).withDifferenceEvaluator( differenceEvaluator).areSimilar(); return this; } public XmlContentAssert isSimilarToIgnoringWhitespace(Object control) { - XmlAssert.assertThat(actual).and(control).ignoreWhitespace().areSimilar(); + XmlAssert.assertThat(super.actual).and(control).ignoreWhitespace().areSimilar(); return this; } public XmlContentAssert isSimilarToIgnoringWhitespace(String control, NodeMatcher nodeMatcher) { - XmlAssert.assertThat(actual).and(control).ignoreWhitespace().withNodeMatcher(nodeMatcher).areSimilar(); + XmlAssert.assertThat(super.actual).and(control).ignoreWhitespace().withNodeMatcher(nodeMatcher).areSimilar(); return this; } diff --git a/spring-expression/spring-expression.gradle b/spring-expression/spring-expression.gradle index 432179877a9..9f8299d4db9 100644 --- a/spring-expression/spring-expression.gradle +++ b/spring-expression/spring-expression.gradle @@ -4,6 +4,7 @@ apply plugin: "kotlin" dependencies { compile(project(":spring-core")) + testCompile(testFixtures(project(":spring-core"))) testCompile("org.jetbrains.kotlin:kotlin-reflect") testCompile("org.jetbrains.kotlin:kotlin-stdlib") } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java index 5673cc1d3f2..a18114da24d 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java @@ -21,6 +21,7 @@ import java.util.Map; import org.junit.jupiter.api.Test; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.expression.AccessException; import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; @@ -29,11 +30,10 @@ import org.springframework.expression.PropertyAccessor; import org.springframework.expression.TypedValue; import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.expression.spel.support.StandardEvaluationContext; -import org.springframework.tests.EnabledForTestGroups; import org.springframework.util.StopWatch; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * Testing variations on map access. diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/PerformanceTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/PerformanceTests.java index 7db14d0e011..b1cbb7f0aa6 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/PerformanceTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/PerformanceTests.java @@ -18,15 +18,15 @@ package org.springframework.expression.spel; import org.junit.jupiter.api.Test; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser; -import org.springframework.tests.EnabledForTestGroups; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; ///CLOVER:OFF diff --git a/spring-jdbc/spring-jdbc.gradle b/spring-jdbc/spring-jdbc.gradle index 78e5cced895..3dc083492fc 100644 --- a/spring-jdbc/spring-jdbc.gradle +++ b/spring-jdbc/spring-jdbc.gradle @@ -14,4 +14,5 @@ dependencies { optional("org.apache.derby:derbyclient") optional("org.jetbrains.kotlin:kotlin-reflect") optional("org.jetbrains.kotlin:kotlin-stdlib") + testCompile(testFixtures(project(":spring-core"))) } diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/config/JdbcNamespaceIntegrationTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/config/JdbcNamespaceIntegrationTests.java index 25b4a13d2dc..ad5e78c6cf9 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/config/JdbcNamespaceIntegrationTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/config/JdbcNamespaceIntegrationTests.java @@ -29,17 +29,17 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.core.io.ClassPathResource; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.jdbc.BadSqlGrammarException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.AbstractDriverBasedDataSource; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactoryBean; import org.springframework.jdbc.datasource.init.DataSourceInitializer; -import org.springframework.tests.EnabledForTestGroups; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.springframework.core.test.fixtures.TestGroup.LONG_RUNNING; import static org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.DEFAULT_DATABASE_NAME; -import static org.springframework.tests.TestGroup.LONG_RUNNING; /** * @author Dave Syer diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/DataSourceTransactionManagerTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/DataSourceTransactionManagerTests.java index d1cf8f5c8fe..919f4b17dab 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/DataSourceTransactionManagerTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/datasource/DataSourceTransactionManagerTests.java @@ -30,9 +30,9 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.InOrder; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.dao.DataAccessResourceFailureException; import org.springframework.jdbc.UncategorizedSQLException; -import org.springframework.tests.EnabledForTestGroups; import org.springframework.transaction.CannotCreateTransactionException; import org.springframework.transaction.IllegalTransactionStateException; import org.springframework.transaction.PlatformTransactionManager; @@ -58,7 +58,7 @@ import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * @author Juergen Hoeller diff --git a/spring-messaging/spring-messaging.gradle b/spring-messaging/spring-messaging.gradle index 66ddd442ebd..a2851000418 100644 --- a/spring-messaging/spring-messaging.gradle +++ b/spring-messaging/spring-messaging.gradle @@ -16,6 +16,8 @@ dependencies { optional("com.google.protobuf:protobuf-java-util") optional("org.jetbrains.kotlinx:kotlinx-coroutines-core") optional("org.jetbrains.kotlinx:kotlinx-coroutines-reactor") + testCompile(project(":kotlin-coroutines")) + testCompile(testFixtures(project(":spring-core"))) testCompile("javax.inject:javax.inject-tck") testCompile("javax.servlet:javax.servlet-api") testCompile("javax.validation:validation-api") @@ -29,7 +31,6 @@ dependencies { testCompile("org.jetbrains.kotlin:kotlin-stdlib") testCompile("org.xmlunit:xmlunit-assertj") testCompile("org.xmlunit:xmlunit-matchers") - testCompile(project(":kotlin-coroutines")) testRuntime("com.sun.xml.bind:jaxb-core") testRuntime("com.sun.xml.bind:jaxb-impl") testRuntime("com.sun.activation:javax.activation") diff --git a/spring-messaging/src/test/java/org/springframework/messaging/MessageHeadersTests.java b/spring-messaging/src/test/java/org/springframework/messaging/MessageHeadersTests.java index eb1e3278cbb..088a53804c4 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/MessageHeadersTests.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/MessageHeadersTests.java @@ -25,7 +25,7 @@ import java.util.concurrent.atomic.AtomicLong; import org.junit.jupiter.api.Test; -import org.springframework.util.SerializationTestUtils; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/spring-messaging/src/test/java/org/springframework/messaging/converter/MarshallingMessageConverterTests.java b/spring-messaging/src/test/java/org/springframework/messaging/converter/MarshallingMessageConverterTests.java index 9fb9b0b5aa9..8f256aa5077 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/converter/MarshallingMessageConverterTests.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/converter/MarshallingMessageConverterTests.java @@ -25,10 +25,10 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.xmlunit.diff.DifferenceEvaluator; +import org.springframework.core.test.fixtures.xml.XmlContent; import org.springframework.messaging.Message; import org.springframework.messaging.support.MessageBuilder; import org.springframework.oxm.jaxb.Jaxb2Marshaller; -import org.springframework.tests.XmlContent; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/spring-messaging/src/test/java/org/springframework/messaging/handler/invocation/reactive/TestEncoderMethodReturnValueHandler.java b/spring-messaging/src/test/java/org/springframework/messaging/handler/invocation/reactive/TestEncoderMethodReturnValueHandler.java index 74087f82e13..ed40c25a9dd 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/handler/invocation/reactive/TestEncoderMethodReturnValueHandler.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/handler/invocation/reactive/TestEncoderMethodReturnValueHandler.java @@ -24,7 +24,7 @@ import org.springframework.core.MethodParameter; import org.springframework.core.ReactiveAdapterRegistry; import org.springframework.core.codec.Encoder; import org.springframework.core.io.buffer.DataBuffer; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import org.springframework.messaging.Message; import static java.nio.charset.StandardCharsets.UTF_8; diff --git a/spring-messaging/src/test/java/org/springframework/messaging/rsocket/LeakAwareNettyDataBufferFactory.java b/spring-messaging/src/test/java/org/springframework/messaging/rsocket/LeakAwareNettyDataBufferFactory.java index 321ff4e3845..762ba52151b 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/rsocket/LeakAwareNettyDataBufferFactory.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/rsocket/LeakAwareNettyDataBufferFactory.java @@ -31,7 +31,7 @@ import org.springframework.core.io.buffer.PooledDataBuffer; import org.springframework.util.ObjectUtils; /** - * Unlike {@link org.springframework.core.io.buffer.LeakAwareDataBufferFactory} + * Unlike {@link org.springframework.core.test.fixtures.io.buffer.LeakAwareDataBufferFactory} * this one is an instance of {@link NettyDataBufferFactory} which is necessary * since {@link PayloadUtils} does instanceof checks, and that also allows * intercepting {@link NettyDataBufferFactory#wrap(ByteBuf)}. diff --git a/spring-messaging/src/test/java/org/springframework/messaging/rsocket/MetadataEncoderTests.java b/spring-messaging/src/test/java/org/springframework/messaging/rsocket/MetadataEncoderTests.java index a1ca77d15dd..23d73df77ab 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/rsocket/MetadataEncoderTests.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/rsocket/MetadataEncoderTests.java @@ -33,7 +33,7 @@ import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DefaultDataBufferFactory; import org.springframework.core.io.buffer.NettyDataBuffer; import org.springframework.core.io.buffer.NettyDataBufferFactory; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import org.springframework.util.MimeType; import org.springframework.util.MimeTypeUtils; diff --git a/spring-messaging/src/test/java/org/springframework/messaging/rsocket/PayloadUtilsTests.java b/spring-messaging/src/test/java/org/springframework/messaging/rsocket/PayloadUtilsTests.java index 904032a29da..f368ce74577 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/rsocket/PayloadUtilsTests.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/rsocket/PayloadUtilsTests.java @@ -30,7 +30,7 @@ import org.springframework.core.io.buffer.DataBufferUtils; import org.springframework.core.io.buffer.DefaultDataBuffer; import org.springframework.core.io.buffer.DefaultDataBufferFactory; import org.springframework.core.io.buffer.NettyDataBuffer; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-messaging/src/test/java/org/springframework/messaging/support/MessageHeaderAccessorTests.java b/spring-messaging/src/test/java/org/springframework/messaging/support/MessageHeaderAccessorTests.java index 99a32034011..3d59175823a 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/support/MessageHeaderAccessorTests.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/support/MessageHeaderAccessorTests.java @@ -24,10 +24,10 @@ import java.util.UUID; import org.junit.jupiter.api.Test; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.messaging.Message; import org.springframework.messaging.MessageHeaders; import org.springframework.util.MimeTypeUtils; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; diff --git a/spring-orm/spring-orm.gradle b/spring-orm/spring-orm.gradle index 279b74437f9..7c213fbbc7b 100644 --- a/spring-orm/spring-orm.gradle +++ b/spring-orm/spring-orm.gradle @@ -11,6 +11,7 @@ dependencies { optional("org.eclipse.persistence:org.eclipse.persistence.jpa") optional("org.hibernate:hibernate-core") optional("javax.servlet:javax.servlet-api:3.1.0") + testCompile(testFixtures(project(":spring-core"))) testCompile("org.aspectj:aspectjweaver") testCompile("org.hsqldb:hsqldb") testRuntime("javax.xml.bind:jaxb-api") diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractContainerEntityManagerFactoryIntegrationTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractContainerEntityManagerFactoryIntegrationTests.java index 3212318ec79..51ffa961aa3 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractContainerEntityManagerFactoryIntegrationTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/AbstractContainerEntityManagerFactoryIntegrationTests.java @@ -26,9 +26,9 @@ import javax.persistence.Query; import org.junit.jupiter.api.Test; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.orm.jpa.domain.DriversLicense; import org.springframework.orm.jpa.domain.Person; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBeanTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBeanTests.java index 6cbbdab3c00..23fb944acef 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBeanTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBeanTests.java @@ -32,13 +32,13 @@ import javax.persistence.spi.ProviderUtil; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.dao.DataAccessException; import org.springframework.dao.OptimisticLockingFailureException; import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver; import org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.interceptor.DefaultTransactionAttribute; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/support/PersistenceInjectionTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/support/PersistenceInjectionTests.java index cee641e864c..3be9625da31 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/support/PersistenceInjectionTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/support/PersistenceInjectionTests.java @@ -37,6 +37,7 @@ import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.support.GenericApplicationContext; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.lang.Nullable; import org.springframework.orm.jpa.AbstractEntityManagerFactoryBeanTests; import org.springframework.orm.jpa.DefaultJpaDialect; @@ -46,7 +47,6 @@ import org.springframework.stereotype.Repository; import org.springframework.tests.context.SimpleMapScope; import org.springframework.tests.mock.jndi.ExpectedLookupTemplate; import org.springframework.transaction.support.TransactionSynchronizationManager; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; diff --git a/spring-oxm/spring-oxm.gradle b/spring-oxm/spring-oxm.gradle index 3b31d45b5d8..0c8a0af2442 100644 --- a/spring-oxm/spring-oxm.gradle +++ b/spring-oxm/spring-oxm.gradle @@ -62,6 +62,7 @@ dependencies { optional("com.thoughtworks.xstream:xstream") optional("org.jibx:jibx-run") testCompile(project(":spring-context")) + testCompile(testFixtures(project(":spring-core"))) testCompile("org.ogce:xpp3") testCompile("org.codehaus.jettison:jettison") { exclude group: "stax", module: "stax-api" diff --git a/spring-oxm/src/test/java/org/springframework/oxm/AbstractMarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/AbstractMarshallerTests.java index e588e74dbc6..6dd6a91f1f7 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/AbstractMarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/AbstractMarshallerTests.java @@ -36,7 +36,7 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Text; -import org.springframework.tests.XmlContent; +import org.springframework.core.test.fixtures.xml.XmlContent; import org.springframework.util.xml.StaxUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java index 59ab3c43936..2dc7d433610 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java @@ -46,6 +46,7 @@ import org.xmlunit.diff.DifferenceEvaluator; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; +import org.springframework.core.test.fixtures.xml.XmlContent; import org.springframework.oxm.AbstractMarshallerTests; import org.springframework.oxm.UncategorizedMappingException; import org.springframework.oxm.XmlMappingException; @@ -53,7 +54,6 @@ import org.springframework.oxm.jaxb.test.FlightType; import org.springframework.oxm.jaxb.test.Flights; import org.springframework.oxm.jaxb.test.ObjectFactory; import org.springframework.oxm.mime.MimeContainer; -import org.springframework.tests.XmlContent; import org.springframework.util.FileCopyUtils; import org.springframework.util.ReflectionUtils; diff --git a/spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxMarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxMarshallerTests.java index 88a0ee8154d..6a904c2dd7d 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxMarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxMarshallerTests.java @@ -23,8 +23,8 @@ import javax.xml.transform.stream.StreamResult; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.EnabledOnJre; +import org.springframework.core.test.fixtures.xml.XmlContent; import org.springframework.oxm.AbstractMarshallerTests; -import org.springframework.tests.XmlContent; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; diff --git a/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamMarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamMarshallerTests.java index e3321c2e88d..c57a3045547 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamMarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamMarshallerTests.java @@ -56,7 +56,7 @@ import org.xml.sax.ContentHandler; import org.xmlunit.builder.Input; import org.xmlunit.xpath.JAXPXPathEngine; -import org.springframework.tests.XmlContent; +import org.springframework.core.test.fixtures.xml.XmlContent; import org.springframework.util.xml.StaxUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-test/spring-test.gradle b/spring-test/spring-test.gradle index 894a06344f4..0b66f51e277 100644 --- a/spring-test/spring-test.gradle +++ b/spring-test/spring-test.gradle @@ -42,6 +42,7 @@ dependencies { optional("org.jetbrains.kotlinx:kotlinx-coroutines-reactor") testCompile(project(":spring-context-support")) testCompile(project(":spring-oxm")) + testCompile(testFixtures(project(":spring-core"))) testCompile("javax.annotation:javax.annotation-api") testCompile("javax.cache:cache-api") testCompile("javax.ejb:javax.ejb-api") diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/concurrency/SpringJUnit4ConcurrencyTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/concurrency/SpringJUnit4ConcurrencyTests.java index af170e25114..5075ccd9f6e 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/concurrency/SpringJUnit4ConcurrencyTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/concurrency/SpringJUnit4ConcurrencyTests.java @@ -24,6 +24,7 @@ import org.junit.Ignore; import org.junit.Test; import org.junit.experimental.ParallelComputer; +import org.springframework.core.test.fixtures.TestGroup; import org.springframework.test.context.junit4.InheritedConfigSpringJUnit4ClassRunnerAppCtxTests; import org.springframework.test.context.junit4.MethodLevelTransactionalSpringRunnerTests; import org.springframework.test.context.junit4.SpringJUnit47ClassRunnerRuleTests; @@ -34,7 +35,6 @@ import org.springframework.test.context.junit4.rules.BaseAppCtxRuleTests; import org.springframework.test.context.junit4.rules.BasicAnnotationConfigWacSpringRuleTests; import org.springframework.test.context.junit4.rules.SpringClassRule; import org.springframework.test.context.junit4.rules.SpringMethodRule; -import org.springframework.tests.TestGroup; import org.springframework.util.ReflectionUtils; import static org.junit.Assume.assumeTrue; diff --git a/spring-test/src/test/java/org/springframework/test/web/reactive/server/HttpHandlerConnectorTests.java b/spring-test/src/test/java/org/springframework/test/web/reactive/server/HttpHandlerConnectorTests.java index 83a2e4c251b..08c0948f33e 100644 --- a/spring-test/src/test/java/org/springframework/test/web/reactive/server/HttpHandlerConnectorTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/reactive/server/HttpHandlerConnectorTests.java @@ -28,7 +28,7 @@ import reactor.core.scheduler.Schedulers; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DefaultDataBufferFactory; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import org.springframework.http.HttpCookie; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/DelegatingWebConnectionTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/DelegatingWebConnectionTests.java index cc5911e788f..c5fae22e884 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/DelegatingWebConnectionTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/DelegatingWebConnectionTests.java @@ -32,17 +32,17 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.stereotype.Controller; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.htmlunit.DelegatingWebConnection.DelegateWebConnection; import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.springframework.tests.EnabledForTestGroups; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * Unit and integration tests for {@link DelegatingWebConnection}. diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/MockMvcWebClientBuilderTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/MockMvcWebClientBuilderTests.java index da4918121d2..981e25d01a4 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/MockMvcWebClientBuilderTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/MockMvcWebClientBuilderTests.java @@ -30,10 +30,10 @@ import com.gargoylesoftware.htmlunit.util.Cookie; import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Configuration; +import org.springframework.core.test.fixtures.TestGroup; import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.springframework.tests.TestGroup; import org.springframework.web.bind.annotation.CookieValue; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PostMapping; diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/webdriver/MockMvcHtmlUnitDriverBuilderTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/webdriver/MockMvcHtmlUnitDriverBuilderTests.java index 7e9513c6bff..16670b908bd 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/webdriver/MockMvcHtmlUnitDriverBuilderTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/webdriver/MockMvcHtmlUnitDriverBuilderTests.java @@ -25,10 +25,10 @@ import org.junit.jupiter.api.Test; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import org.springframework.context.annotation.Configuration; +import org.springframework.core.test.fixtures.TestGroup; import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.springframework.tests.TestGroup; import org.springframework.web.bind.annotation.CookieValue; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; diff --git a/spring-tx/spring-tx.gradle b/spring-tx/spring-tx.gradle index aa2a6a3fa09..c026fb2991b 100644 --- a/spring-tx/spring-tx.gradle +++ b/spring-tx/spring-tx.gradle @@ -19,6 +19,7 @@ dependencies { optional("org.jetbrains.kotlin:kotlin-stdlib") optional("org.jetbrains.kotlinx:kotlinx-coroutines-core") optional("org.jetbrains.kotlinx:kotlinx-coroutines-reactor") + testCompile(testFixtures(project(":spring-core"))) testCompile("org.aspectj:aspectjweaver") testCompile("org.codehaus.groovy:groovy") testCompile("org.eclipse.persistence:javax.persistence") diff --git a/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionAttributeSourceTests.java b/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionAttributeSourceTests.java index a883fabc756..62ecf10fd5f 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionAttributeSourceTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/annotation/AnnotationTransactionAttributeSourceTests.java @@ -31,13 +31,13 @@ import org.junit.jupiter.api.Test; import org.springframework.aop.framework.Advised; import org.springframework.aop.framework.ProxyFactory; import org.springframework.core.annotation.AnnotationUtils; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.interceptor.NoRollbackRuleAttribute; import org.springframework.transaction.interceptor.RollbackRuleAttribute; import org.springframework.transaction.interceptor.RuleBasedTransactionAttribute; import org.springframework.transaction.interceptor.TransactionAttribute; import org.springframework.transaction.interceptor.TransactionInterceptor; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-tx/src/test/java/org/springframework/transaction/config/AnnotationDrivenTests.java b/spring-tx/src/test/java/org/springframework/transaction/config/AnnotationDrivenTests.java index e172b7d7e8d..114348dcbcb 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/config/AnnotationDrivenTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/config/AnnotationDrivenTests.java @@ -27,9 +27,9 @@ import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.tests.transaction.CallCountingTransactionManager; import org.springframework.transaction.support.TransactionSynchronizationManager; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeSourceAdvisorTests.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeSourceAdvisorTests.java index 213a591cf22..dc4d69b840b 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeSourceAdvisorTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionAttributeSourceAdvisorTests.java @@ -20,7 +20,7 @@ import java.util.Properties; import org.junit.jupiter.api.Test; -import org.springframework.util.SerializationTestUtils; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; /** * @author Rod Johnson diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionInterceptorTests.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionInterceptorTests.java index bc138e813ce..5eb598d6688 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionInterceptorTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/TransactionInterceptorTests.java @@ -24,13 +24,13 @@ import org.junit.jupiter.api.Test; import org.springframework.aop.framework.ProxyFactory; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.lang.Nullable; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionException; import org.springframework.transaction.TransactionManager; import org.springframework.transaction.TransactionStatus; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/spring-tx/src/test/java/org/springframework/transaction/support/JtaTransactionManagerSerializationTests.java b/spring-tx/src/test/java/org/springframework/transaction/support/JtaTransactionManagerSerializationTests.java index 978dc018d54..6e63dbbde83 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/support/JtaTransactionManagerSerializationTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/support/JtaTransactionManagerSerializationTests.java @@ -21,9 +21,9 @@ import javax.transaction.UserTransaction; import org.junit.jupiter.api.Test; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.tests.mock.jndi.SimpleNamingContextBuilder; import org.springframework.transaction.jta.JtaTransactionManager; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; diff --git a/spring-web/spring-web.gradle b/spring-web/spring-web.gradle index 6784d44483b..d8ee7176679 100644 --- a/spring-web/spring-web.gradle +++ b/spring-web/spring-web.gradle @@ -54,6 +54,7 @@ dependencies { optional("org.codehaus.groovy:groovy") optional("org.jetbrains.kotlin:kotlin-reflect") optional("org.jetbrains.kotlin:kotlin-stdlib") + testCompile(testFixtures(project(":spring-core"))) testCompile("io.projectreactor:reactor-test") testCompile("org.apache.taglibs:taglibs-standard-jstlel") testCompile("com.fasterxml.jackson.datatype:jackson-datatype-jdk8") diff --git a/spring-web/src/test/java/org/springframework/http/codec/CancelWithoutDemandCodecTests.java b/spring-web/src/test/java/org/springframework/http/codec/CancelWithoutDemandCodecTests.java index 9b50f64516f..22a30a2af02 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/CancelWithoutDemandCodecTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/CancelWithoutDemandCodecTests.java @@ -33,7 +33,7 @@ import org.springframework.core.ResolvableType; import org.springframework.core.codec.CharSequenceEncoder; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferFactory; -import org.springframework.core.io.buffer.LeakAwareDataBufferFactory; +import org.springframework.core.test.fixtures.io.buffer.LeakAwareDataBufferFactory; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.ReactiveHttpOutputMessage; diff --git a/spring-web/src/test/java/org/springframework/http/codec/FormHttpMessageReaderTests.java b/spring-web/src/test/java/org/springframework/http/codec/FormHttpMessageReaderTests.java index b75f0d81956..26bdaaa5b2f 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/FormHttpMessageReaderTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/FormHttpMessageReaderTests.java @@ -27,8 +27,8 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import org.springframework.core.ResolvableType; -import org.springframework.core.io.buffer.AbstractLeakCheckingTests; import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.test.fixtures.io.buffer.AbstractLeakCheckingTests; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; diff --git a/spring-web/src/test/java/org/springframework/http/codec/FormHttpMessageWriterTests.java b/spring-web/src/test/java/org/springframework/http/codec/FormHttpMessageWriterTests.java index 595444ac73d..152a3eb31cd 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/FormHttpMessageWriterTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/FormHttpMessageWriterTests.java @@ -25,10 +25,10 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import org.springframework.core.ResolvableType; -import org.springframework.core.io.buffer.AbstractLeakCheckingTests; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferUtils; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.test.fixtures.io.buffer.AbstractLeakCheckingTests; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; diff --git a/spring-web/src/test/java/org/springframework/http/codec/ServerSentEventHttpMessageReaderTests.java b/spring-web/src/test/java/org/springframework/http/codec/ServerSentEventHttpMessageReaderTests.java index fa13b1c0747..b213758b4b7 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/ServerSentEventHttpMessageReaderTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/ServerSentEventHttpMessageReaderTests.java @@ -26,8 +26,8 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import org.springframework.core.ResolvableType; -import org.springframework.core.io.buffer.AbstractLeakCheckingTests; import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.test.fixtures.io.buffer.AbstractLeakCheckingTests; import org.springframework.http.MediaType; import org.springframework.http.codec.json.Jackson2JsonDecoder; import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; diff --git a/spring-web/src/test/java/org/springframework/http/codec/ServerSentEventHttpMessageWriterTests.java b/spring-web/src/test/java/org/springframework/http/codec/ServerSentEventHttpMessageWriterTests.java index 68cf59d39c1..8e9bc707086 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/ServerSentEventHttpMessageWriterTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/ServerSentEventHttpMessageWriterTests.java @@ -29,10 +29,10 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import org.springframework.core.ResolvableType; -import org.springframework.core.io.buffer.AbstractDataBufferAllocatingTests; import org.springframework.core.io.buffer.DataBufferFactory; import org.springframework.core.io.buffer.DataBufferUtils; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.test.fixtures.io.buffer.AbstractDataBufferAllocatingTests; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import org.springframework.http.MediaType; import org.springframework.http.codec.json.Jackson2JsonEncoder; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; diff --git a/spring-web/src/test/java/org/springframework/http/codec/cbor/Jackson2CborDecoderTests.java b/spring-web/src/test/java/org/springframework/http/codec/cbor/Jackson2CborDecoderTests.java index a3bc2974820..4cfe5cb3868 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/cbor/Jackson2CborDecoderTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/cbor/Jackson2CborDecoderTests.java @@ -25,8 +25,8 @@ import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import org.springframework.core.ResolvableType; -import org.springframework.core.codec.AbstractDecoderTests; import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.test.fixtures.codec.AbstractDecoderTests; import org.springframework.http.codec.Pojo; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import org.springframework.util.MimeType; diff --git a/spring-web/src/test/java/org/springframework/http/codec/cbor/Jackson2CborEncoderTests.java b/spring-web/src/test/java/org/springframework/http/codec/cbor/Jackson2CborEncoderTests.java index 0241a13287d..e1293d55883 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/cbor/Jackson2CborEncoderTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/cbor/Jackson2CborEncoderTests.java @@ -25,9 +25,9 @@ import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import org.springframework.core.ResolvableType; -import org.springframework.core.io.buffer.AbstractLeakCheckingTests; import org.springframework.core.io.buffer.DataBuffer; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.test.fixtures.io.buffer.AbstractLeakCheckingTests; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import org.springframework.http.codec.Pojo; import org.springframework.http.codec.ServerSentEvent; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; diff --git a/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonDecoderTests.java b/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonDecoderTests.java index 3d4ffb8b84d..6ec074bafb8 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonDecoderTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonDecoderTests.java @@ -34,10 +34,10 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import org.springframework.core.ResolvableType; -import org.springframework.core.codec.AbstractDecoderTests; import org.springframework.core.codec.CodecException; import org.springframework.core.codec.DecodingException; import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.test.fixtures.codec.AbstractDecoderTests; import org.springframework.http.MediaType; import org.springframework.http.codec.Pojo; import org.springframework.http.codec.json.JacksonViewBean.MyJacksonView1; diff --git a/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonEncoderTests.java b/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonEncoderTests.java index 78083abba24..84a979c0fdc 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonEncoderTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonEncoderTests.java @@ -32,9 +32,9 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import org.springframework.core.ResolvableType; -import org.springframework.core.codec.AbstractEncoderTests; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferUtils; +import org.springframework.core.test.fixtures.codec.AbstractEncoderTests; import org.springframework.http.MediaType; import org.springframework.http.codec.Pojo; import org.springframework.http.codec.ServerSentEvent; diff --git a/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2SmileDecoderTests.java b/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2SmileDecoderTests.java index ffb301459eb..13a8326fd7c 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2SmileDecoderTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2SmileDecoderTests.java @@ -25,8 +25,8 @@ import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import org.springframework.core.ResolvableType; -import org.springframework.core.codec.AbstractDecoderTests; import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.test.fixtures.codec.AbstractDecoderTests; import org.springframework.http.codec.Pojo; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import org.springframework.util.MimeType; diff --git a/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2SmileEncoderTests.java b/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2SmileEncoderTests.java index 8890c7e9373..3fdffe872e5 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2SmileEncoderTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2SmileEncoderTests.java @@ -28,9 +28,9 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import org.springframework.core.ResolvableType; -import org.springframework.core.codec.AbstractEncoderTests; import org.springframework.core.io.buffer.DataBuffer; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.test.fixtures.codec.AbstractEncoderTests; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import org.springframework.http.codec.Pojo; import org.springframework.http.codec.ServerSentEvent; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; diff --git a/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2TokenizerTests.java b/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2TokenizerTests.java index 6f829a056ec..20dc4d994b5 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2TokenizerTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/json/Jackson2TokenizerTests.java @@ -33,9 +33,9 @@ import reactor.core.publisher.Flux; import reactor.test.StepVerifier; import org.springframework.core.codec.DecodingException; -import org.springframework.core.io.buffer.AbstractLeakCheckingTests; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferLimitException; +import org.springframework.core.test.fixtures.io.buffer.AbstractLeakCheckingTests; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; diff --git a/spring-web/src/test/java/org/springframework/http/codec/multipart/MultipartHttpMessageWriterTests.java b/spring-web/src/test/java/org/springframework/http/codec/multipart/MultipartHttpMessageWriterTests.java index d1ef5e26f02..87e1f3300dc 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/multipart/MultipartHttpMessageWriterTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/multipart/MultipartHttpMessageWriterTests.java @@ -32,10 +32,10 @@ import org.springframework.core.ResolvableType; import org.springframework.core.codec.StringDecoder; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; -import org.springframework.core.io.buffer.AbstractLeakCheckingTests; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferUtils; import org.springframework.core.io.buffer.DefaultDataBufferFactory; +import org.springframework.core.test.fixtures.io.buffer.AbstractLeakCheckingTests; import org.springframework.http.HttpEntity; import org.springframework.http.MediaType; import org.springframework.http.client.MultipartBodyBuilder; diff --git a/spring-web/src/test/java/org/springframework/http/codec/multipart/SynchronossPartHttpMessageReaderTests.java b/spring-web/src/test/java/org/springframework/http/codec/multipart/SynchronossPartHttpMessageReaderTests.java index 8c09becc439..b2fb11b3c77 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/multipart/SynchronossPartHttpMessageReaderTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/multipart/SynchronossPartHttpMessageReaderTests.java @@ -34,10 +34,10 @@ import reactor.test.StepVerifier; import org.springframework.core.ResolvableType; import org.springframework.core.codec.DecodingException; import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.buffer.AbstractLeakCheckingTests; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferUtils; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.test.fixtures.io.buffer.AbstractLeakCheckingTests; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.http.client.MultipartBodyBuilder; diff --git a/spring-web/src/test/java/org/springframework/http/codec/protobuf/ProtobufDecoderTests.java b/spring-web/src/test/java/org/springframework/http/codec/protobuf/ProtobufDecoderTests.java index 20b4e490518..1d3c367ce02 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/protobuf/ProtobufDecoderTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/protobuf/ProtobufDecoderTests.java @@ -26,10 +26,10 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import org.springframework.core.ResolvableType; -import org.springframework.core.codec.AbstractDecoderTests; import org.springframework.core.codec.DecodingException; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferUtils; +import org.springframework.core.test.fixtures.codec.AbstractDecoderTests; import org.springframework.http.MediaType; import org.springframework.protobuf.Msg; import org.springframework.protobuf.SecondMsg; diff --git a/spring-web/src/test/java/org/springframework/http/codec/protobuf/ProtobufEncoderTests.java b/spring-web/src/test/java/org/springframework/http/codec/protobuf/ProtobufEncoderTests.java index 8bbe558118d..f0bfbd15a70 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/protobuf/ProtobufEncoderTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/protobuf/ProtobufEncoderTests.java @@ -25,9 +25,9 @@ import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import org.springframework.core.codec.AbstractEncoderTests; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferUtils; +import org.springframework.core.test.fixtures.codec.AbstractEncoderTests; import org.springframework.http.MediaType; import org.springframework.protobuf.Msg; import org.springframework.protobuf.SecondMsg; diff --git a/spring-web/src/test/java/org/springframework/http/codec/xml/Jaxb2XmlDecoderTests.java b/spring-web/src/test/java/org/springframework/http/codec/xml/Jaxb2XmlDecoderTests.java index 7e969c18ee4..9bc7894d1a0 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/xml/Jaxb2XmlDecoderTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/xml/Jaxb2XmlDecoderTests.java @@ -29,8 +29,8 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import org.springframework.core.ResolvableType; -import org.springframework.core.io.buffer.AbstractLeakCheckingTests; import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.test.fixtures.io.buffer.AbstractLeakCheckingTests; import org.springframework.http.MediaType; import org.springframework.http.codec.Pojo; import org.springframework.http.codec.xml.jaxb.XmlRootElement; diff --git a/spring-web/src/test/java/org/springframework/http/codec/xml/Jaxb2XmlEncoderTests.java b/spring-web/src/test/java/org/springframework/http/codec/xml/Jaxb2XmlEncoderTests.java index 89def2af9e2..6522f57bf0f 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/xml/Jaxb2XmlEncoderTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/xml/Jaxb2XmlEncoderTests.java @@ -29,11 +29,11 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import org.springframework.core.ResolvableType; -import org.springframework.core.codec.AbstractEncoderTests; import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.test.fixtures.codec.AbstractEncoderTests; +import org.springframework.core.test.fixtures.xml.XmlContent; import org.springframework.http.MediaType; import org.springframework.http.codec.Pojo; -import org.springframework.tests.XmlContent; import static java.nio.charset.StandardCharsets.UTF_8; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-web/src/test/java/org/springframework/http/codec/xml/XmlEventDecoderTests.java b/spring-web/src/test/java/org/springframework/http/codec/xml/XmlEventDecoderTests.java index eb1a7b38910..3bd9b8ff50a 100644 --- a/spring-web/src/test/java/org/springframework/http/codec/xml/XmlEventDecoderTests.java +++ b/spring-web/src/test/java/org/springframework/http/codec/xml/XmlEventDecoderTests.java @@ -26,9 +26,9 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; -import org.springframework.core.io.buffer.AbstractLeakCheckingTests; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferLimitException; +import org.springframework.core.test.fixtures.io.buffer.AbstractLeakCheckingTests; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-web/src/test/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverterTests.java index 1b057e584ae..4f733570186 100644 --- a/spring-web/src/test/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverterTests.java +++ b/spring-web/src/test/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverterTests.java @@ -31,10 +31,10 @@ import org.xmlunit.diff.DefaultNodeMatcher; import org.xmlunit.diff.ElementSelectors; import org.xmlunit.diff.NodeMatcher; +import org.springframework.core.test.fixtures.xml.XmlContent; import org.springframework.http.MediaType; import org.springframework.http.MockHttpInputMessage; import org.springframework.http.MockHttpOutputMessage; -import org.springframework.tests.XmlContent; import static java.util.Collections.singletonMap; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-web/src/test/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverterTests.java index 928c2cb9e1f..cea67dac411 100644 --- a/spring-web/src/test/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverterTests.java +++ b/spring-web/src/test/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverterTests.java @@ -27,10 +27,10 @@ import com.rometools.rome.feed.rss.Channel; import com.rometools.rome.feed.rss.Item; import org.junit.jupiter.api.Test; +import org.springframework.core.test.fixtures.xml.XmlContent; import org.springframework.http.MediaType; import org.springframework.http.MockHttpInputMessage; import org.springframework.http.MockHttpOutputMessage; -import org.springframework.tests.XmlContent; import static java.util.Collections.singletonMap; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverterTests.java index 49c69b616a6..277eb3291fa 100644 --- a/spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverterTests.java +++ b/spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverterTests.java @@ -36,11 +36,11 @@ import org.springframework.aop.framework.AopProxy; import org.springframework.aop.framework.DefaultAopProxyFactory; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; +import org.springframework.core.test.fixtures.xml.XmlContent; import org.springframework.http.MediaType; import org.springframework.http.MockHttpInputMessage; import org.springframework.http.MockHttpOutputMessage; import org.springframework.http.converter.HttpMessageNotReadableException; -import org.springframework.tests.XmlContent; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/spring-web/src/test/java/org/springframework/http/converter/xml/SourceHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/xml/SourceHttpMessageConverterTests.java index 38bc72c0c3b..53ccbb62f9e 100644 --- a/spring-web/src/test/java/org/springframework/http/converter/xml/SourceHttpMessageConverterTests.java +++ b/spring-web/src/test/java/org/springframework/http/converter/xml/SourceHttpMessageConverterTests.java @@ -41,11 +41,11 @@ import org.xml.sax.helpers.DefaultHandler; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; +import org.springframework.core.test.fixtures.xml.XmlContent; import org.springframework.http.MediaType; import org.springframework.http.MockHttpInputMessage; import org.springframework.http.MockHttpOutputMessage; import org.springframework.http.converter.HttpMessageNotReadableException; -import org.springframework.tests.XmlContent; import org.springframework.util.FileCopyUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-web/src/test/java/org/springframework/http/server/reactive/ChannelSendOperatorTests.java b/spring-web/src/test/java/org/springframework/http/server/reactive/ChannelSendOperatorTests.java index 6c5918a13cd..24d14c548f4 100644 --- a/spring-web/src/test/java/org/springframework/http/server/reactive/ChannelSendOperatorTests.java +++ b/spring-web/src/test/java/org/springframework/http/server/reactive/ChannelSendOperatorTests.java @@ -35,7 +35,7 @@ import reactor.core.publisher.Signal; import reactor.test.StepVerifier; import org.springframework.core.io.buffer.DataBuffer; -import org.springframework.core.io.buffer.LeakAwareDataBufferFactory; +import org.springframework.core.test.fixtures.io.buffer.LeakAwareDataBufferFactory; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-web/src/test/java/org/springframework/http/server/reactive/HttpHeadResponseDecoratorTests.java b/spring-web/src/test/java/org/springframework/http/server/reactive/HttpHeadResponseDecoratorTests.java index b34104c7c1c..83ccd8b089e 100644 --- a/spring-web/src/test/java/org/springframework/http/server/reactive/HttpHeadResponseDecoratorTests.java +++ b/spring-web/src/test/java/org/springframework/http/server/reactive/HttpHeadResponseDecoratorTests.java @@ -23,8 +23,8 @@ import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import org.springframework.core.io.buffer.DataBuffer; -import org.springframework.core.io.buffer.LeakAwareDataBufferFactory; import org.springframework.core.io.buffer.NettyDataBufferFactory; +import org.springframework.core.test.fixtures.io.buffer.LeakAwareDataBufferFactory; import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-web/src/test/java/org/springframework/web/bind/ServletRequestUtilsTests.java b/spring-web/src/test/java/org/springframework/web/bind/ServletRequestUtilsTests.java index 8472653a717..f459f4f04aa 100644 --- a/spring-web/src/test/java/org/springframework/web/bind/ServletRequestUtilsTests.java +++ b/spring-web/src/test/java/org/springframework/web/bind/ServletRequestUtilsTests.java @@ -18,13 +18,13 @@ package org.springframework.web.bind; import org.junit.jupiter.api.Test; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.mock.web.test.MockHttpServletRequest; -import org.springframework.tests.EnabledForTestGroups; import org.springframework.util.StopWatch; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * @author Juergen Hoeller diff --git a/spring-web/src/test/java/org/springframework/web/context/request/SessionScopeTests.java b/spring-web/src/test/java/org/springframework/web/context/request/SessionScopeTests.java index 9d296bbe642..25c0898ed87 100644 --- a/spring-web/src/test/java/org/springframework/web/context/request/SessionScopeTests.java +++ b/spring-web/src/test/java/org/springframework/web/context/request/SessionScopeTests.java @@ -29,11 +29,11 @@ import org.springframework.beans.factory.config.DestructionAwareBeanPostProcesso import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.ClassPathResource; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.mock.web.test.MockHttpSession; import org.springframework.tests.sample.beans.DerivedTestBean; import org.springframework.tests.sample.beans.TestBean; -import org.springframework.util.SerializationTestUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-webflux/spring-webflux.gradle b/spring-webflux/spring-webflux.gradle index e056a47f283..900d53484b4 100644 --- a/spring-webflux/spring-webflux.gradle +++ b/spring-webflux/spring-webflux.gradle @@ -30,6 +30,8 @@ dependencies { optional("com.google.protobuf:protobuf-java-util") optional("org.jetbrains.kotlinx:kotlinx-coroutines-core") optional("org.jetbrains.kotlinx:kotlinx-coroutines-reactor") + testCompile(project(":kotlin-coroutines")) + testCompile(testFixtures(project(":spring-core"))) testCompile("javax.xml.bind:jaxb-api") testCompile("com.fasterxml:aalto-xml") testCompile("org.hibernate:hibernate-validator") @@ -44,7 +46,6 @@ dependencies { testCompile("org.eclipse.jetty:jetty-reactive-httpclient") testCompile("org.junit.platform:junit-platform-launcher") testCompile("com.squareup.okhttp3:mockwebserver") - testCompile(project(":kotlin-coroutines")) testCompile("org.jetbrains.kotlin:kotlin-script-runtime") testRuntime("org.jetbrains.kotlin:kotlin-scripting-jsr223-embeddable") testRuntime("org.jruby:jruby") diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/config/ResourceHandlerRegistryTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/config/ResourceHandlerRegistryTests.java index 5c7dae213d5..dec3055660d 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/config/ResourceHandlerRegistryTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/config/ResourceHandlerRegistryTests.java @@ -28,7 +28,7 @@ import reactor.test.StepVerifier; import org.springframework.cache.concurrent.ConcurrentMapCache; import org.springframework.context.support.GenericApplicationContext; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import org.springframework.http.CacheControl; import org.springframework.http.server.PathContainer; import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyInsertersTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyInsertersTests.java index edcdb983ee5..2a37cf84781 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyInsertersTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/BodyInsertersTests.java @@ -45,7 +45,7 @@ import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferUtils; import org.springframework.core.io.buffer.DefaultDataBuffer; import org.springframework.core.io.buffer.DefaultDataBufferFactory; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import org.springframework.http.HttpMethod; import org.springframework.http.HttpRange; import org.springframework.http.ReactiveHttpOutputMessage; diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/ExchangeFilterFunctionsTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/ExchangeFilterFunctionsTests.java index b6b6e42182c..64e016e55ec 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/ExchangeFilterFunctionsTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/ExchangeFilterFunctionsTests.java @@ -27,7 +27,7 @@ import reactor.test.StepVerifier; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferUtils; import org.springframework.core.io.buffer.DefaultDataBufferFactory; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientDataBufferAllocatingTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientDataBufferAllocatingTests.java index 758d8f625a5..a2e80fe6403 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientDataBufferAllocatingTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientDataBufferAllocatingTests.java @@ -32,9 +32,9 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import org.springframework.core.ParameterizedTypeReference; -import org.springframework.core.io.buffer.AbstractDataBufferAllocatingTests; import org.springframework.core.io.buffer.DataBufferFactory; import org.springframework.core.io.buffer.NettyDataBufferFactory; +import org.springframework.core.test.fixtures.io.buffer.AbstractDataBufferAllocatingTests; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/resource/ResourceWebHandlerTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/resource/ResourceWebHandlerTests.java index 83821b2d025..838a11cca3a 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/resource/ResourceWebHandlerTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/resource/ResourceWebHandlerTests.java @@ -39,7 +39,7 @@ import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferFactory; import org.springframework.core.io.buffer.DataBufferUtils; import org.springframework.core.io.buffer.DefaultDataBufferFactory; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import org.springframework.http.CacheControl; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/MessageWriterResultHandlerTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/MessageWriterResultHandlerTests.java index b695cc9ae6c..5da68b75be6 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/MessageWriterResultHandlerTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/MessageWriterResultHandlerTests.java @@ -54,7 +54,7 @@ import org.springframework.web.reactive.accept.RequestedContentTypeResolver; import org.springframework.web.reactive.accept.RequestedContentTypeResolverBuilder; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.core.io.buffer.support.DataBufferTestUtils.dumpString; +import static org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils.dumpString; import static org.springframework.http.MediaType.APPLICATION_JSON; import static org.springframework.web.method.ResolvableMethod.on; import static org.springframework.web.reactive.HandlerMapping.PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE; diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestPartMethodArgumentResolverTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestPartMethodArgumentResolverTests.java index 26019f40b9f..d55746f8381 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestPartMethodArgumentResolverTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestPartMethodArgumentResolverTests.java @@ -33,7 +33,7 @@ import org.springframework.core.MethodParameter; import org.springframework.core.ReactiveAdapterRegistry; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferUtils; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.http.client.MultipartBodyBuilder; diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityResultHandlerTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityResultHandlerTests.java index 7a302b6ab4d..58c90779e1f 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityResultHandlerTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityResultHandlerTests.java @@ -40,7 +40,7 @@ import org.springframework.core.MethodParameter; import org.springframework.core.ResolvableType; import org.springframework.core.codec.ByteBufferEncoder; import org.springframework.core.codec.CharSequenceEncoder; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/HttpMessageWriterViewTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/HttpMessageWriterViewTests.java index 87803b6a703..acee2437d10 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/HttpMessageWriterViewTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/HttpMessageWriterViewTests.java @@ -29,7 +29,7 @@ import reactor.test.StepVerifier; import org.springframework.core.codec.CharSequenceEncoder; import org.springframework.core.io.buffer.DataBuffer; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import org.springframework.http.MediaType; import org.springframework.http.codec.json.Jackson2JsonEncoder; import org.springframework.http.codec.xml.Jaxb2XmlEncoder; diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandlerTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandlerTests.java index af52ff8b444..b461aaaa076 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandlerTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandlerTests.java @@ -38,7 +38,7 @@ import org.springframework.core.Ordered; import org.springframework.core.ResolvableType; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DefaultDataBufferFactory; -import org.springframework.core.io.buffer.support.DataBufferTestUtils; +import org.springframework.core.test.fixtures.io.buffer.DataBufferTestUtils; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.server.reactive.ServerHttpResponse; diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/ZeroDemandResponse.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/ZeroDemandResponse.java index e75fcdf783a..d7e150bac8d 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/ZeroDemandResponse.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/ZeroDemandResponse.java @@ -24,7 +24,7 @@ import reactor.core.publisher.Mono; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferFactory; -import org.springframework.core.io.buffer.LeakAwareDataBufferFactory; +import org.springframework.core.test.fixtures.io.buffer.LeakAwareDataBufferFactory; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseCookie; diff --git a/spring-webmvc/spring-webmvc.gradle b/spring-webmvc/spring-webmvc.gradle index 8951a318f8d..f118436eb7d 100644 --- a/spring-webmvc/spring-webmvc.gradle +++ b/spring-webmvc/spring-webmvc.gradle @@ -35,6 +35,7 @@ dependencies { optional("org.jetbrains.kotlin:kotlin-reflect") optional("org.jetbrains.kotlin:kotlin-stdlib") optional("org.reactivestreams:reactive-streams") + testCompile(testFixtures(project(":spring-core"))) testCompile("javax.servlet:javax.servlet-api") testCompile("org.eclipse.jetty:jetty-servlet") { exclude group: "javax.servlet", module: "javax.servlet" diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/DispatcherServletTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/DispatcherServletTests.java index 4fa838cfd3e..22486a37426 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/DispatcherServletTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/DispatcherServletTests.java @@ -35,7 +35,6 @@ import org.springframework.beans.PropertyValue; import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.DummyEnvironment; import org.springframework.http.HttpHeaders; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.mock.web.test.MockHttpServletResponse; diff --git a/spring-core/src/test/java/org/springframework/core/env/DummyEnvironment.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/DummyEnvironment.java similarity index 88% rename from spring-core/src/test/java/org/springframework/core/env/DummyEnvironment.java rename to spring-webmvc/src/test/java/org/springframework/web/servlet/DummyEnvironment.java index bc1cd17899a..a4f4343b367 100644 --- a/spring-core/src/test/java/org/springframework/core/env/DummyEnvironment.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/DummyEnvironment.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -14,9 +14,12 @@ * limitations under the License. */ -package org.springframework.core.env; +package org.springframework.web.servlet; -public class DummyEnvironment implements Environment { +import org.springframework.core.env.Environment; +import org.springframework.core.env.Profiles; + +class DummyEnvironment implements Environment { @Override public boolean containsProperty(String key) { diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletAnnotationControllerHandlerMethodTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletAnnotationControllerHandlerMethodTests.java index 565f785d296..bbcd9379f55 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletAnnotationControllerHandlerMethodTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletAnnotationControllerHandlerMethodTests.java @@ -74,6 +74,7 @@ import org.springframework.context.annotation.AnnotationConfigUtils; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.MethodParameter; import org.springframework.core.convert.converter.Converter; +import org.springframework.core.test.fixtures.io.SerializationTestUtils; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.support.DefaultFormattingConversionService; import org.springframework.format.support.FormattingConversionServiceFactoryBean; @@ -110,7 +111,6 @@ import org.springframework.ui.Model; import org.springframework.ui.ModelMap; import org.springframework.util.Assert; import org.springframework.util.MultiValueMap; -import org.springframework.util.SerializationTestUtils; import org.springframework.util.StringUtils; import org.springframework.validation.BindingResult; import org.springframework.validation.Errors; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/feed/AtomFeedViewTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/feed/AtomFeedViewTests.java index 38f8772e727..f8b7bc7c535 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/feed/AtomFeedViewTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/feed/AtomFeedViewTests.java @@ -29,9 +29,9 @@ import com.rometools.rome.feed.atom.Entry; import com.rometools.rome.feed.atom.Feed; import org.junit.jupiter.api.Test; +import org.springframework.core.test.fixtures.xml.XmlContent; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.mock.web.test.MockHttpServletResponse; -import org.springframework.tests.XmlContent; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/feed/RssFeedViewTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/feed/RssFeedViewTests.java index a70d0d5d451..bc4a2ac49f3 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/feed/RssFeedViewTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/feed/RssFeedViewTests.java @@ -29,9 +29,9 @@ import com.rometools.rome.feed.rss.Description; import com.rometools.rome.feed.rss.Item; import org.junit.jupiter.api.Test; +import org.springframework.core.test.fixtures.xml.XmlContent; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.mock.web.test.MockHttpServletResponse; -import org.springframework.tests.XmlContent; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-websocket/spring-websocket.gradle b/spring-websocket/spring-websocket.gradle index 96355eef536..614f3c40175 100644 --- a/spring-websocket/spring-websocket.gradle +++ b/spring-websocket/spring-websocket.gradle @@ -21,6 +21,7 @@ dependencies { optional("io.undertow:undertow-servlet") optional("io.undertow:undertow-websockets-jsr") optional("com.fasterxml.jackson.core:jackson-databind") + testCompile(testFixtures(project(":spring-core"))) testCompile("org.apache.tomcat.embed:tomcat-embed-core") testCompile("org.apache.tomcat.embed:tomcat-embed-websocket") testCompile("io.projectreactor.netty:reactor-netty") diff --git a/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/AbstractSockJsIntegrationTests.java b/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/AbstractSockJsIntegrationTests.java index bb78d3fa2e9..8af8d83e3d0 100644 --- a/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/AbstractSockJsIntegrationTests.java +++ b/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/AbstractSockJsIntegrationTests.java @@ -49,10 +49,10 @@ import org.junit.jupiter.api.Timeout; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.test.fixtures.EnabledForTestGroups; import org.springframework.http.HttpHeaders; import org.springframework.http.server.ServletServerHttpRequest; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; -import org.springframework.tests.EnabledForTestGroups; import org.springframework.util.concurrent.ListenableFutureCallback; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.socket.TextMessage; @@ -69,7 +69,7 @@ import org.springframework.web.socket.server.support.DefaultHandshakeHandler; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; -import static org.springframework.tests.TestGroup.PERFORMANCE; +import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE; /** * Abstract base class for integration tests using the diff --git a/src/checkstyle/checkstyle-suppressions.xml b/src/checkstyle/checkstyle-suppressions.xml index 2726dce2576..1c8fbe7218a 100644 --- a/src/checkstyle/checkstyle-suppressions.xml +++ b/src/checkstyle/checkstyle-suppressions.xml @@ -3,9 +3,9 @@ - - - + + + @@ -25,7 +25,7 @@ - +