Browse Source

Use Gradle test fixture support for spring-core

See gh-23550
pull/24287/head
Sam Brannen 6 years ago
parent
commit
5718bf424b
  1. 1
      build.gradle
  2. 27
      buildSrc/src/main/java/org/springframework/build/testsources/TestSourcesPlugin.java
  3. 1
      integration-tests/integration-tests.gradle
  4. 2
      integration-tests/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java
  5. 4
      integration-tests/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java
  6. 1
      spring-aop/spring-aop.gradle
  7. 2
      spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java
  8. 2
      spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerEventTests.java
  9. 2
      spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java
  10. 2
      spring-aop/src/test/java/org/springframework/aop/config/TopLevelAopTagTests.java
  11. 2
      spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java
  12. 2
      spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java
  13. 2
      spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java
  14. 2
      spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java
  15. 2
      spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java
  16. 2
      spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java
  17. 2
      spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java
  18. 4
      spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java
  19. 2
      spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java
  20. 2
      spring-aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java
  21. 4
      spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java
  22. 2
      spring-aop/src/test/java/org/springframework/aop/target/CommonsPool2TargetSourceProxyTests.java
  23. 4
      spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java
  24. 2
      spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java
  25. 2
      spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java
  26. 2
      spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java
  27. 2
      spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java
  28. 4
      spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java
  29. 2
      spring-aop/src/test/java/org/springframework/tests/aop/interceptor/TimestampIntroductionInterceptor.java
  30. 1
      spring-aspects/spring-aspects.gradle
  31. 4
      spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspectTests.java
  32. 1
      spring-beans/spring-beans.gradle
  33. 6
      spring-beans/src/test/java/org/springframework/beans/AbstractPropertyAccessorTests.java
  34. 2
      spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java
  35. 6
      spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java
  36. 8
      spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java
  37. 4
      spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java
  38. 2
      spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java
  39. 2
      spring-beans/src/test/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurerTests.java
  40. 2
      spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java
  41. 2
      spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests.java
  42. 4
      spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java
  43. 2
      spring-beans/src/test/java/org/springframework/beans/factory/config/PropertiesFactoryBeanTests.java
  44. 2
      spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java
  45. 2
      spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java
  46. 2
      spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests.java
  47. 2
      spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java
  48. 4
      spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java
  49. 3
      spring-context-indexer/src/test/java/org/springframework/context/index/sample/SampleNone.java
  50. 33
      spring-context-indexer/src/test/java/org/springframework/context/index/sample/Scope.java
  51. 1
      spring-context-support/spring-context-support.gradle
  52. 4
      spring-context-support/src/test/java/org/springframework/cache/ehcache/EhCacheCacheTests.java
  53. 4
      spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java
  54. 2
      spring-context-support/src/test/java/org/springframework/validation/beanvalidation2/SpringValidatorAdapterTests.java
  55. 1
      spring-context/spring-context.gradle
  56. 6
      spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java
  57. 10
      spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java
  58. 4
      spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java
  59. 2
      spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorTests.java
  60. 2
      spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java
  61. 2
      spring-context/src/test/java/org/springframework/aop/target/CommonsPool2TargetSourceTests.java
  62. 2
      spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java
  63. 6
      spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java
  64. 2
      spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java
  65. 2
      spring-context/src/test/java/org/springframework/context/annotation/ComponentScanAnnotationIntegrationTests.java
  66. 2
      spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserScopedProxyTests.java
  67. 8
      spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java
  68. 2
      spring-context/src/test/java/org/springframework/context/expression/EnvironmentAccessorIntegrationTests.java
  69. 4
      spring-context/src/test/java/org/springframework/context/support/DefaultLifecycleProcessorTests.java
  70. 5
      spring-context/src/test/java/org/springframework/context/support/EnvironmentSecurityManagerIntegrationTests.java
  71. 2
      spring-context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java
  72. 1
      spring-context/src/test/java/org/springframework/mock/env/MockEnvironment.java
  73. 4
      spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java
  74. 4
      spring-context/src/test/java/org/springframework/scheduling/concurrent/ScheduledExecutorFactoryBeanTests.java
  75. 4
      spring-context/src/test/java/org/springframework/scripting/support/ScriptFactoryPostProcessorTests.java
  76. 2
      spring-context/src/test/java/org/springframework/validation/beanvalidation/SpringValidatorAdapterTests.java
  77. 2
      spring-context/src/test/kotlin/org/springframework/context/support/BeanDefinitionDslTests.kt
  78. 6
      spring-core/spring-core.gradle
  79. 2
      spring-core/src/test/java/example/type/AspectJTypeFilterTestsTypes.java
  80. 4
      spring-core/src/test/java/org/springframework/core/annotation/AnnotatedElementUtilsTests.java
  81. 4
      spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java
  82. 6
      spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsTests.java
  83. 1
      spring-core/src/test/java/org/springframework/core/codec/ByteArrayDecoderTests.java
  84. 1
      spring-core/src/test/java/org/springframework/core/codec/ByteArrayEncoderTests.java
  85. 1
      spring-core/src/test/java/org/springframework/core/codec/ByteBufferDecoderTests.java
  86. 1
      spring-core/src/test/java/org/springframework/core/codec/ByteBufferEncoderTests.java
  87. 1
      spring-core/src/test/java/org/springframework/core/codec/CharSequenceEncoderTests.java
  88. 1
      spring-core/src/test/java/org/springframework/core/codec/DataBufferDecoderTests.java
  89. 1
      spring-core/src/test/java/org/springframework/core/codec/DataBufferEncoderTests.java
  90. 1
      spring-core/src/test/java/org/springframework/core/codec/ResourceDecoderTests.java
  91. 1
      spring-core/src/test/java/org/springframework/core/codec/ResourceEncoderTests.java
  92. 4
      spring-core/src/test/java/org/springframework/core/codec/ResourceRegionEncoderTests.java
  93. 1
      spring-core/src/test/java/org/springframework/core/codec/StringDecoderTests.java
  94. 4
      spring-core/src/test/java/org/springframework/core/convert/converter/DefaultConversionServiceTests.java
  95. 4
      spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java
  96. 2
      spring-core/src/test/java/org/springframework/core/env/MutablePropertySourcesTests.java
  97. 2
      spring-core/src/test/java/org/springframework/core/env/PropertySourcesPropertyResolverTests.java
  98. 73
      spring-core/src/test/java/org/springframework/core/env/StandardEnvironmentTests.java
  99. 2
      spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferTests.java
  100. 3
      spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferUtilsTests.java
  101. Some files were not shown because too many files have changed in this diff Show More

