From dfe05305e2de1c68add84ef66b615958744b520a Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Sun, 9 Sep 2012 21:41:39 +0200 Subject: [PATCH] Upgrade to JUnit 4.11 snapshot in support of JDK7 Class#getDeclaredMembers returns arbitrary results under JDK7. This results in non-deterministic execution of JUnit test methods, often revealing unintended dependencies between methods that rely on a specific order to succeed. JUnit 4.11 contains support for predictable test ordering [1], but at the time of this commit, JUnit 4.11 has not yet been released. Therefore we are testing against a snapshot version [2], which has been uploaded to repo.springsource.org [3] for easy access. Note that this artifact may be removed when JUnit 4.11 goes GA. - Care has been taken to ensure that spring-test's compile-time dependency on JUnit remains at 4.10. This means that the spring-test pom.xml will continue to have an optional on JUnit 4.10, instead of the 4.11 snapshot. - For reasons not fully understood, the upgrade to the 4.11 snapshot of junit-dep caused NoSuchMethodErrors around certain Hamcrest types, particularly CoreMatchers and Matchers. import statements have been updated accordingly throughout affected test cases. - Runtime errors also occurred around uses of JUnit @Rule and ExpectedException. These have been reverted to use simpler mechanisms like @Test(expected) in the meantime. - Some test methods with order-based dependencies on one another have been renamed in order to fall in line with JUnit 4.11's new method ordering (as opposed to actually fixing the inter-test dependencies). In other areas, the fix was as simple as adding a tearDown method and cleaning up state. - For no apparent reason, the timeout in AspectJAutoProxyCreatorTests' testAspectsAndAdvisorNotAppliedToPrototypeIsFastEnough method begins to be exceeded. Prior to this commit the timeout value was 3000 ms; on the CI server under Linux/JDK6 and JDK7, the test begins taking anywhere from 3500-5500 ms with this commit. It is presumed that this is an incidental artifact of the upgrade to JUnit 4.11. In any case, there are no changes to src/main in this commit, so this should not actually represent a performance risk for Spring Framework users. The timeout has been increased to 6000 ms to accommodate this situation. [1]: https://github.com/KentBeck/junit/pull/293 [2]: https://github.com/downloads/KentBeck/junit/junit-dep-4.11-SNAPSHOT-20120805-1225.jar [3]: https://repo.springsource.org/simple/ext-release-local/junit/junit-dep/4.11.20120805.1225 Issue: SPR-9783 --- build.gradle | 16 ++++++--- .../AbstractAspectJAdvisorFactoryTests.java | 11 ++----- .../AspectJAutoProxyCreatorTests.java | 2 +- ...notationConfigApplicationContextTests.java | 13 ++++---- .../config/ContextNamespaceHandlerTests.java | 12 +++++-- .../converter/ConvertingComparatorTests.java | 33 ++++++------------- .../PropertySourcesPropertyResolverTests.java | 7 ++-- .../core/env/StandardEnvironmentTests.java | 8 ++--- .../core/io/ClassPathResourceTests.java | 5 +-- .../comparator/BooleanComparatorTests.java | 2 +- .../comparator/InstanceComparatorTests.java | 2 +- .../comparator/InvertibleComparatorTests.java | 19 +++-------- .../SpringRunnerContextCacheTests.java | 12 +++---- .../remoting/jaxrpc/JaxRpcSupportTests.java | 4 +-- .../core/env/EnvironmentIntegrationTests.java | 27 +++++---------- 15 files changed, 70 insertions(+), 103 deletions(-) diff --git a/build.gradle b/build.gradle index 7c6b4b9da78..2889c94af26 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,8 @@ configure(allprojects) { ext.aspectjVersion = '1.6.12' ext.hsqldbVersion='1.8.0.10' - ext.junitVersion = '4.10' + ext.junitVersion = '4.11.20120805.1225' // temporary use of snapshot; spring-test + // still builds against on 4.10 [compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:none'] @@ -33,9 +34,6 @@ configure(allprojects) { } dependencies { - testCompile ("junit:junit-dep:${junitVersion}") { - exclude group: 'org.hamcrest', module: 'hamcrest-core' - } testCompile "org.hamcrest:hamcrest-all:1.1" testCompile "org.easymock:easymock:2.5.1" } @@ -48,6 +46,14 @@ configure(allprojects) { } } +configure(subprojects - project(":spring-test")) { + dependencies { + testCompile ("junit:junit-dep:${junitVersion}") { + exclude group: 'org.hamcrest', module: 'hamcrest-core' + } + } +} + configure(subprojects) { subproject -> apply from: "${rootProject.projectDir}/publish-maven.gradle" @@ -521,7 +527,7 @@ project('spring-test') { compile(project(":spring-web"), optional) compile(project(":spring-webmvc"), optional) compile(project(":spring-webmvc-portlet"), optional) - compile("junit:junit-dep:${junitVersion}") { dep -> + compile("junit:junit-dep:4.10") { dep -> optional dep // We already have hamcrest-all as a global testCompile dependency. exclude group: 'org.hamcrest', module: 'hamcrest-core' diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java index 9ad8b2dc0f2..1c366a70425 100644 --- a/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2012 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. @@ -40,9 +40,7 @@ import org.aspectj.lang.annotation.DeclarePrecedence; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.springframework.aop.Advisor; import org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory.SyntheticInstantiationAdvisor; @@ -73,9 +71,6 @@ import test.beans.TestBean; */ public abstract class AbstractAspectJAdvisorFactoryTests { - @Rule - public ExpectedException thrown = ExpectedException.none(); - /** * To be overridden by concrete test subclasses. * @return the fixture @@ -586,11 +581,9 @@ public abstract class AbstractAspectJAdvisorFactoryTests { itb.getAge(); } - @Test + @Test(expected=IllegalArgumentException.class) public void testDeclarePrecedenceNotSupported() { TestBean target = new TestBean(); - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("DeclarePrecendence not presently supported in Spring AOP"); MetadataAwareAspectInstanceFactory aspectInstanceFactory = new SingletonMetadataAwareAspectInstanceFactory( new DeclarePrecedenceShouldSucceed(), "someBean"); createProxy(target, getFixture().getAdvisors(aspectInstanceFactory), diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java index 08e9a2b5bbb..96b55873b7b 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/autoproxy/AspectJAutoProxyCreatorTests.java @@ -151,7 +151,7 @@ public final class AspectJAutoProxyCreatorTests { // What's a reasonable expectation for _any_ server or developer machine load? // 3 seconds? - assertStopWatchTimeLimit(sw, 3000); + assertStopWatchTimeLimit(sw, 6000); } @Test diff --git a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java index c27c30f4213..fe528621aac 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java @@ -16,14 +16,9 @@ package org.springframework.context.annotation; -import static java.lang.String.format; import java.util.Map; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; import org.junit.Test; -import static org.junit.matchers.JUnitMatchers.*; - import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Autowired; @@ -31,6 +26,10 @@ import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.context.annotation6.ComponentForScanning; import org.springframework.context.annotation6.ConfigForScanning; import org.springframework.context.annotation6.Jsr330NamedForScanning; + +import static java.lang.String.*; +import static org.hamcrest.Matchers.*; +import static org.junit.Assert.*; import static org.springframework.util.StringUtils.*; /** @@ -229,13 +228,13 @@ public class AnnotationConfigApplicationContextTests { } } - static class UntypedFactoryBean implements FactoryBean { + static class UntypedFactoryBean implements FactoryBean { public Object getObject() { return null; } - public Class getObjectType() { + public Class getObjectType() { return null; } diff --git a/spring-context/src/test/java/org/springframework/context/config/ContextNamespaceHandlerTests.java b/spring-context/src/test/java/org/springframework/context/config/ContextNamespaceHandlerTests.java index 9d05871449e..0258fa1600b 100644 --- a/spring-context/src/test/java/org/springframework/context/config/ContextNamespaceHandlerTests.java +++ b/spring-context/src/test/java/org/springframework/context/config/ContextNamespaceHandlerTests.java @@ -16,14 +16,13 @@ package org.springframework.context.config; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - import java.util.Calendar; import java.util.Date; import java.util.Map; +import org.junit.After; import org.junit.Test; + import org.springframework.beans.factory.config.PlaceholderConfigurerSupport; import org.springframework.beans.factory.config.PropertyOverrideConfigurer; import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; @@ -33,6 +32,8 @@ import org.springframework.context.support.GenericXmlApplicationContext; import org.springframework.core.io.ClassPathResource; import org.springframework.mock.env.MockEnvironment; +import static org.junit.Assert.*; + /** * @author Arjen Poutsma * @author Dave Syer @@ -41,6 +42,11 @@ import org.springframework.mock.env.MockEnvironment; */ public class ContextNamespaceHandlerTests { + @After + public void tearDown() { + System.getProperties().remove("foo"); + } + @Test public void propertyPlaceholder() throws Exception { ApplicationContext applicationContext = new ClassPathXmlApplicationContext( diff --git a/spring-core/src/test/java/org/springframework/core/convert/converter/ConvertingComparatorTests.java b/spring-core/src/test/java/org/springframework/core/convert/converter/ConvertingComparatorTests.java index 853abca0ad5..500fd9c0e51 100644 --- a/spring-core/src/test/java/org/springframework/core/convert/converter/ConvertingComparatorTests.java +++ b/spring-core/src/test/java/org/springframework/core/convert/converter/ConvertingComparatorTests.java @@ -16,8 +16,6 @@ package org.springframework.core.convert.converter; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.*; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -25,15 +23,15 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; + import org.springframework.core.convert.ConversionService; -import org.springframework.core.convert.converter.Converter; -import org.springframework.core.convert.converter.ConvertingComparator; import org.springframework.core.convert.support.DefaultConversionService; import org.springframework.util.comparator.ComparableComparator; +import static org.hamcrest.CoreMatchers.*; +import static org.junit.Assert.*; + /** * Tests for {@link ConvertingComparator}. * @@ -41,40 +39,29 @@ import org.springframework.util.comparator.ComparableComparator; */ public class ConvertingComparatorTests { - @Rule - public ExpectedException thown = ExpectedException.none(); - private final StringToInteger converter = new StringToInteger(); private final ConversionService conversionService = new DefaultConversionService(); private final TestComparator comparator = new TestComparator(); - @Test + @Test(expected=IllegalArgumentException.class) public void shouldThrowOnNullComparator() throws Exception { - thown.expect(IllegalArgumentException.class); - thown.expectMessage("Comparator must not be null"); new ConvertingComparator(null, this.converter); } - @Test + @Test(expected=IllegalArgumentException.class) public void shouldThrowOnNullConverter() throws Exception { - thown.expect(IllegalArgumentException.class); - thown.expectMessage("Converter must not be null"); new ConvertingComparator(this.comparator, null); } - @Test + @Test(expected=IllegalArgumentException.class) public void shouldThrowOnNullConversionService() throws Exception { - thown.expect(IllegalArgumentException.class); - thown.expectMessage("ConversionService must not be null"); new ConvertingComparator(this.comparator, null, Integer.class); } - @Test + @Test(expected=IllegalArgumentException.class) public void shouldThrowOnNullType() throws Exception { - thown.expect(IllegalArgumentException.class); - thown.expectMessage("TargetType must not be null"); new ConvertingComparator(this.comparator, this.conversionService, null); } @@ -145,8 +132,8 @@ public class ConvertingComparatorTests { private boolean called; public int compare(Integer o1, Integer o2) { - assertThat(o1, is(Integer.class)); - assertThat(o2, is(Integer.class)); + assertThat(o1, instanceOf(Integer.class)); + assertThat(o2, instanceOf(Integer.class)); this.called = true; return super.compare(o1, o2); }; diff --git a/spring-core/src/test/java/org/springframework/core/env/PropertySourcesPropertyResolverTests.java b/spring-core/src/test/java/org/springframework/core/env/PropertySourcesPropertyResolverTests.java index c51fd358c82..09481c169c1 100644 --- a/spring-core/src/test/java/org/springframework/core/env/PropertySourcesPropertyResolverTests.java +++ b/spring-core/src/test/java/org/springframework/core/env/PropertySourcesPropertyResolverTests.java @@ -20,14 +20,15 @@ import java.util.HashMap; import java.util.Map; import java.util.Properties; -import org.hamcrest.Matchers; +import org.hamcrest.CoreMatchers; + import org.junit.Before; import org.junit.Test; import org.springframework.core.convert.ConversionException; import org.springframework.mock.env.MockPropertySource; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.Matchers.*; import static org.junit.Assert.*; /** @@ -371,7 +372,7 @@ public class PropertySourcesPropertyResolverTests { try { pr.getProperty("p5"); } catch (IllegalArgumentException ex) { - assertThat(ex.getMessage(), Matchers.containsString( + assertThat(ex.getMessage(), containsString( "Could not resolve placeholder 'bogus' in string value [${p1}:${p2}:${bogus}]")); } assertThat(pr.getProperty("p6"), equalTo("v1:v2:def")); diff --git a/spring-core/src/test/java/org/springframework/core/env/StandardEnvironmentTests.java b/spring-core/src/test/java/org/springframework/core/env/StandardEnvironmentTests.java index d0515bcc32a..f28dfd59589 100644 --- a/spring-core/src/test/java/org/springframework/core/env/StandardEnvironmentTests.java +++ b/spring-core/src/test/java/org/springframework/core/env/StandardEnvironmentTests.java @@ -26,16 +26,12 @@ import java.util.Collections; import java.util.Map; import org.junit.Test; - import org.springframework.mock.env.MockPropertySource; -import static java.lang.String.*; - -import static org.hamcrest.CoreMatchers.*; +import static java.lang.String.*; +import static org.hamcrest.Matchers.*; import static org.junit.Assert.*; -import static org.junit.matchers.JUnitMatchers.*; - import static org.springframework.core.env.AbstractEnvironment.*; /** diff --git a/spring-core/src/test/java/org/springframework/core/io/ClassPathResourceTests.java b/spring-core/src/test/java/org/springframework/core/io/ClassPathResourceTests.java index f378bf40518..bae6fb98844 100644 --- a/spring-core/src/test/java/org/springframework/core/io/ClassPathResourceTests.java +++ b/spring-core/src/test/java/org/springframework/core/io/ClassPathResourceTests.java @@ -16,20 +16,21 @@ package org.springframework.core.io; -import static org.hamcrest.CoreMatchers.instanceOf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import static org.junit.internal.matchers.StringContains.containsString; import java.io.FileNotFoundException; import java.io.IOException; + import java.util.regex.Matcher; import java.util.regex.Pattern; import org.junit.Test; +import static org.hamcrest.Matchers.*; + /** * Unit tests that serve as regression tests for the bugs described in SPR-6888 * and SPR-9413. diff --git a/spring-core/src/test/java/org/springframework/util/comparator/BooleanComparatorTests.java b/spring-core/src/test/java/org/springframework/util/comparator/BooleanComparatorTests.java index 8bf0ebd7813..4074cc1bfd9 100644 --- a/spring-core/src/test/java/org/springframework/util/comparator/BooleanComparatorTests.java +++ b/spring-core/src/test/java/org/springframework/util/comparator/BooleanComparatorTests.java @@ -16,7 +16,7 @@ package org.springframework.util.comparator; -import static org.hamcrest.Matchers.is; +import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.*; import java.util.Comparator; diff --git a/spring-core/src/test/java/org/springframework/util/comparator/InstanceComparatorTests.java b/spring-core/src/test/java/org/springframework/util/comparator/InstanceComparatorTests.java index 002262c25ca..8a483dcbe3d 100644 --- a/spring-core/src/test/java/org/springframework/util/comparator/InstanceComparatorTests.java +++ b/spring-core/src/test/java/org/springframework/util/comparator/InstanceComparatorTests.java @@ -16,7 +16,7 @@ package org.springframework.util.comparator; -import static org.hamcrest.Matchers.is; +import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.*; import java.util.Comparator; diff --git a/spring-core/src/test/java/org/springframework/util/comparator/InvertibleComparatorTests.java b/spring-core/src/test/java/org/springframework/util/comparator/InvertibleComparatorTests.java index 6f9a7feffb1..c8afa7a690a 100644 --- a/spring-core/src/test/java/org/springframework/util/comparator/InvertibleComparatorTests.java +++ b/spring-core/src/test/java/org/springframework/util/comparator/InvertibleComparatorTests.java @@ -16,14 +16,12 @@ package org.springframework.util.comparator; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; - import java.util.Comparator; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; + +import static org.hamcrest.CoreMatchers.*; +import static org.junit.Assert.*; /** * Tests for {@link InvertibleComparator}. @@ -35,22 +33,15 @@ import org.junit.rules.ExpectedException; public class InvertibleComparatorTests { - @Rule - public ExpectedException thrown = ExpectedException.none(); - private Comparator comparator = new ComparableComparator(); - @Test + @Test(expected=IllegalArgumentException.class) public void shouldNeedComparator() throws Exception { - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Comparator must not be null"); new InvertibleComparator(null); } - @Test + @Test(expected=IllegalArgumentException.class) public void shouldNeedComparatorWithAscending() throws Exception { - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Comparator must not be null"); new InvertibleComparator(null, true); } diff --git a/spring-test/src/test/java/org/springframework/test/context/SpringRunnerContextCacheTests.java b/spring-test/src/test/java/org/springframework/test/context/SpringRunnerContextCacheTests.java index 264c8a510c7..5ab102de2c8 100644 --- a/spring-test/src/test/java/org/springframework/test/context/SpringRunnerContextCacheTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/SpringRunnerContextCacheTests.java @@ -16,20 +16,18 @@ package org.springframework.test.context; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertSame; - import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import static org.junit.Assert.*; + /** * JUnit 4 based unit test which verifies correct {@link ContextCache * application context caching} in conjunction with the @@ -108,7 +106,7 @@ public class SpringRunnerContextCacheTests { } @Test - public void verifyContextWasDirtied() { + public void verifyContextDirty() { assertContextCacheStatistics("verifyContextWasDirtied()", 1, 0, 2); assertNotNull("The application context should have been autowired.", this.applicationContext); assertNotSame("The application context should have been 'dirtied'.", @@ -117,7 +115,7 @@ public class SpringRunnerContextCacheTests { } @Test - public void verifyContextWasNotDirtied() { + public void verifyContextNotDirty() { assertContextCacheStatistics("verifyContextWasNotDirtied()", 1, 1, 2); assertNotNull("The application context should have been autowired.", this.applicationContext); assertSame("The application context should NOT have been 'dirtied'.", diff --git a/spring-web/src/test/java/org/springframework/remoting/jaxrpc/JaxRpcSupportTests.java b/spring-web/src/test/java/org/springframework/remoting/jaxrpc/JaxRpcSupportTests.java index 8444157bf12..1f249589b51 100644 --- a/spring-web/src/test/java/org/springframework/remoting/jaxrpc/JaxRpcSupportTests.java +++ b/spring-web/src/test/java/org/springframework/remoting/jaxrpc/JaxRpcSupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2012 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. @@ -281,7 +281,7 @@ public class JaxRpcSupportTests extends TestCase { } } - public void testJaxRpcPortProxyFactoryBeanWithDynamicCallsAndRemoteException() throws Exception { + public void testJaxRpcPortProxyFactoryBeanWithDynamicCallsAndRemoteException_() throws Exception { ExceptionCallMockServiceFactory serviceFactory = new ExceptionCallMockServiceFactory(); JaxRpcPortProxyFactoryBean factory = new JaxRpcPortProxyFactoryBean(); diff --git a/src/test/java/org/springframework/core/env/EnvironmentIntegrationTests.java b/src/test/java/org/springframework/core/env/EnvironmentIntegrationTests.java index fc60b191ee6..c4da57a4f82 100644 --- a/src/test/java/org/springframework/core/env/EnvironmentIntegrationTests.java +++ b/src/test/java/org/springframework/core/env/EnvironmentIntegrationTests.java @@ -16,29 +16,12 @@ package org.springframework.core.env; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.lessThan; -import static org.hamcrest.Matchers.notNullValue; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; -import static org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition; -import static org.springframework.context.ConfigurableApplicationContext.ENVIRONMENT_BEAN_NAME; -import static org.springframework.core.env.EnvironmentIntegrationTests.Constants.DERIVED_DEV_BEAN_NAME; -import static org.springframework.core.env.EnvironmentIntegrationTests.Constants.DERIVED_DEV_ENV_NAME; -import static org.springframework.core.env.EnvironmentIntegrationTests.Constants.DEV_BEAN_NAME; -import static org.springframework.core.env.EnvironmentIntegrationTests.Constants.DEV_ENV_NAME; -import static org.springframework.core.env.EnvironmentIntegrationTests.Constants.ENVIRONMENT_AWARE_BEAN_NAME; -import static org.springframework.core.env.EnvironmentIntegrationTests.Constants.PROD_BEAN_NAME; -import static org.springframework.core.env.EnvironmentIntegrationTests.Constants.PROD_ENV_NAME; -import static org.springframework.core.env.EnvironmentIntegrationTests.Constants.TRANSITIVE_BEAN_NAME; -import static org.springframework.core.env.EnvironmentIntegrationTests.Constants.XML_PATH; - import java.io.File; import java.io.IOException; import org.junit.Before; import org.junit.Test; + import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; @@ -69,8 +52,8 @@ import org.springframework.util.FileCopyUtils; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.AbstractRefreshableWebApplicationContext; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; -import org.springframework.web.context.support.StandardServletEnvironment; import org.springframework.web.context.support.GenericWebApplicationContext; +import org.springframework.web.context.support.StandardServletEnvironment; import org.springframework.web.context.support.StaticWebApplicationContext; import org.springframework.web.context.support.XmlWebApplicationContext; import org.springframework.web.portlet.context.AbstractRefreshablePortletApplicationContext; @@ -78,6 +61,12 @@ import org.springframework.web.portlet.context.StandardPortletEnvironment; import org.springframework.web.portlet.context.StaticPortletApplicationContext; import org.springframework.web.portlet.context.XmlPortletApplicationContext; +import static org.hamcrest.Matchers.*; +import static org.junit.Assert.*; +import static org.springframework.beans.factory.support.BeanDefinitionBuilder.*; +import static org.springframework.context.ConfigurableApplicationContext.*; +import static org.springframework.core.env.EnvironmentIntegrationTests.Constants.*; + /** * Integration tests for container support of {@link Environment}