Use Gradle test fixture support for spring-core
See gh-23550
This commit is contained in:
parent
75fd391fc7
commit
5718bf424b
|
@ -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"
|
||||
|
|
|
@ -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> {
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -28,10 +28,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.test.fixtures.EnabledForTestGroups;
|
||||
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
|
||||
import org.springframework.dao.support.PersistenceExceptionTranslator;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.tests.transaction.CallCountingTransactionManager;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
@ -40,7 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* Integration tests cornering bug SPR-8651, which revealed that @Scheduled methods may
|
||||
|
|
|
@ -6,4 +6,5 @@ dependencies {
|
|||
optional("org.aspectj:aspectjweaver")
|
||||
optional("org.apache.commons:commons-pool2")
|
||||
optional("com.jamonapi:jamon")
|
||||
testCompile(testFixtures(project(":spring-core")))
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
|||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.tests.TestResourceUtils.qualifiedResource;
|
||||
import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource;
|
||||
|
||||
/**
|
||||
* Tests that the <aop:config/> element can be used as a top level element.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -24,7 +24,8 @@ import org.junit.jupiter.api.Test;
|
|||
import org.springframework.aop.IntroductionAdvisor;
|
||||
import org.springframework.aop.IntroductionInterceptor;
|
||||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.tests.TimeStamped;
|
||||
import org.springframework.core.test.fixtures.TimeStamped;
|
||||
import org.springframework.core.test.fixtures.io.SerializationTestUtils;
|
||||
import org.springframework.tests.aop.interceptor.SerializableNopInterceptor;
|
||||
import org.springframework.tests.sample.beans.INestedTestBean;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
|
@ -32,7 +33,6 @@ import org.springframework.tests.sample.beans.NestedTestBean;
|
|||
import org.springframework.tests.sample.beans.Person;
|
||||
import org.springframework.tests.sample.beans.SerializablePerson;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.util.SerializationTestUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -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}.
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
||||
|
|
|
@ -47,9 +47,9 @@ import org.springframework.core.convert.ConversionFailedException;
|
|||
import org.springframework.core.convert.TypeDescriptor;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.core.convert.support.GenericConversionService;
|
||||
import org.springframework.core.test.fixtures.Assume;
|
||||
import org.springframework.core.test.fixtures.EnabledForTestGroups;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.tests.sample.beans.BooleanTestBean;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.IndexedTestBean;
|
||||
|
@ -62,7 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
import static org.assertj.core.api.Assertions.within;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* Shared tests for property accessors.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -86,10 +86,11 @@ import org.springframework.core.convert.support.DefaultConversionService;
|
|||
import org.springframework.core.convert.support.GenericConversionService;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.UrlResource;
|
||||
import org.springframework.core.test.fixtures.Assume;
|
||||
import org.springframework.core.test.fixtures.EnabledForTestGroups;
|
||||
import org.springframework.core.test.fixtures.TestGroup;
|
||||
import org.springframework.core.test.fixtures.io.SerializationTestUtils;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.sample.beans.DependenciesBean;
|
||||
import org.springframework.tests.sample.beans.DerivedTestBean;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
|
@ -98,7 +99,6 @@ import org.springframework.tests.sample.beans.NestedTestBean;
|
|||
import org.springframework.tests.sample.beans.SideEffectBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.tests.sample.beans.factory.DummyFactory;
|
||||
import org.springframework.util.SerializationTestUtils;
|
||||
import org.springframework.util.StopWatch;
|
||||
import org.springframework.util.StringValueResolver;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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}.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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}.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}.
|
||||
|
|
|
@ -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}.
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -49,7 +49,7 @@ import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
|||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.UrlResource;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.core.test.fixtures.EnabledForTestGroups;
|
||||
import org.springframework.tests.sample.beans.GenericBean;
|
||||
import org.springframework.tests.sample.beans.GenericIntegerBean;
|
||||
import org.springframework.tests.sample.beans.GenericSetOfIntegerBean;
|
||||
|
@ -57,7 +57,7 @@ import org.springframework.tests.sample.beans.TestBean;
|
|||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.springframework.tests.TestGroup.LONG_RUNNING;
|
||||
import static org.springframework.core.test.fixtures.TestGroup.LONG_RUNNING;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -17,7 +17,6 @@
|
|||
package org.springframework.context.index.sample;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.core.type.Scope;
|
||||
|
||||
/**
|
||||
* Candidate with no matching annotation.
|
||||
|
|
|
@ -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";
|
||||
|
||||
}
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -37,8 +37,8 @@ import org.springframework.beans.factory.support.RootBeanDefinition;
|
|||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.context.support.StaticApplicationContext;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.core.test.fixtures.EnabledForTestGroups;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
|||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -57,10 +57,11 @@ import org.springframework.aop.support.Pointcuts;
|
|||
import org.springframework.aop.support.StaticMethodMatcherPointcutAdvisor;
|
||||
import org.springframework.aop.target.HotSwappableTargetSource;
|
||||
import org.springframework.aop.target.SingletonTargetSource;
|
||||
import org.springframework.core.test.fixtures.EnabledForTestGroups;
|
||||
import org.springframework.core.test.fixtures.TestGroup;
|
||||
import org.springframework.core.test.fixtures.TimeStamped;
|
||||
import org.springframework.core.test.fixtures.io.SerializationTestUtils;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.TimeStamped;
|
||||
import org.springframework.tests.aop.advice.CountingAfterReturningAdvice;
|
||||
import org.springframework.tests.aop.advice.CountingBeforeAdvice;
|
||||
import org.springframework.tests.aop.advice.MethodCounter;
|
||||
|
@ -73,7 +74,6 @@ import org.springframework.tests.sample.beans.ITestBean;
|
|||
import org.springframework.tests.sample.beans.Person;
|
||||
import org.springframework.tests.sample.beans.SerializablePerson;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.util.SerializationTestUtils;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
@ -765,7 +765,7 @@ public abstract class AbstractAopProxyTests {
|
|||
@SuppressWarnings("serial")
|
||||
class MyDi extends DelegatingIntroductionInterceptor implements TimeStamped {
|
||||
/**
|
||||
* @see test.util.TimeStamped#getTimeStamp()
|
||||
* @see org.springframework.core.test.fixtures.util.TimeStamped#getTimeStamp()
|
||||
*/
|
||||
@Override
|
||||
public long getTimeStamp() {
|
||||
|
|
|
@ -48,8 +48,9 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
|||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.TestListener;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.test.fixtures.TimeStamped;
|
||||
import org.springframework.core.test.fixtures.io.SerializationTestUtils;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.TimeStamped;
|
||||
import org.springframework.tests.aop.advice.CountingBeforeAdvice;
|
||||
import org.springframework.tests.aop.advice.MyThrowsHandler;
|
||||
import org.springframework.tests.aop.interceptor.NopInterceptor;
|
||||
|
@ -58,7 +59,6 @@ import org.springframework.tests.sample.beans.ITestBean;
|
|||
import org.springframework.tests.sample.beans.Person;
|
||||
import org.springframework.tests.sample.beans.SideEffectBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.util.SerializationTestUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -55,6 +55,7 @@ import org.springframework.core.io.ClassPathResource;
|
|||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.core.io.UrlResource;
|
||||
import org.springframework.core.io.support.EncodedResource;
|
||||
import org.springframework.core.test.fixtures.io.SerializationTestUtils;
|
||||
import org.springframework.tests.sample.beans.DependenciesBean;
|
||||
import org.springframework.tests.sample.beans.DerivedTestBean;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
|
@ -64,7 +65,6 @@ import org.springframework.tests.sample.beans.TestBean;
|
|||
import org.springframework.tests.sample.beans.factory.DummyFactory;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.util.SerializationTestUtils;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -28,13 +28,12 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
|||
import org.springframework.context.annotation.AnnotatedBeanDefinitionReader;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.core.env.AbstractEnvironment;
|
||||
import org.springframework.core.env.StandardEnvironmentTests;
|
||||
import org.springframework.core.test.fixtures.env.EnvironmentTestUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static java.lang.String.format;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
/**
|
||||
* Tests integration between Environment and SecurityManagers. See SPR-9970.
|
||||
*
|
||||
|
@ -50,7 +49,7 @@ public class EnvironmentSecurityManagerIntegrationTests {
|
|||
@BeforeEach
|
||||
public void setUp() {
|
||||
originalSecurityManager = System.getSecurityManager();
|
||||
env = StandardEnvironmentTests.getModifiableSystemEnvironment();
|
||||
env = EnvironmentTestUtils.getModifiableSystemEnvironment();
|
||||
env.put(AbstractEnvironment.ACTIVE_PROFILES_PROPERTY_NAME, "p1");
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.concurrent.ThreadFactory;
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.task.NoOpRunnable;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.core.test.fixtures.EnabledForTestGroups;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
|
@ -32,7 +32,7 @@ import static org.mockito.Mockito.atLeast;
|
|||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* @author Rick Evans
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -39,8 +39,8 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.subpackage.NonPublicAnnotatedClass;
|
||||
import org.springframework.core.test.fixtures.stereotype.Component;
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Arrays.stream;
|
||||
|
@ -928,7 +928,7 @@ class AnnotationUtilsTests {
|
|||
Map<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");
|
||||
}
|
||||
|
||||
|
|
|
@ -43,9 +43,9 @@ import org.springframework.core.Ordered;
|
|||
import org.springframework.core.annotation.MergedAnnotation.Adapt;
|
||||
import org.springframework.core.annotation.MergedAnnotations.SearchStrategy;
|
||||
import org.springframework.core.annotation.subpackage.NonPublicAnnotatedClass;
|
||||
import org.springframework.core.test.fixtures.stereotype.Component;
|
||||
import org.springframework.core.test.fixtures.stereotype.Indexed;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Indexed;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
@ -1770,7 +1770,7 @@ class MergedAnnotationsTests {
|
|||
MergedAnnotation<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");
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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}.
|
||||
|
|
|
@ -43,8 +43,8 @@ import org.springframework.core.convert.converter.ConverterFactory;
|
|||
import org.springframework.core.convert.converter.GenericConverter;
|
||||
import org.springframework.core.io.DescriptiveResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.test.fixtures.EnabledForTestGroups;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.EnabledForTestGroups;
|
||||
import org.springframework.util.StopWatch;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
@ -54,7 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
import static org.springframework.tests.TestGroup.PERFORMANCE;
|
||||
import static org.springframework.core.test.fixtures.TestGroup.PERFORMANCE;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link GenericConversionService}.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -16,17 +16,16 @@
|
|||
|
||||
package org.springframework.core.env;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.security.AccessControlException;
|
||||
import java.security.Permission;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.SpringProperties;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
import org.springframework.core.test.fixtures.env.EnvironmentTestUtils;
|
||||
import org.springframework.core.test.fixtures.env.MockPropertySource;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
|
@ -465,8 +464,8 @@ public class StandardEnvironmentTests {
|
|||
|
||||
@Test
|
||||
void getSystemEnvironment_withAndWithoutSecurityManager() {
|
||||
getModifiableSystemEnvironment().put(ALLOWED_PROPERTY_NAME, ALLOWED_PROPERTY_VALUE);
|
||||
getModifiableSystemEnvironment().put(DISALLOWED_PROPERTY_NAME, DISALLOWED_PROPERTY_VALUE);
|
||||
EnvironmentTestUtils.getModifiableSystemEnvironment().put(ALLOWED_PROPERTY_NAME, ALLOWED_PROPERTY_VALUE);
|
||||
EnvironmentTestUtils.getModifiableSystemEnvironment().put(DISALLOWED_PROPERTY_NAME, DISALLOWED_PROPERTY_VALUE);
|
||||
|
||||
{
|
||||
Map<String, Object> systemEnvironment = environment.getSystemEnvironment();
|
||||
|
@ -500,68 +499,8 @@ public class StandardEnvironmentTests {
|
|||
}
|
||||
|
||||
System.setSecurityManager(oldSecurityManager);
|
||||
getModifiableSystemEnvironment().remove(ALLOWED_PROPERTY_NAME);
|
||||
getModifiableSystemEnvironment().remove(DISALLOWED_PROPERTY_NAME);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Map<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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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…
Reference in New Issue