1
build.gradle

@ -308,6 +308,7 @@ configure([rootProject] + javaProjects) { project -> @@ -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"

27
buildSrc/src/main/java/org/springframework/build/testsources/TestSourcesPlugin.java

@ -55,9 +55,16 @@ public class TestSourcesPlugin implements Plugin<Project> { @@ -55,9 +55,16 @@ public class TestSourcesPlugin implements Plugin<Project> {
OptionalDependenciesPlugin.OPTIONAL_CONFIGURATION_NAME,
JavaPlugin.TEST_COMPILE_CONFIGURATION_NAME);
/**
* Projects which will not be automatically added as a test dependency.
* <p>This is used to assist with the migration to Gradle test fixtures.
*/
private static final List<String> 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<Project> { @@ -83,13 +90,17 @@ public class TestSourcesPlugin implements Plugin<Project> {
}
}
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);
});
}
}
}

1
integration-tests/integration-tests.gradle

@ -7,6 +7,7 @@ dependencies { @@ -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"))

2
integration-tests/src/test/java/org/springframework/aop/config/AopNamespaceHandlerScopeIntegrationTests.java

@ -21,12 +21,12 @@ import org.junit.jupiter.api.Test; @@ -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;

4
integration-tests/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java

@ -28,10 +28,10 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -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; @@ -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

1
spring-aop/spring-aop.gradle

@ -6,4 +6,5 @@ dependencies { @@ -6,4 +6,5 @@ dependencies {
optional("org.aspectj:aspectjweaver")
optional("org.apache.commons:commons-pool2")
optional("com.jamonapi:jamon")
testCompile(testFixtures(project(":spring-core")))
}

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

@ -26,7 +26,7 @@ import org.aspectj.lang.annotation.Aspect; @@ -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;

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

@ -33,7 +33,7 @@ import org.springframework.core.io.Resource; @@ -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

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

@ -24,7 +24,7 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; @@ -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

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

@ -22,7 +22,7 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; @@ -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 &lt;aop:config/&gt; element can be used as a top level element.

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

@ -25,7 +25,7 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; @@ -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

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

@ -36,7 +36,7 @@ import org.springframework.aop.support.DefaultPointcutAdvisor; @@ -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;

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

@ -22,10 +22,10 @@ import org.junit.jupiter.api.Test; @@ -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;

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

@ -25,7 +25,7 @@ import org.springframework.tests.sample.beans.ITestBean; @@ -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

2
spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java

@ -24,7 +24,7 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; @@ -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

2
spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java

@ -21,8 +21,8 @@ import java.io.IOException; @@ -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;

2
spring-aop/src/test/java/org/springframework/aop/support/AopUtilsTests.java

@ -25,10 +25,10 @@ import org.springframework.aop.MethodMatcher; @@ -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;

4
spring-aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java

@ -24,7 +24,8 @@ import org.junit.jupiter.api.Test; @@ -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; @@ -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;

2
spring-aop/src/test/java/org/springframework/aop/support/MethodMatchersTests.java

@ -21,11 +21,11 @@ import java.lang.reflect.Method; @@ -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;

2
spring-aop/src/test/java/org/springframework/aop/support/NameMatchMethodPointcutTests.java

@ -21,11 +21,11 @@ import org.junit.jupiter.api.Test; @@ -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;

4
spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java

@ -22,15 +22,15 @@ import org.springframework.aop.framework.Advised; @@ -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

2
spring-aop/src/test/java/org/springframework/aop/target/CommonsPool2TargetSourceProxyTests.java

@ -25,7 +25,7 @@ import org.springframework.core.io.Resource; @@ -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

4
spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java

@ -25,15 +25,15 @@ import org.springframework.aop.framework.ProxyFactory; @@ -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

2
spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java

@ -26,7 +26,7 @@ import org.springframework.core.io.Resource; @@ -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

2
spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java

@ -23,9 +23,9 @@ import org.springframework.beans.MutablePropertyValues; @@ -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;

2
spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java

@ -24,7 +24,7 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; @@ -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

2
spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java

@ -25,7 +25,7 @@ import org.springframework.tests.sample.beans.ITestBean; @@ -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

4
spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java

@ -18,10 +18,10 @@ package org.springframework.aop.target.dynamic; @@ -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

2
spring-aop/src/test/java/org/springframework/tests/aop/interceptor/TimestampIntroductionInterceptor.java

@ -17,7 +17,7 @@ @@ -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

1
spring-aspects/spring-aspects.gradle

@ -24,6 +24,7 @@ dependencies { @@ -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")
}

4
spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspectTests.java

@ -30,15 +30,15 @@ import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler; @@ -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}.

1
spring-beans/spring-beans.gradle

@ -10,6 +10,7 @@ dependencies { @@ -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")
}

6
spring-beans/src/test/java/org/springframework/beans/AbstractPropertyAccessorTests.java

@ -47,9 +47,9 @@ import org.springframework.core.convert.ConversionFailedException; @@ -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; @@ -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.

2
spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java

@ -37,7 +37,7 @@ import org.springframework.tests.sample.beans.factory.DummyFactory; @@ -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

6
spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java

@ -33,11 +33,11 @@ import org.junit.jupiter.api.Test; @@ -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

8
spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java

@ -86,10 +86,11 @@ import org.springframework.core.convert.support.DefaultConversionService; @@ -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; @@ -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;

4
spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java

@ -27,11 +27,11 @@ import org.springframework.beans.factory.config.BeanPostProcessor; @@ -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

2
spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java

@ -68,12 +68,12 @@ import org.springframework.core.Ordered; @@ -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;

2
spring-beans/src/test/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurerTests.java

@ -25,7 +25,7 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; @@ -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}.

2
spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java

@ -40,11 +40,11 @@ import org.springframework.beans.factory.support.AutowireCandidateQualifier; @@ -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;

2
spring-beans/src/test/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBeanTests.java

@ -25,7 +25,7 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; @@ -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}.

4
spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java

@ -28,13 +28,13 @@ import org.springframework.beans.factory.BeanFactory; @@ -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

2
spring-beans/src/test/java/org/springframework/beans/factory/config/PropertiesFactoryBeanTests.java

@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test; @@ -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}.

2
spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java

@ -25,7 +25,7 @@ import org.springframework.tests.sample.beans.ITestBean; @@ -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}.

2
spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java

@ -47,7 +47,7 @@ import org.springframework.util.StringUtils; @@ -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:

2
spring-beans/src/test/java/org/springframework/beans/factory/config/SimpleScopeTests.java

@ -28,7 +28,7 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; @@ -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.

2
spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java

@ -27,7 +27,7 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; @@ -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

4
spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java

@ -49,7 +49,7 @@ import org.springframework.core.annotation.AnnotationAwareOrderComparator; @@ -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; @@ -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

3
spring-context-indexer/src/test/java/org/springframework/context/index/sample/SampleNone.java

@ -1,5 +1,5 @@ @@ -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 @@ @@ -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.

33
spring-context-indexer/src/test/java/org/springframework/context/index/sample/Scope.java

@ -0,0 +1,33 @@ @@ -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";
}

1
spring-context-support/spring-context-support.gradle

@ -15,6 +15,7 @@ dependencies { @@ -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")

4
spring-context-support/src/test/java/org/springframework/cache/ehcache/EhCacheCacheTests.java vendored

@ -26,10 +26,10 @@ import org.junit.jupiter.api.BeforeEach; @@ -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

4
spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java

@ -37,8 +37,8 @@ import org.springframework.beans.factory.support.RootBeanDefinition; @@ -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 @@ -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

2
spring-context-support/src/test/java/org/springframework/validation/beanvalidation2/SpringValidatorAdapterTests.java

@ -52,8 +52,8 @@ import org.junit.jupiter.api.Test; @@ -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;

1
spring-context/spring-context.gradle

@ -26,6 +26,7 @@ dependencies { @@ -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")

6
spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java

@ -50,10 +50,10 @@ import org.springframework.core.NestedRuntimeException; @@ -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;

10
spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java

@ -57,10 +57,11 @@ import org.springframework.aop.support.Pointcuts; @@ -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; @@ -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 { @@ -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() {

4
spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java

@ -48,8 +48,9 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; @@ -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; @@ -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;

2
spring-context/src/test/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreatorTests.java

@ -26,7 +26,7 @@ import org.springframework.aop.support.AopUtils; @@ -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;

2
spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java

@ -27,10 +27,10 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; @@ -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;

2
spring-context/src/test/java/org/springframework/aop/target/CommonsPool2TargetSourceTests.java

@ -27,10 +27,10 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; @@ -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;

2
spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java

@ -55,6 +55,7 @@ import org.springframework.core.io.ClassPathResource; @@ -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; @@ -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;

6
spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java

@ -34,13 +34,13 @@ import org.springframework.beans.factory.config.RuntimeBeanReference; @@ -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

2
spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java

@ -37,13 +37,13 @@ import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; @@ -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;

2
spring-context/src/test/java/org/springframework/context/annotation/ComponentScanAnnotationIntegrationTests.java

@ -55,11 +55,11 @@ import org.springframework.core.env.ConfigurableEnvironment; @@ -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;

2
spring-context/src/test/java/org/springframework/context/annotation/ComponentScanParserScopedProxyTests.java

@ -23,8 +23,8 @@ import org.junit.jupiter.api.Test; @@ -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;

8
spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java

@ -51,15 +51,15 @@ import org.springframework.core.convert.support.GenericConversionService; @@ -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

2
spring-context/src/test/java/org/springframework/context/expression/EnvironmentAccessorIntegrationTests.java

@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test; @@ -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;

4
spring-context/src/test/java/org/springframework/context/support/DefaultLifecycleProcessorTests.java

@ -27,10 +27,10 @@ import org.springframework.beans.factory.support.RootBeanDefinition; @@ -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

5
spring-context/src/test/java/org/springframework/context/support/EnvironmentSecurityManagerIntegrationTests.java

@ -28,13 +28,12 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; @@ -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 { @@ -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");
}

2
spring-context/src/test/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurerTests.java

@ -29,8 +29,8 @@ import org.springframework.core.env.PropertySource; @@ -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;

1
spring-context/src/test/java/org/springframework/mock/env/MockEnvironment.java vendored

@ -18,6 +18,7 @@ package org.springframework.mock.env; @@ -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

4
spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java

@ -26,16 +26,16 @@ import org.junit.jupiter.api.Test; @@ -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.

4
spring-context/src/test/java/org/springframework/scheduling/concurrent/ScheduledExecutorFactoryBeanTests.java

@ -23,7 +23,7 @@ import java.util.concurrent.ThreadFactory; @@ -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; @@ -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

4
spring-context/src/test/java/org/springframework/scripting/support/ScriptFactoryPostProcessorTests.java

@ -24,16 +24,16 @@ import org.springframework.beans.factory.config.BeanDefinition; @@ -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

2
spring-context/src/test/java/org/springframework/validation/beanvalidation/SpringValidatorAdapterTests.java

@ -50,8 +50,8 @@ import org.junit.jupiter.api.Test; @@ -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;

2
spring-context/src/test/kotlin/org/springframework/context/support/BeanDefinitionDslTests.kt

@ -25,7 +25,7 @@ import org.springframework.beans.factory.getBean @@ -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")

6
spring-core/spring-core.gradle

@ -60,6 +60,12 @@ dependencies { @@ -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 {

2
spring-core/src/test/java/example/type/AspectJTypeFilterTestsTypes.java

@ -16,7 +16,7 @@ @@ -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

4
spring-core/src/test/java/org/springframework/core/annotation/AnnotatedElementUtilsTests.java

@ -42,10 +42,10 @@ import org.springframework.core.annotation.AnnotationUtilsTests.ExtendsBaseClass @@ -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;

4
spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java

@ -39,8 +39,8 @@ import org.junit.jupiter.api.Test; @@ -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 { @@ -928,7 +928,7 @@ class AnnotationUtilsTests {
Map<String, Object> 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");
}

6
spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsTests.java

@ -43,9 +43,9 @@ import org.springframework.core.Ordered; @@ -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 { @@ -1770,7 +1770,7 @@ class MergedAnnotationsTests {
MergedAnnotation<Component> 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");
}

1
spring-core/src/test/java/org/springframework/core/codec/ByteArrayDecoderTests.java

@ -24,6 +24,7 @@ import reactor.core.publisher.Flux; @@ -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;

1
spring-core/src/test/java/org/springframework/core/codec/ByteArrayEncoderTests.java

@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test; @@ -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;

1
spring-core/src/test/java/org/springframework/core/codec/ByteBufferDecoderTests.java

@ -25,6 +25,7 @@ import reactor.core.publisher.Flux; @@ -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;

1
spring-core/src/test/java/org/springframework/core/codec/ByteBufferEncoderTests.java

@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test; @@ -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;

1
spring-core/src/test/java/org/springframework/core/codec/CharSequenceEncoderTests.java

@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test; @@ -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;

1
spring-core/src/test/java/org/springframework/core/codec/DataBufferDecoderTests.java

@ -25,6 +25,7 @@ import reactor.core.publisher.Flux; @@ -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;

1
spring-core/src/test/java/org/springframework/core/codec/DataBufferEncoderTests.java

@ -24,6 +24,7 @@ import reactor.core.publisher.Mono; @@ -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;

1
spring-core/src/test/java/org/springframework/core/codec/ResourceDecoderTests.java

@ -28,6 +28,7 @@ import org.springframework.core.io.ByteArrayResource; @@ -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;

1
spring-core/src/test/java/org/springframework/core/codec/ResourceEncoderTests.java

@ -28,6 +28,7 @@ import org.springframework.core.io.ByteArrayResource; @@ -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;

4
spring-core/src/test/java/org/springframework/core/codec/ResourceRegionEncoderTests.java

@ -29,11 +29,11 @@ import reactor.test.StepVerifier; @@ -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;

1
spring-core/src/test/java/org/springframework/core/codec/StringDecoderTests.java

@ -30,6 +30,7 @@ import reactor.test.StepVerifier; @@ -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;

4
spring-core/src/test/java/org/springframework/core/convert/converter/DefaultConversionServiceTests.java

@ -51,13 +51,13 @@ import org.springframework.core.convert.ConversionFailedException; @@ -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}.

4
spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java

@ -43,8 +43,8 @@ import org.springframework.core.convert.converter.ConverterFactory; @@ -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; @@ -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}.

2
spring-core/src/test/java/org/springframework/core/env/MutablePropertySourcesTests.java vendored

@ -20,7 +20,7 @@ import java.util.Iterator; @@ -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;

2
spring-core/src/test/java/org/springframework/core/env/PropertySourcesPropertyResolverTests.java vendored

@ -24,7 +24,7 @@ import org.junit.jupiter.api.BeforeEach; @@ -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;

73
spring-core/src/test/java/org/springframework/core/env/StandardEnvironmentTests.java vendored

@ -16,17 +16,16 @@ @@ -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 { @@ -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<String, Object> systemEnvironment = environment.getSystemEnvironment();
@ -500,68 +499,8 @@ public class StandardEnvironmentTests { @@ -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<String, String> getModifiableSystemEnvironment() {
// for os x / linux
Class<?>[] classes = Collections.class.getDeclaredClasses();
Map<String, String> 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<String, String>) 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<String, String>) 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<String, String>) 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);
}
}

2
spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferTests.java

@ -22,6 +22,8 @@ import java.nio.ByteBuffer; @@ -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;

3
spring-core/src/test/java/org/springframework/core/io/buffer/DataBufferUtilsTests.java

@ -45,7 +45,8 @@ import reactor.test.StepVerifier; @@ -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;

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

Loading…
Cancel
Save