diff --git a/.gitignore b/.gitignore index c79bac7342..c9e0aca55e 100644 --- a/.gitignore +++ b/.gitignore @@ -13,12 +13,15 @@ jmx.log derby.log spring-test/test-output/ .gradle -build .classpath .project argfile* pom.xml +/build +buildSrc/build +/spring-*/build + # IDEA artifacts and output dirs *.iml *.ipr diff --git a/build.gradle b/build.gradle index b2e7af70c6..071fdc3d61 100644 --- a/build.gradle +++ b/build.gradle @@ -28,6 +28,7 @@ configure(allprojects) { apply plugin: "java" apply plugin: "propdeps-eclipse" apply plugin: "propdeps-idea" + apply plugin: "test-source-set-dependencies" apply from: "${gradleScriptDir}/ide.gradle" group = "org.springframework" @@ -110,7 +111,7 @@ configure(allprojects.findAll{it.name in ["spring", "spring-jms", "spring-orm", } } -configure(subprojects - project(":spring-build-junit")) { subproject -> +configure(subprojects - project(":spring-build-src")) { subproject -> apply plugin: "merge" apply from: "${gradleScriptDir}/publish-maven.gradle" @@ -159,35 +160,26 @@ configure(subprojects - project(":spring-build-junit")) { subproject -> } } -configure(allprojects - project(":spring-build-junit")) { +configure(allprojects) { dependencies { - testCompile(project(":spring-build-junit")) + testCompile("junit:junit:${junitVersion}") + testCompile("org.hamcrest:hamcrest-all:1.3") } - - eclipse.classpath.file.whenMerged { classpath -> - classpath.entries.find{it.path == "/spring-build-junit"}.exported = false - } - test.systemProperties.put("testGroups", properties.get("testGroups")) } -project("spring-build-junit") { - description = "Build-time JUnit dependencies and utilities" - - // NOTE: This is an internal project and is not published. +project("spring-build-src") { + description = "Exposes gradle buildSrc for IDE support" + apply plugin: "groovy" dependencies { - compile("commons-logging:commons-logging:1.1.1") - compile("junit:junit:${junitVersion}") - compile("org.hamcrest:hamcrest-all:1.3") - compile("org.easymock:easymock:${easymockVersion}") + compile gradleApi() + groovy localGroovy() } - // Don't actually generate any artifacts configurations.archives.artifacts.clear() } - project("spring-core") { description = "Spring Core" @@ -258,7 +250,7 @@ project("spring-core") { optional("org.aspectj:aspectjweaver:${aspectjVersion}") optional("net.sf.jopt-simple:jopt-simple:3.0") optional("log4j:log4j:1.2.17") - testCompile("xmlunit:xmlunit:1.2") + testCompile("xmlunit:xmlunit:1.3") testCompile("org.codehaus.woodstox:wstx-asl:3.2.7") } @@ -395,7 +387,7 @@ project("spring-oxm") { optional("org.apache.xmlbeans:xmlbeans:2.4.0") optional("org.codehaus.castor:castor-xml:1.3.2") testCompile("org.codehaus.jettison:jettison:1.0.1") - testCompile("xmlunit:xmlunit:1.2") + testCompile("xmlunit:xmlunit:1.3") testCompile("xmlpull:xmlpull:1.1.3.4a") testCompile(files(genCastor.classesDir).builtBy(genCastor)) testCompile(files(genJaxb.classesDir).builtBy(genJaxb)) @@ -500,7 +492,7 @@ project("spring-web") { } optional("log4j:log4j:1.2.17") testCompile(project(":spring-context-support")) // for JafMediaTypeFactory - testCompile("xmlunit:xmlunit:1.2") + testCompile("xmlunit:xmlunit:1.3") } // pick up ContextLoader.properties in src/main @@ -536,7 +528,6 @@ project("spring-orm") { testCompile("org.eclipse.persistence:org.eclipse.persistence.asm:1.0.1") testCompile("org.eclipse.persistence:org.eclipse.persistence.antlr:1.0.1") testCompile("hsqldb:hsqldb:${hsqldbVersion}") - testCompile(project(":spring-web").sourceSets.test.output) compile(project(":spring-core")) compile(project(":spring-beans")) optional(project(":spring-aop")) @@ -592,7 +583,7 @@ project("spring-webmvc") { testCompile(project(":spring-aop")) testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}") testCompile("rhino:js:1.7R1") - testCompile("xmlunit:xmlunit:1.2") + testCompile("xmlunit:xmlunit:1.3") testCompile("dom4j:dom4j:1.6.1") { exclude group: "xml-apis", module: "xml-apis" } @@ -701,7 +692,7 @@ project("spring-test-mvc") { provided("javax.servlet:javax.servlet-api:3.0.1") optional("org.hamcrest:hamcrest-core:1.3") optional("com.jayway.jsonpath:json-path:0.8.1") - optional("xmlunit:xmlunit:1.2") + optional("xmlunit:xmlunit:1.3") testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}") testCompile("javax.servlet:jstl:1.2") testCompile("org.hibernate:hibernate-validator:4.3.0.Final") @@ -786,6 +777,7 @@ configure(rootProject) { dependencies { // for integration tests testCompile(project(":spring-core")) + testCompile(project(":spring-core").sourceSets.test.output) testCompile(project(":spring-beans")) testCompile(project(":spring-aop")) testCompile(project(":spring-expression")) diff --git a/buildSrc/src/main/groovy/org/springframework/build/gradle/merge/MergePlugin.groovy b/buildSrc/src/main/groovy/org/springframework/build/gradle/MergePlugin.groovy similarity index 99% rename from buildSrc/src/main/groovy/org/springframework/build/gradle/merge/MergePlugin.groovy rename to buildSrc/src/main/groovy/org/springframework/build/gradle/MergePlugin.groovy index ffe4f87342..097e65ab93 100644 --- a/buildSrc/src/main/groovy/org/springframework/build/gradle/merge/MergePlugin.groovy +++ b/buildSrc/src/main/groovy/org/springframework/build/gradle/MergePlugin.groovy @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.build.gradle.merge +package org.springframework.build.gradle import org.gradle.api.* import org.gradle.api.artifacts.Configuration diff --git a/buildSrc/src/main/groovy/org/springframework/build/gradle/TestSourceSetDependenciesPlugin.groovy b/buildSrc/src/main/groovy/org/springframework/build/gradle/TestSourceSetDependenciesPlugin.groovy new file mode 100644 index 0000000000..1e5cffcc7b --- /dev/null +++ b/buildSrc/src/main/groovy/org/springframework/build/gradle/TestSourceSetDependenciesPlugin.groovy @@ -0,0 +1,51 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * http://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.build.gradle + +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.artifacts.Configuration; +import org.gradle.api.artifacts.ProjectDependency; + + +/** + * Gradle plugin that automatically updates testCompile dependencies to include + * the test source sets of project dependencies. + * + * @author Phillip Webb + */ +class TestSourceSetDependenciesPlugin implements Plugin { + + @Override + public void apply(Project project) { + project.afterEvaluate { + Set projectDependencies = new LinkedHashSet<>() + for(def configurationName in ["compile", "optional", "provided"]) { + Configuration configuration = project.getConfigurations().findByName(configurationName) + if(configuration) { + projectDependencies.addAll( + configuration.dependencies.findAll { it instanceof ProjectDependency } + ) + } + } + projectDependencies.each { + project.dependencies.add("testCompile", it.dependencyProject.sourceSets.test.output) + } + } + } + +} diff --git a/buildSrc/src/main/resources/META-INF/gradle-plugins/merge.properties b/buildSrc/src/main/resources/META-INF/gradle-plugins/merge.properties index 5bfccb3d9b..9cef804165 100644 --- a/buildSrc/src/main/resources/META-INF/gradle-plugins/merge.properties +++ b/buildSrc/src/main/resources/META-INF/gradle-plugins/merge.properties @@ -1 +1 @@ -implementation-class=org.springframework.build.gradle.merge.MergePlugin +implementation-class=org.springframework.build.gradle.MergePlugin diff --git a/buildSrc/src/main/resources/META-INF/gradle-plugins/test-source-set-dependencies.properties b/buildSrc/src/main/resources/META-INF/gradle-plugins/test-source-set-dependencies.properties new file mode 100644 index 0000000000..f5df417ad2 --- /dev/null +++ b/buildSrc/src/main/resources/META-INF/gradle-plugins/test-source-set-dependencies.properties @@ -0,0 +1 @@ +implementation-class=org.springframework.build.gradle.TestSourceSetDependenciesPlugin diff --git a/settings.gradle b/settings.gradle index 8d4e147bcc..8c99e5a179 100644 --- a/settings.gradle +++ b/settings.gradle @@ -22,4 +22,7 @@ include "spring-web" include "spring-webmvc" include "spring-webmvc-portlet" include "spring-webmvc-tiles3" -include "spring-build-junit" + +// Exposes gradle buildSrc for IDE support +include "buildSrc" +rootProject.children.find{ it.name == "buildSrc" }.name = "spring-build-src" diff --git a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java index ba0b767921..19ea1742c0 100644 --- a/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/config/AopNamespaceHandlerPointcutErrorTests.java @@ -16,13 +16,15 @@ package org.springframework.aop.config; -import static org.junit.Assert.*; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import static test.util.TestResourceUtils.qualifiedResource; import org.junit.Test; import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.beans.factory.parsing.BeanDefinitionParsingException; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; /** * @author Mark Fisher @@ -33,7 +35,9 @@ public final class AopNamespaceHandlerPointcutErrorTests { @Test public void testDuplicatePointcutConfig() { try { - new XmlBeanFactory(qualifiedResource(getClass(), "pointcutDuplication.xml")); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions( + qualifiedResource(getClass(), "pointcutDuplication.xml")); fail("parsing should have caused a BeanDefinitionStoreException"); } catch (BeanDefinitionStoreException ex) { @@ -44,7 +48,9 @@ public final class AopNamespaceHandlerPointcutErrorTests { @Test public void testMissingPointcutConfig() { try { - new XmlBeanFactory(qualifiedResource(getClass(), "pointcutMissing.xml")); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions( + qualifiedResource(getClass(), "pointcutMissing.xml")); fail("parsing should have caused a BeanDefinitionStoreException"); } catch (BeanDefinitionStoreException ex) { diff --git a/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java b/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java index 05a0fc327a..7f5a4bc437 100644 --- a/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/framework/PrototypeTargetTests.java @@ -22,7 +22,8 @@ import static test.util.TestResourceUtils.qualifiedResource; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; import org.junit.Test; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; /** @@ -37,12 +38,13 @@ public final class PrototypeTargetTests { @Test public void testPrototypeProxyWithPrototypeTarget() { TestBeanImpl.constructionCount = 0; - XmlBeanFactory xbf = new XmlBeanFactory(CONTEXT); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions(CONTEXT); for (int i = 0; i < 10; i++) { - TestBean tb = (TestBean) xbf.getBean("testBeanPrototype"); + TestBean tb = (TestBean) bf.getBean("testBeanPrototype"); tb.doSomething(); } - TestInterceptor interceptor = (TestInterceptor) xbf.getBean("testInterceptor"); + TestInterceptor interceptor = (TestInterceptor) bf.getBean("testInterceptor"); assertEquals(10, TestBeanImpl.constructionCount); assertEquals(10, interceptor.invocationCount); } @@ -50,12 +52,13 @@ public final class PrototypeTargetTests { @Test public void testSingletonProxyWithPrototypeTarget() { TestBeanImpl.constructionCount = 0; - XmlBeanFactory xbf = new XmlBeanFactory(CONTEXT); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions(CONTEXT); for (int i = 0; i < 10; i++) { - TestBean tb = (TestBean) xbf.getBean("testBeanSingleton"); + TestBean tb = (TestBean) bf.getBean("testBeanSingleton"); tb.doSomething(); } - TestInterceptor interceptor = (TestInterceptor) xbf.getBean("testInterceptor"); + TestInterceptor interceptor = (TestInterceptor) bf.getBean("testInterceptor"); assertEquals(1, TestBeanImpl.constructionCount); assertEquals(10, interceptor.invocationCount); } diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java index ae224b6385..632c5bad07 100644 --- a/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/ExposeInvocationInterceptorTests.java @@ -16,12 +16,14 @@ package org.springframework.aop.interceptor; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import static test.util.TestResourceUtils.qualifiedResource; import org.aopalliance.intercept.MethodInvocation; import org.junit.Test; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; import test.beans.ITestBean; @@ -40,7 +42,8 @@ public final class ExposeInvocationInterceptorTests { @Test public void testXmlConfig() { - XmlBeanFactory bf = new XmlBeanFactory(CONTEXT); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions(CONTEXT); ITestBean tb = (ITestBean) bf.getBean("proxy"); String name= "tony"; tb.setName(name); diff --git a/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java b/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java index f44b215755..ccbe9502bf 100644 --- a/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyAutowireTests.java @@ -20,7 +20,8 @@ import static org.junit.Assert.assertSame; import static test.util.TestResourceUtils.qualifiedResource; import org.junit.Test; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; /** @@ -36,7 +37,8 @@ public final class ScopedProxyAutowireTests { @Test public void testScopedProxyInheritsAutowireCandidateFalse() { - XmlBeanFactory bf = new XmlBeanFactory(SCOPED_AUTOWIRE_FALSE_CONTEXT); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions(SCOPED_AUTOWIRE_FALSE_CONTEXT); TestBean autowired = (TestBean) bf.getBean("autowired"); TestBean unscoped = (TestBean) bf.getBean("unscoped"); assertSame(unscoped, autowired.getChild()); @@ -44,7 +46,8 @@ public final class ScopedProxyAutowireTests { @Test public void testScopedProxyReplacesAutowireCandidateTrue() { - XmlBeanFactory bf = new XmlBeanFactory(SCOPED_AUTOWIRE_TRUE_CONTEXT); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions(SCOPED_AUTOWIRE_TRUE_CONTEXT); TestBean autowired = (TestBean) bf.getBean("autowired"); TestBean scoped = (TestBean) bf.getBean("scoped"); assertSame(scoped, autowired.getChild()); diff --git a/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java b/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java index e52d9b14e0..b55f2bb9f9 100644 --- a/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/support/RegexpMethodPointcutAdvisorIntegrationTests.java @@ -21,8 +21,8 @@ import static test.util.TestResourceUtils.qualifiedResource; import org.junit.Test; import org.springframework.aop.framework.Advised; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; import test.aop.NopInterceptor; @@ -43,7 +43,8 @@ public final class RegexpMethodPointcutAdvisorIntegrationTests { @Test public void testSinglePattern() throws Throwable { - BeanFactory bf = new XmlBeanFactory(CONTEXT); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions(CONTEXT); ITestBean advised = (ITestBean) bf.getBean("settersAdvised"); // Interceptor behind regexp advisor NopInterceptor nop = (NopInterceptor) bf.getBean("nopInterceptor"); @@ -61,7 +62,8 @@ public final class RegexpMethodPointcutAdvisorIntegrationTests { @Test public void testMultiplePatterns() throws Throwable { - BeanFactory bf = new XmlBeanFactory(CONTEXT); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions(CONTEXT); // This is a CGLIB proxy, so we can proxy it to the target class TestBean advised = (TestBean) bf.getBean("settersAndAbsquatulateAdvised"); // Interceptor behind regexp advisor @@ -84,7 +86,8 @@ public final class RegexpMethodPointcutAdvisorIntegrationTests { @Test public void testSerialization() throws Throwable { - BeanFactory bf = new XmlBeanFactory(CONTEXT); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions(CONTEXT); // This is a CGLIB proxy, so we can proxy it to the target class Person p = (Person) bf.getBean("serializableSettersAdvised"); // Interceptor behind regexp advisor diff --git a/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java index b3d6ceef18..cb897b602f 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/HotSwappableTargetSourceTests.java @@ -16,7 +16,9 @@ package org.springframework.aop.target; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import static test.util.TestResourceUtils.qualifiedResource; import org.junit.After; @@ -25,7 +27,8 @@ import org.junit.Test; import org.springframework.aop.framework.Advised; import org.springframework.aop.framework.ProxyFactory; import org.springframework.aop.support.DefaultPointcutAdvisor; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; import test.aop.SerializableNopInterceptor; @@ -46,11 +49,12 @@ public final class HotSwappableTargetSourceTests { /** Initial count value set in bean factory XML */ private static final int INITIAL_COUNT = 10; - private XmlBeanFactory beanFactory; + private DefaultListableBeanFactory beanFactory; @Before public void setUp() throws Exception { - this.beanFactory = new XmlBeanFactory(CONTEXT); + this.beanFactory = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions(CONTEXT); } /** diff --git a/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java index 984261bcc9..57cedd275b 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/LazyInitTargetSourceTests.java @@ -16,13 +16,16 @@ package org.springframework.aop.target; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import static test.util.TestResourceUtils.qualifiedResource; import java.util.Set; import org.junit.Test; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; import test.beans.ITestBean; @@ -43,7 +46,8 @@ public final class LazyInitTargetSourceTests { @Test public void testLazyInitSingletonTargetSource() { - XmlBeanFactory bf = new XmlBeanFactory(SINGLETON_CONTEXT); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions(SINGLETON_CONTEXT); bf.preInstantiateSingletons(); ITestBean tb = (ITestBean) bf.getBean("proxy"); @@ -54,7 +58,8 @@ public final class LazyInitTargetSourceTests { @Test public void testCustomLazyInitSingletonTargetSource() { - XmlBeanFactory bf = new XmlBeanFactory(CUSTOM_TARGET_CONTEXT); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions(CUSTOM_TARGET_CONTEXT); bf.preInstantiateSingletons(); ITestBean tb = (ITestBean) bf.getBean("proxy"); @@ -65,7 +70,8 @@ public final class LazyInitTargetSourceTests { @Test public void testLazyInitFactoryBeanTargetSource() { - XmlBeanFactory bf = new XmlBeanFactory(FACTORY_BEAN_CONTEXT); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions(FACTORY_BEAN_CONTEXT); bf.preInstantiateSingletons(); Set set1 = (Set) bf.getBean("proxy1"); diff --git a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java index 93205fb1b9..ea2eef2ae1 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeBasedTargetSourceTests.java @@ -41,10 +41,12 @@ public final class PrototypeBasedTargetSourceTests { public void testSerializability() throws Exception { MutablePropertyValues tsPvs = new MutablePropertyValues(); tsPvs.add("targetBeanName", "person"); - RootBeanDefinition tsBd = new RootBeanDefinition(TestTargetSource.class, tsPvs); + RootBeanDefinition tsBd = new RootBeanDefinition(TestTargetSource.class); + tsBd.setPropertyValues(tsPvs); MutablePropertyValues pvs = new MutablePropertyValues(); - RootBeanDefinition bd = new RootBeanDefinition(SerializablePerson.class, pvs); + RootBeanDefinition bd = new RootBeanDefinition(SerializablePerson.class); + bd.setPropertyValues(pvs); bd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE); DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); diff --git a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java index 204f3d8abd..700317fc8b 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/PrototypeTargetSourceTests.java @@ -22,7 +22,9 @@ import static test.util.TestResourceUtils.qualifiedResource; import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.BeanDefinitionRegistry; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; import test.beans.SideEffectBean; @@ -43,7 +45,8 @@ public final class PrototypeTargetSourceTests { @Before public void setUp() throws Exception { - this.beanFactory = new XmlBeanFactory(CONTEXT); + this.beanFactory = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader((BeanDefinitionRegistry) this.beanFactory).loadBeanDefinitions(CONTEXT); } /** diff --git a/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java index c896b9e638..1a6d5be3e3 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/ThreadLocalTargetSourceTests.java @@ -16,12 +16,15 @@ package org.springframework.aop.target; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; import static test.util.TestResourceUtils.qualifiedResource; import org.junit.Before; import org.junit.Test; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; import test.beans.ITestBean; @@ -39,11 +42,12 @@ public class ThreadLocalTargetSourceTests { /** Initial count value set in bean factory XML */ private static final int INITIAL_COUNT = 10; - private XmlBeanFactory beanFactory; + private DefaultListableBeanFactory beanFactory; @Before public void setUp() throws Exception { - this.beanFactory = new XmlBeanFactory(CONTEXT); + this.beanFactory = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions(CONTEXT); } /** diff --git a/spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java b/spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java index c5ac12d129..9732cfa4d9 100644 --- a/spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/target/dynamic/RefreshableTargetSourceTests.java @@ -19,8 +19,8 @@ package org.springframework.aop.target.dynamic; import static org.junit.Assert.*; import org.junit.Test; -import org.springframework.build.junit.Assume; -import org.springframework.build.junit.TestGroup; +import org.springframework.tests.Assume; +import org.springframework.tests.TestGroup; /** * @author Rob Harrop diff --git a/spring-aspects/src/test/java/org/springframework/mock/staticmock/AnnotationDrivenStaticEntityMockingControlTest.java b/spring-aspects/src/test/java/org/springframework/mock/staticmock/AnnotationDrivenStaticEntityMockingControlTest.java index 8c1584fc99..5a531301c9 100644 --- a/spring-aspects/src/test/java/org/springframework/mock/staticmock/AnnotationDrivenStaticEntityMockingControlTest.java +++ b/spring-aspects/src/test/java/org/springframework/mock/staticmock/AnnotationDrivenStaticEntityMockingControlTest.java @@ -16,16 +16,18 @@ package org.springframework.mock.staticmock; -import javax.persistence.PersistenceException; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl.expectReturn; +import static org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl.expectThrow; +import static org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl.playback; -import junit.framework.Assert; +import javax.persistence.PersistenceException; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import static org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl.*; - /** * Test for static entity mocking framework. @@ -43,7 +45,7 @@ public class AnnotationDrivenStaticEntityMockingControlTest { Person.countPeople(); expectReturn(expectedCount); playback(); - Assert.assertEquals(expectedCount, Person.countPeople()); + assertEquals(expectedCount, Person.countPeople()); } @Test(expected=PersistenceException.class) @@ -61,7 +63,7 @@ public class AnnotationDrivenStaticEntityMockingControlTest { Person.findPerson(id); expectReturn(found); playback(); - Assert.assertEquals(found, Person.findPerson(id)); + assertEquals(found, Person.findPerson(id)); } @@ -81,10 +83,10 @@ public class AnnotationDrivenStaticEntityMockingControlTest { expectReturn(0); playback(); - Assert.assertEquals(found1, Person.findPerson(id1)); - Assert.assertEquals(found2, Person.findPerson(id2)); - Assert.assertEquals(found1, Person.findPerson(id1)); - Assert.assertEquals(0, Person.countPeople()); + assertEquals(found1, Person.findPerson(id1)); + assertEquals(found2, Person.findPerson(id2)); + assertEquals(found1, Person.findPerson(id1)); + assertEquals(0, Person.countPeople()); } // Note delegation is used when tests are invalid and should fail, as otherwise @@ -94,7 +96,7 @@ public class AnnotationDrivenStaticEntityMockingControlTest { public void testArgMethodNoMatchExpectReturn() { try { new Delegate().testArgMethodNoMatchExpectReturn(); - Assert.fail(); + fail(); } catch (IllegalArgumentException expected) { } } @@ -105,7 +107,7 @@ public class AnnotationDrivenStaticEntityMockingControlTest { } private void called(Person found, long id) { - Assert.assertEquals(found, Person.findPerson(id)); + assertEquals(found, Person.findPerson(id)); } @Test diff --git a/spring-aspects/src/test/java/org/springframework/mock/staticmock/Delegate.java b/spring-aspects/src/test/java/org/springframework/mock/staticmock/Delegate.java index ad9bac5443..d4b3206bc3 100644 --- a/spring-aspects/src/test/java/org/springframework/mock/staticmock/Delegate.java +++ b/spring-aspects/src/test/java/org/springframework/mock/staticmock/Delegate.java @@ -16,12 +16,12 @@ package org.springframework.mock.staticmock; +import static org.junit.Assert.assertEquals; + import java.rmi.RemoteException; import javax.persistence.PersistenceException; -import junit.framework.Assert; - import org.junit.Ignore; import org.junit.Test; import org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl; @@ -40,7 +40,7 @@ public class Delegate { Person.findPerson(id); AnnotationDrivenStaticEntityMockingControl.expectReturn(found); AnnotationDrivenStaticEntityMockingControl.playback(); - Assert.assertEquals(found, Person.findPerson(id + 1)); + assertEquals(found, Person.findPerson(id + 1)); } @Test @@ -50,7 +50,7 @@ public class Delegate { Person.findPerson(id); AnnotationDrivenStaticEntityMockingControl.expectThrow(new PersistenceException()); AnnotationDrivenStaticEntityMockingControl.playback(); - Assert.assertEquals(found, Person.findPerson(id + 1)); + assertEquals(found, Person.findPerson(id + 1)); } @Test @@ -62,7 +62,7 @@ public class Delegate { Person.countPeople(); AnnotationDrivenStaticEntityMockingControl.expectReturn(25); AnnotationDrivenStaticEntityMockingControl.playback(); - Assert.assertEquals(found, Person.findPerson(id)); + assertEquals(found, Person.findPerson(id)); } @Test diff --git a/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java b/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java index 856e62c031..c3609c10c2 100644 --- a/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java +++ b/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java @@ -42,8 +42,8 @@ import static org.springframework.beans.PropertyDescriptorUtils.*; /** * Decorator for a standard {@link BeanInfo} object, e.g. as created by - * {@link Introspector#getBeanInfo(Class)}, designed to discover and register non-void - * returning setter methods. For example: + * {@link Introspector#getBeanInfo(Class)}, designed to discover and register static + * and/or non-void returning setter methods. For example: *
{@code
  * public class Bean {
  *     private Foo foo;
@@ -103,17 +103,17 @@ class ExtendedBeanInfo implements BeanInfo {
 					new SimpleNonIndexedPropertyDescriptor(pd));
 		}
 
-		for (Method method : findNonVoidWriteMethods(delegate.getMethodDescriptors())) {
-			handleNonVoidWriteMethod(method);
+		for (Method method : findCandidateWriteMethods(delegate.getMethodDescriptors())) {
+			handleCandidateWriteMethod(method);
 		}
 	}
 
 
-	private List findNonVoidWriteMethods(MethodDescriptor[] methodDescriptors) {
+	private List findCandidateWriteMethods(MethodDescriptor[] methodDescriptors) {
 		List matches = new ArrayList();
 		for (MethodDescriptor methodDescriptor : methodDescriptors) {
 			Method method = methodDescriptor.getMethod();
-			if (isNonVoidWriteMethod(method)) {
+			if (isCandidateWriteMethod(method)) {
 				matches.add(method);
 			}
 		}
@@ -128,20 +128,23 @@ class ExtendedBeanInfo implements BeanInfo {
 		return matches;
 	}
 
-	public static boolean isNonVoidWriteMethod(Method method) {
+	public static boolean isCandidateWriteMethod(Method method) {
 		String methodName = method.getName();
 		Class[] parameterTypes = method.getParameterTypes();
 		int nParams = parameterTypes.length;
 		if (methodName.length() > 3 && methodName.startsWith("set") &&
 				Modifier.isPublic(method.getModifiers()) &&
-				!void.class.isAssignableFrom(method.getReturnType()) &&
+				(
+						!void.class.isAssignableFrom(method.getReturnType()) ||
+						Modifier.isStatic(method.getModifiers())
+				) &&
 				(nParams == 1 || (nParams == 2 && parameterTypes[0].equals(int.class)))) {
 			return true;
 		}
 		return false;
 	}
 
-	private void handleNonVoidWriteMethod(Method method) throws IntrospectionException {
+	private void handleCandidateWriteMethod(Method method) throws IntrospectionException {
 		int nParams = method.getParameterTypes().length;
 		String propertyName = propertyNameFor(method);
 		Class propertyType = method.getParameterTypes()[nParams-1];
diff --git a/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfoFactory.java b/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfoFactory.java
index 7e46211922..183ffe4e2a 100644
--- a/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfoFactory.java
+++ b/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfoFactory.java
@@ -51,7 +51,7 @@ public class ExtendedBeanInfoFactory implements Ordered, BeanInfoFactory {
 	 */
 	private boolean supports(Class beanClass) {
 		for (Method method : beanClass.getMethods()) {
-			if (ExtendedBeanInfo.isNonVoidWriteMethod(method)) {
+			if (ExtendedBeanInfo.isCandidateWriteMethod(method)) {
 				return true;
 			}
 		}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java
index f155dedbdf..03e5716fdd 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java
@@ -234,6 +234,8 @@ public class CustomEditorConfigurer implements BeanFactoryPostProcessor, BeanCla
 			this.sharedEditor = sharedEditor;
 		}
 
+		@Override
+		@SuppressWarnings("deprecation")
 		public void registerCustomEditors(PropertyEditorRegistry registry) {
 			if (!(registry instanceof PropertyEditorRegistrySupport)) {
 				throw new IllegalArgumentException("Cannot registered shared editor " +
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java
index 359975c1ce..de4c3e695e 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java
@@ -716,6 +716,7 @@ public class BeanDefinitionParserDelegate {
 		}
 	}
 
+	@SuppressWarnings("deprecation")
 	public int getAutowireMode(String attValue) {
 		String att = attValue;
 		if (DEFAULT_VALUE.equals(att)) {
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/ResourceEntityResolver.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/ResourceEntityResolver.java
index 63e5a39f2d..b7e440d647 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/ResourceEntityResolver.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/ResourceEntityResolver.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.
@@ -77,7 +77,7 @@ public class ResourceEntityResolver extends DelegatingEntityResolver {
 			try {
 				String decodedSystemId = URLDecoder.decode(systemId);
 				String givenUrl = new URL(decodedSystemId).toString();
-				String systemRootUrl = new File("").toURL().toString();
+				String systemRootUrl = new File("").toURI().toURL().toString();
 				// Try relative to resource base if currently in system root.
 				if (givenUrl.startsWith(systemRootUrl)) {
 					resourcePath = givenUrl.substring(systemRootUrl.length());
diff --git a/spring-beans/src/test/java/com/foo/ComponentBeanDefinitionParserTest.java b/spring-beans/src/test/java/com/foo/ComponentBeanDefinitionParserTest.java
index b3e62ba2b8..a7a38f2c48 100644
--- a/spring-beans/src/test/java/com/foo/ComponentBeanDefinitionParserTest.java
+++ b/spring-beans/src/test/java/com/foo/ComponentBeanDefinitionParserTest.java
@@ -15,28 +15,30 @@
  */
 package com.foo;
 
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
+
 import java.util.List;
 
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.core.io.ClassPathResource;
 
-import static org.junit.Assert.*;
-import static org.hamcrest.CoreMatchers.*;
-
 /**
  * @author Costin Leau
  */
 public class ComponentBeanDefinitionParserTest {
 
-	private static XmlBeanFactory bf;
+	private static DefaultListableBeanFactory bf;
 
 	@BeforeClass
 	public static void setUpBeforeClass() throws Exception {
-		bf = new XmlBeanFactory(new ClassPathResource(
-				"com/foo/component-config.xml"));
+		bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
+				new ClassPathResource("com/foo/component-config.xml"));
 	}
 
 	@AfterClass
@@ -71,4 +73,4 @@ public class ComponentBeanDefinitionParserTest {
 		assertThat("Karate-1", equalTo(components.get(0).getName()));
 		assertThat("Sport-1", equalTo(components.get(1).getName()));
 	}
-}
\ No newline at end of file
+}
diff --git a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java
index 7da9710417..29e282c0a2 100644
--- a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java
@@ -49,8 +49,8 @@ import org.springframework.beans.propertyeditors.CustomNumberEditor;
 import org.springframework.beans.propertyeditors.StringArrayPropertyEditor;
 import org.springframework.beans.propertyeditors.StringTrimmerEditor;
 import org.springframework.beans.support.DerivedFromProtectedBaseBean;
-import org.springframework.build.junit.Assume;
-import org.springframework.build.junit.TestGroup;
+import org.springframework.tests.Assume;
+import org.springframework.tests.TestGroup;
 import org.springframework.core.convert.ConversionFailedException;
 import org.springframework.core.convert.TypeDescriptor;
 import org.springframework.core.convert.support.DefaultConversionService;
@@ -1550,6 +1550,24 @@ public final class BeanWrapperTests {
 		assertEquals(TestEnum.TEST_VALUE, consumer.getEnumValue());
 	}
 
+	@Test
+	public void cornerSpr10115() {
+		Spr10115Bean foo = new Spr10115Bean();
+		BeanWrapperImpl bwi = new BeanWrapperImpl();
+		bwi.setWrappedInstance(foo);
+		bwi.setPropertyValue("prop1", "val1");
+		assertEquals("val1", Spr10115Bean.prop1);
+	}
+
+
+	static class Spr10115Bean {
+		private static String prop1;
+
+		public static void setProp1(String prop1) {
+			Spr10115Bean.prop1 = prop1;
+		}
+	}
+
 
 	private static class Foo {
 
diff --git a/spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java b/spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java
index 788ee5c85c..d1c21b1b3a 100644
--- a/spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/ExtendedBeanInfoTests.java
@@ -962,4 +962,27 @@ public class ExtendedBeanInfoTests {
 		}
 	}
 
+	@Test
+	public void shouldSupportStaticWriteMethod() throws IntrospectionException {
+		{
+			BeanInfo bi = Introspector.getBeanInfo(WithStaticWriteMethod.class);
+			assertThat(hasReadMethodForProperty(bi, "prop1"), is(false));
+			assertThat(hasWriteMethodForProperty(bi, "prop1"), is(false));
+			assertThat(hasIndexedReadMethodForProperty(bi, "prop1"), is(false));
+			assertThat(hasIndexedWriteMethodForProperty(bi, "prop1"), is(false));
+		}
+		{
+			BeanInfo bi = new ExtendedBeanInfo(Introspector.getBeanInfo(WithStaticWriteMethod.class));
+			assertThat(hasReadMethodForProperty(bi, "prop1"), is(false));
+			assertThat(hasWriteMethodForProperty(bi, "prop1"), is(true));
+			assertThat(hasIndexedReadMethodForProperty(bi, "prop1"), is(false));
+			assertThat(hasIndexedWriteMethodForProperty(bi, "prop1"), is(false));
+		}
+	}
+
+	static class WithStaticWriteMethod {
+		@SuppressWarnings("unused")
+		public static void setProp1(String prop1) {
+		}
+	}
 }
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java
index 636fbda545..d05f7ba577 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java
@@ -16,16 +16,21 @@
 
 package org.springframework.beans.factory;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static test.util.TestResourceUtils.qualifiedResource;
+
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 
 import org.junit.Before;
 import org.junit.Test;
-
 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.beans.factory.support.StaticListableBeanFactory;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.cglib.proxy.NoOp;
 import org.springframework.core.io.Resource;
 import org.springframework.util.ObjectUtils;
@@ -35,9 +40,6 @@ import test.beans.ITestBean;
 import test.beans.IndexedTestBean;
 import test.beans.TestBean;
 
-import static org.junit.Assert.*;
-import static test.util.TestResourceUtils.qualifiedResource;
-
 /**
  * @author Rod Johnson
  * @author Juergen Hoeller
@@ -60,10 +62,17 @@ public final class BeanFactoryUtilsTests {
 	public void setUp() {
 		// Interesting hierarchical factory to test counts.
 		// Slow to read so we cache it.
-		XmlBeanFactory grandParent = new XmlBeanFactory(ROOT_CONTEXT);
-		XmlBeanFactory parent = new XmlBeanFactory(MIDDLE_CONTEXT, grandParent);
-		XmlBeanFactory child = new XmlBeanFactory(LEAF_CONTEXT, parent);
-		this.dependentBeansBF = new XmlBeanFactory(DEPENDENT_BEANS_CONTEXT);
+
+
+		DefaultListableBeanFactory grandParent = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(grandParent).loadBeanDefinitions(ROOT_CONTEXT);
+		DefaultListableBeanFactory parent = new DefaultListableBeanFactory(grandParent);
+		new XmlBeanDefinitionReader(parent).loadBeanDefinitions(MIDDLE_CONTEXT);
+		DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
+		new XmlBeanDefinitionReader(child).loadBeanDefinitions(LEAF_CONTEXT);
+
+		this.dependentBeansBF = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader((BeanDefinitionRegistry) this.dependentBeansBF).loadBeanDefinitions(DEPENDENT_BEANS_CONTEXT);
 		dependentBeansBF.preInstantiateSingletons();
 		this.listableBeanFactory = child;
 	}
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java
index 967cd5d2b8..96eeb3b01f 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/ConcurrentBeanFactoryTests.java
@@ -16,7 +16,8 @@
 
 package org.springframework.beans.factory;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 import static test.util.TestResourceUtils.qualifiedResource;
 
 import java.text.DateFormat;
@@ -34,7 +35,8 @@ import org.junit.Before;
 import org.junit.Test;
 import org.springframework.beans.PropertyEditorRegistrar;
 import org.springframework.beans.PropertyEditorRegistry;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.beans.propertyeditors.CustomDateEditor;
 import org.springframework.core.io.Resource;
 
@@ -70,7 +72,8 @@ public final class ConcurrentBeanFactoryTests {
 
 	@Before
 	public void setUp() throws Exception {
-		XmlBeanFactory factory = new XmlBeanFactory(CONTEXT);
+		DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(factory).loadBeanDefinitions(CONTEXT);
 		factory.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
 			@Override
 			public void registerCustomEditors(PropertyEditorRegistry registry) {
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java
index 35f3420ca0..0e474fadae 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java
@@ -72,8 +72,8 @@ import org.springframework.beans.factory.support.RootBeanDefinition;
 import org.springframework.beans.factory.xml.ConstructorDependenciesBean;
 import org.springframework.beans.factory.xml.DependenciesBean;
 import org.springframework.beans.propertyeditors.CustomNumberEditor;
-import org.springframework.build.junit.Assume;
-import org.springframework.build.junit.TestGroup;
+import org.springframework.tests.Assume;
+import org.springframework.tests.TestGroup;
 import org.springframework.core.MethodParameter;
 import org.springframework.core.convert.converter.Converter;
 import org.springframework.core.convert.support.DefaultConversionService;
@@ -549,7 +549,9 @@ public class DefaultListableBeanFactoryTests {
 		DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
 		MutablePropertyValues pvs = new MutablePropertyValues();
 		pvs.add("spouse", new RuntimeBeanReference("self"));
-		lbf.registerBeanDefinition("self", new RootBeanDefinition(TestBean.class, pvs));
+		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
+		bd.setPropertyValues(pvs);
+		lbf.registerBeanDefinition("self", bd);
 		TestBean self = (TestBean) lbf.getBean("self");
 		assertEquals(self, self.getSpouse());
 	}
@@ -560,7 +562,9 @@ public class DefaultListableBeanFactoryTests {
 			DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
 			MutablePropertyValues pvs = new MutablePropertyValues();
 			pvs.add("ag", "foobar");
-			lbf.registerBeanDefinition("tb", new RootBeanDefinition(TestBean.class, pvs));
+			RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
+			bd.setPropertyValues(pvs);
+			lbf.registerBeanDefinition("tb", bd);
 			lbf.getBean("tb");
 			fail("Should throw exception on invalid property");
 		}
@@ -846,7 +850,9 @@ public class DefaultListableBeanFactoryTests {
 		});
 		MutablePropertyValues pvs = new MutablePropertyValues();
 		pvs.add("myFloat", "1,1");
-		lbf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class, pvs));
+		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
+		bd.setPropertyValues(pvs);
+		lbf.registerBeanDefinition("testBean", bd);
 		TestBean testBean = (TestBean) lbf.getBean("testBean");
 		assertTrue(testBean.getMyFloat().floatValue() == 1.1f);
 	}
@@ -870,7 +876,9 @@ public class DefaultListableBeanFactoryTests {
 		lbf.setConversionService(conversionService);
 		MutablePropertyValues pvs = new MutablePropertyValues();
 		pvs.add("myFloat", "1,1");
-		lbf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class, pvs));
+		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
+		bd.setPropertyValues(pvs);
+		lbf.registerBeanDefinition("testBean", bd);
 		TestBean testBean = (TestBean) lbf.getBean("testBean");
 		assertTrue(testBean.getMyFloat().floatValue() == 1.1f);
 	}
@@ -887,7 +895,9 @@ public class DefaultListableBeanFactoryTests {
 		});
 		MutablePropertyValues pvs = new MutablePropertyValues();
 		pvs.add("myFloat", new RuntimeBeanReference("myFloat"));
-		lbf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class, pvs));
+		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
+		bd.setPropertyValues(pvs);
+		lbf.registerBeanDefinition("testBean", bd);
 		lbf.registerSingleton("myFloat", "1,1");
 		TestBean testBean = (TestBean) lbf.getBean("testBean");
 		assertTrue(testBean.getMyFloat().floatValue() == 1.1f);
@@ -990,7 +1000,8 @@ public class DefaultListableBeanFactoryTests {
 		MutablePropertyValues pvs = new MutablePropertyValues();
 		pvs.add("name", "Tony");
 		pvs.add("age", "48");
-		RootBeanDefinition bd = new RootBeanDefinition(DependenciesBean.class, pvs);
+		RootBeanDefinition bd = new RootBeanDefinition(DependenciesBean.class);
+		bd.setPropertyValues(pvs);
 		bd.setDependencyCheck(RootBeanDefinition.DEPENDENCY_CHECK_OBJECTS);
 		bd.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
 		lbf.registerBeanDefinition("test", bd);
@@ -1039,7 +1050,8 @@ public class DefaultListableBeanFactoryTests {
 		bf.registerSingleton("resource1", new UrlResource("http://localhost:8080"));
 		bf.registerSingleton("resource2", new UrlResource("http://localhost:9090"));
 
-		RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE);
+		RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class);
+		rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
 		bf.registerBeanDefinition("arrayBean", rbd);
 		ArrayBean ab = (ArrayBean) bf.getBean("arrayBean");
 
@@ -1051,7 +1063,8 @@ public class DefaultListableBeanFactoryTests {
 	public void testArrayPropertyWithOptionalAutowiring() throws MalformedURLException {
 		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
 
-		RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE);
+		RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class);
+		rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
 		bf.registerBeanDefinition("arrayBean", rbd);
 		ArrayBean ab = (ArrayBean) bf.getBean("arrayBean");
 
@@ -1064,7 +1077,8 @@ public class DefaultListableBeanFactoryTests {
 		bf.registerSingleton("integer1", new Integer(4));
 		bf.registerSingleton("integer2", new Integer(5));
 
-		RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
+		RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class);
+		rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
 		bf.registerBeanDefinition("arrayBean", rbd);
 		ArrayBean ab = (ArrayBean) bf.getBean("arrayBean");
 
@@ -1076,7 +1090,8 @@ public class DefaultListableBeanFactoryTests {
 	public void testArrayConstructorWithOptionalAutowiring() {
 		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
 
-		RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
+		RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class);
+		rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
 		bf.registerBeanDefinition("arrayBean", rbd);
 		ArrayBean ab = (ArrayBean) bf.getBean("arrayBean");
 
@@ -1091,7 +1106,8 @@ public class DefaultListableBeanFactoryTests {
 		bf.registerSingleton("resource1", new UrlResource("http://localhost:8080"));
 		bf.registerSingleton("resource2", new UrlResource("http://localhost:9090"));
 
-		RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
+		RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class);
+		rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
 		bf.registerBeanDefinition("arrayBean", rbd);
 		ArrayBean ab = (ArrayBean) bf.getBean("arrayBean");
 
@@ -1107,7 +1123,8 @@ public class DefaultListableBeanFactoryTests {
 		bf.registerSingleton("resource1", new UrlResource("http://localhost:8080"));
 		bf.registerSingleton("resource2", new UrlResource("http://localhost:9090"));
 
-		RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
+		RootBeanDefinition rbd = new RootBeanDefinition(ArrayBean.class);
+		rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
 		bf.registerBeanDefinition("arrayBean", rbd);
 		ArrayBean ab = (ArrayBean) bf.getBean("arrayBean");
 
@@ -1121,7 +1138,7 @@ public class DefaultListableBeanFactoryTests {
 		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
 		lbf.registerBeanDefinition("rod", bd);
 		assertEquals(1, lbf.getBeanDefinitionCount());
-		Object registered = lbf.autowire(NoDependencies.class, AutowireCapableBeanFactory.AUTOWIRE_AUTODETECT, false);
+		Object registered = lbf.autowire(NoDependencies.class, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, false);
 		assertEquals(1, lbf.getBeanDefinitionCount());
 		assertTrue(registered instanceof NoDependencies);
 	}
@@ -1131,11 +1148,12 @@ public class DefaultListableBeanFactoryTests {
 		DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
 		MutablePropertyValues pvs = new MutablePropertyValues();
 		pvs.add("name", "Rod");
-		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, pvs);
+		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
+		bd.setPropertyValues(pvs);
 		lbf.registerBeanDefinition("rod", bd);
 		assertEquals(1, lbf.getBeanDefinitionCount());
 		// Depends on age, name and spouse (TestBean)
-		Object registered = lbf.autowire(DependenciesBean.class, AutowireCapableBeanFactory.AUTOWIRE_AUTODETECT, true);
+		Object registered = lbf.autowire(DependenciesBean.class, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, true);
 		assertEquals(1, lbf.getBeanDefinitionCount());
 		DependenciesBean kerry = (DependenciesBean) registered;
 		TestBean rod = (TestBean) lbf.getBean("rod");
@@ -1147,10 +1165,11 @@ public class DefaultListableBeanFactoryTests {
 		DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
 		MutablePropertyValues pvs = new MutablePropertyValues();
 		pvs.add("name", "Rod");
-		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, pvs);
+		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
+		bd.setPropertyValues(pvs);
 		lbf.registerBeanDefinition("rod", bd);
 		assertEquals(1, lbf.getBeanDefinitionCount());
-		Object registered = lbf.autowire(ConstructorDependency.class, AutowireCapableBeanFactory.AUTOWIRE_AUTODETECT, false);
+		Object registered = lbf.autowire(ConstructorDependency.class, AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, false);
 		assertEquals(1, lbf.getBeanDefinitionCount());
 		ConstructorDependency kerry = (ConstructorDependency) registered;
 		TestBean rod = (TestBean) lbf.getBean("rod");
@@ -1165,7 +1184,7 @@ public class DefaultListableBeanFactoryTests {
 		RootBeanDefinition bd2 = new RootBeanDefinition(TestBean.class);
 		lbf.registerBeanDefinition("rod2", bd2);
 		try {
-			lbf.autowire(ConstructorDependency.class, AutowireCapableBeanFactory.AUTOWIRE_AUTODETECT, false);
+			lbf.autowire(ConstructorDependency.class, AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, false);
 			fail("Should have thrown UnsatisfiedDependencyException");
 		}
 		catch (UnsatisfiedDependencyException ex) {
@@ -1180,11 +1199,12 @@ public class DefaultListableBeanFactoryTests {
 		DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
 		MutablePropertyValues pvs = new MutablePropertyValues();
 		pvs.addPropertyValue(new PropertyValue("name", "Rod"));
-		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, pvs);
+		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
+		bd.setPropertyValues(pvs);
 		lbf.registerBeanDefinition("rod", bd);
 		assertEquals(1, lbf.getBeanDefinitionCount());
 		try {
-			lbf.autowire(UnsatisfiedConstructorDependency.class, AutowireCapableBeanFactory.AUTOWIRE_AUTODETECT, true);
+			lbf.autowire(UnsatisfiedConstructorDependency.class, AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, true);
 			fail("Should have unsatisfied constructor dependency on SideEffectBean");
 		}
 		catch (UnsatisfiedDependencyException ex) {
@@ -1467,7 +1487,9 @@ public class DefaultListableBeanFactoryTests {
 		DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
 		MutablePropertyValues pvs = new MutablePropertyValues();
 		pvs.add("age", "99");
-		lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class, pvs));
+		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
+		bd.setPropertyValues(pvs);
+		lbf.registerBeanDefinition("test", bd);
 		TestBean tb = new TestBean();
 		assertEquals(0, tb.getAge());
 		lbf.applyBeanPropertyValues(tb, "test");
@@ -1479,7 +1501,9 @@ public class DefaultListableBeanFactoryTests {
 		DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
 		MutablePropertyValues pvs = new MutablePropertyValues();
 		pvs.add("age", "99");
-		lbf.registerBeanDefinition("test", new RootBeanDefinition(null, pvs));
+		RootBeanDefinition bd = new RootBeanDefinition();
+		bd.setPropertyValues(pvs);
+		lbf.registerBeanDefinition("test", bd);
 		TestBean tb = new TestBean();
 		assertEquals(0, tb.getAge());
 		lbf.applyBeanPropertyValues(tb, "test");
@@ -1493,7 +1517,9 @@ public class DefaultListableBeanFactoryTests {
 		DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
 		MutablePropertyValues pvs = new MutablePropertyValues();
 		pvs.add("age", "99");
-		lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class, pvs));
+		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
+		bd.setPropertyValues(pvs);
+		lbf.registerBeanDefinition("test", bd);
 		TestBean tb = new TestBean();
 		assertEquals(0, tb.getAge());
 		lbf.configureBean(tb, "test");
@@ -1509,7 +1535,9 @@ public class DefaultListableBeanFactoryTests {
 		lbf.registerBeanDefinition("spouse", bd);
 		MutablePropertyValues pvs = new MutablePropertyValues();
 		pvs.add("age", "99");
-		lbf.registerBeanDefinition("test", new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_NAME));
+		RootBeanDefinition tbd = new RootBeanDefinition(TestBean.class);
+		tbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_NAME);
+		lbf.registerBeanDefinition("test", tbd);
 		TestBean tb = new TestBean();
 		lbf.configureBean(tb, "test");
 		assertSame(lbf, tb.getBeanFactory());
@@ -1523,7 +1551,8 @@ public class DefaultListableBeanFactoryTests {
 		for (int i = 0; i < 1000; i++) {
 			MutablePropertyValues pvs = new MutablePropertyValues();
 			pvs.addPropertyValue(new PropertyValue("spouse", new RuntimeBeanReference("bean" + (i < 99 ? i + 1 : 0))));
-			RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, pvs);
+			RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
+			bd.setPropertyValues(pvs);
 			lbf.registerBeanDefinition("bean" + i, bd);
 		}
 		lbf.preInstantiateSingletons();
@@ -1537,7 +1566,9 @@ public class DefaultListableBeanFactoryTests {
 	@Test
 	public void testCircularReferenceThroughAutowiring() {
 		DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
-		lbf.registerBeanDefinition("test", new RootBeanDefinition(ConstructorDependencyBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR));
+		RootBeanDefinition bd = new RootBeanDefinition(ConstructorDependencyBean.class);
+		bd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
+		lbf.registerBeanDefinition("test", bd);
 		try {
 			lbf.preInstantiateSingletons();
 			fail("Should have thrown UnsatisfiedDependencyException");
@@ -1549,7 +1580,9 @@ public class DefaultListableBeanFactoryTests {
 	@Test
 	public void testCircularReferenceThroughFactoryBeanAutowiring() {
 		DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
-		lbf.registerBeanDefinition("test", new RootBeanDefinition(ConstructorDependencyFactoryBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR));
+		RootBeanDefinition bd = new RootBeanDefinition(ConstructorDependencyFactoryBean.class);
+		bd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
+		lbf.registerBeanDefinition("test", bd);
 		try {
 			lbf.preInstantiateSingletons();
 			fail("Should have thrown UnsatisfiedDependencyException");
@@ -1561,7 +1594,9 @@ public class DefaultListableBeanFactoryTests {
 	@Test
 	public void testCircularReferenceThroughFactoryBeanTypeCheck() {
 		DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
-		lbf.registerBeanDefinition("test", new RootBeanDefinition(ConstructorDependencyFactoryBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR));
+		RootBeanDefinition bd = new RootBeanDefinition(ConstructorDependencyFactoryBean.class);
+		bd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
+		lbf.registerBeanDefinition("test", bd);
 		try {
 			lbf.getBeansOfType(String.class);
 			fail("Should have thrown UnsatisfiedDependencyException");
@@ -1573,9 +1608,12 @@ public class DefaultListableBeanFactoryTests {
 	@Test
 	public void testAvoidCircularReferenceThroughAutowiring() {
 		DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
-		lbf.registerBeanDefinition("test", new RootBeanDefinition(ConstructorDependencyFactoryBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR));
-		lbf.registerBeanDefinition("string",
-				new RootBeanDefinition(String.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR));
+		RootBeanDefinition bd = new RootBeanDefinition(ConstructorDependencyFactoryBean.class);
+		bd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
+		lbf.registerBeanDefinition("test", bd);
+		RootBeanDefinition bd2 = new RootBeanDefinition(String.class);
+		bd2.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
+		lbf.registerBeanDefinition("string", bd2);
 		lbf.preInstantiateSingletons();
 	}
 
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanLookupTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanLookupTests.java
index 3f7e69e4f4..6f2704b1f7 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanLookupTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanLookupTests.java
@@ -22,9 +22,10 @@ import static org.junit.Assert.assertThat;
 
 import org.junit.Before;
 import org.junit.Test;
-import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.config.AbstractFactoryBean;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.core.io.ClassPathResource;
 
 /**
@@ -37,7 +38,8 @@ public class FactoryBeanLookupTests {
 
 	@Before
 	public void setUp() {
-		beanFactory = new XmlBeanFactory(
+		beanFactory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader((BeanDefinitionRegistry) beanFactory).loadBeanDefinitions(
 				new ClassPathResource("FactoryBeanLookupTests-context.xml", this.getClass()));
 	}
 
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java
index 0a50c2e617..bccb33a978 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/FactoryBeanTests.java
@@ -16,12 +16,15 @@
 
 package org.springframework.beans.factory;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
 import static test.util.TestResourceUtils.qualifiedResource;
 
 import org.junit.Test;
 import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.core.io.Resource;
 import org.springframework.util.Assert;
 
@@ -38,14 +41,16 @@ public final class FactoryBeanTests {
 
 	@Test
 	public void testFactoryBeanReturnsNull() throws Exception {
-		XmlBeanFactory factory = new XmlBeanFactory(RETURNS_NULL_CONTEXT);
+		DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(factory).loadBeanDefinitions(RETURNS_NULL_CONTEXT);
 		Object result = factory.getBean("factoryBean");
 		assertNull(result);
 	}
 
 	@Test
 	public void testFactoryBeansWithAutowiring() throws Exception {
-		XmlBeanFactory factory = new XmlBeanFactory(WITH_AUTOWIRING_CONTEXT);
+		DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(factory).loadBeanDefinitions(WITH_AUTOWIRING_CONTEXT);
 
 		BeanFactoryPostProcessor ppc = (BeanFactoryPostProcessor) factory.getBean("propertyPlaceholderConfigurer");
 		ppc.postProcessBeanFactory(factory);
@@ -62,7 +67,8 @@ public final class FactoryBeanTests {
 
 	@Test
 	public void testFactoryBeansWithIntermediateFactoryBeanAutowiringFailure() throws Exception {
-		XmlBeanFactory factory = new XmlBeanFactory(WITH_AUTOWIRING_CONTEXT);
+		DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(factory).loadBeanDefinitions(WITH_AUTOWIRING_CONTEXT);
 
 		BeanFactoryPostProcessor ppc = (BeanFactoryPostProcessor) factory.getBean("propertyPlaceholderConfigurer");
 		ppc.postProcessBeanFactory(factory);
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java
index 9df0cbc309..5acfcca8b6 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java
@@ -16,6 +16,14 @@
 
 package org.springframework.beans.factory.annotation;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.Serializable;
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
@@ -25,15 +33,11 @@ import java.util.List;
 import java.util.Map;
 
 import org.junit.Test;
-import test.beans.ITestBean;
-import test.beans.IndexedTestBean;
-import test.beans.NestedTestBean;
-import test.beans.TestBean;
-
 import org.springframework.beans.factory.BeanCreationException;
 import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.FactoryBean;
 import org.springframework.beans.factory.ObjectFactory;
+import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 import org.springframework.beans.factory.support.AutowireCandidateQualifier;
 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
@@ -41,7 +45,10 @@ import org.springframework.beans.factory.support.GenericBeanDefinition;
 import org.springframework.beans.factory.support.RootBeanDefinition;
 import org.springframework.util.SerializationTestUtils;
 
-import static org.junit.Assert.*;
+import test.beans.ITestBean;
+import test.beans.IndexedTestBean;
+import test.beans.NestedTestBean;
+import test.beans.TestBean;
 
 /**
  * Unit tests for {@link AutowiredAnnotationBeanPostProcessor}.
@@ -608,7 +615,9 @@ public final class AutowiredAnnotationBeanPostProcessorTests {
 		AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
 		bpp.setBeanFactory(bf);
 		bf.addBeanPostProcessor(bpp);
-		bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryInjectionBean.class, false));
+		RootBeanDefinition annotatedBeanDefinition = new RootBeanDefinition(ObjectFactoryInjectionBean.class);
+		annotatedBeanDefinition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
+		bf.registerBeanDefinition("annotatedBean", annotatedBeanDefinition);
 		bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class));
 
 		ObjectFactoryInjectionBean bean = (ObjectFactoryInjectionBean) bf.getBean("annotatedBean");
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java
index 9760821441..4cfba96615 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/InjectAnnotationBeanPostProcessorTests.java
@@ -32,6 +32,7 @@ import test.beans.TestBean;
 import org.springframework.beans.factory.BeanCreationException;
 import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.FactoryBean;
+import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 import org.springframework.beans.factory.support.AutowireCandidateQualifier;
 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
@@ -406,7 +407,9 @@ public class InjectAnnotationBeanPostProcessorTests {
 		AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
 		bpp.setBeanFactory(bf);
 		bf.addBeanPostProcessor(bpp);
-		bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryQualifierFieldInjectionBean.class, false));
+		RootBeanDefinition annotatedBeanDefinition = new RootBeanDefinition(ObjectFactoryQualifierFieldInjectionBean.class);
+		annotatedBeanDefinition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
+		bf.registerBeanDefinition("annotatedBean", annotatedBeanDefinition);
 		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
 		bd.addQualifier(new AutowireCandidateQualifier(Qualifier.class, "testBean"));
 		bf.registerBeanDefinition("testBean", bd);
@@ -426,7 +429,9 @@ public class InjectAnnotationBeanPostProcessorTests {
 		AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
 		bpp.setBeanFactory(bf);
 		bf.addBeanPostProcessor(bpp);
-		bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ObjectFactoryQualifierMethodInjectionBean.class, false));
+		RootBeanDefinition annotatedBeanDefinition = new RootBeanDefinition(ObjectFactoryQualifierMethodInjectionBean.class);
+		annotatedBeanDefinition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
+		bf.registerBeanDefinition("annotatedBean", annotatedBeanDefinition);
 		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
 		bd.addQualifier(new AutowireCandidateQualifier(Qualifier.class, "testBean"));
 		bf.registerBeanDefinition("testBean", bd);
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/CommonsLogFactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/CommonsLogFactoryBeanTests.java
index e92f28b816..c01585a153 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/config/CommonsLogFactoryBeanTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/CommonsLogFactoryBeanTests.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.
@@ -27,6 +27,7 @@ import org.junit.Test;
  * @author Rick Evans
  * @author Chris Beams
  */
+@SuppressWarnings("deprecation")
 public final class CommonsLogFactoryBeanTests {
 
 	@Test
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomEditorConfigurerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomEditorConfigurerTests.java
index 6691e2401f..c5c49d9b3b 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomEditorConfigurerTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/CustomEditorConfigurerTests.java
@@ -62,10 +62,14 @@ public final class CustomEditorConfigurerTests {
 
 		MutablePropertyValues pvs = new MutablePropertyValues();
 		pvs.add("date", "2.12.1975");
-		bf.registerBeanDefinition("tb1", new RootBeanDefinition(TestBean.class, pvs));
+		RootBeanDefinition bd1 = new RootBeanDefinition(TestBean.class);
+		bd1.setPropertyValues(pvs);
+		bf.registerBeanDefinition("tb1", bd1);
 		pvs = new MutablePropertyValues();
 		pvs.add("someMap[myKey]", new TypedStringValue("2.12.1975", Date.class));
-		bf.registerBeanDefinition("tb2", new RootBeanDefinition(TestBean.class, pvs));
+		RootBeanDefinition bd2 = new RootBeanDefinition(TestBean.class);
+		bd2.setPropertyValues(pvs);
+		bf.registerBeanDefinition("tb2", bd2);
 
 		TestBean tb1 = (TestBean) bf.getBean("tb1");
 		assertEquals(df.parse("2.12.1975"), tb1.getDate());
@@ -85,10 +89,14 @@ public final class CustomEditorConfigurerTests {
 
 		MutablePropertyValues pvs = new MutablePropertyValues();
 		pvs.add("date", "2.12.1975");
-		bf.registerBeanDefinition("tb1", new RootBeanDefinition(TestBean.class, pvs));
+		RootBeanDefinition bd1 = new RootBeanDefinition(TestBean.class);
+		bd1.setPropertyValues(pvs);
+		bf.registerBeanDefinition("tb1", bd1);
 		pvs = new MutablePropertyValues();
 		pvs.add("someMap[myKey]", new TypedStringValue("2.12.1975", Date.class));
-		bf.registerBeanDefinition("tb2", new RootBeanDefinition(TestBean.class, pvs));
+		RootBeanDefinition bd2 = new RootBeanDefinition(TestBean.class);
+		bd2.setPropertyValues(pvs);
+		bf.registerBeanDefinition("tb2", bd2);
 
 		TestBean tb1 = (TestBean) bf.getBean("tb1");
 		assertEquals(df.parse("2.12.1975"), tb1.getDate());
@@ -107,7 +115,9 @@ public final class CustomEditorConfigurerTests {
 
 		MutablePropertyValues pvs = new MutablePropertyValues();
 		pvs.add("date", "2.12.1975");
-		bf.registerBeanDefinition("tb", new RootBeanDefinition(TestBean.class, pvs));
+		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
+		bd.setPropertyValues(pvs);
+		bf.registerBeanDefinition("tb", bd);
 
 		TestBean tb = (TestBean) bf.getBean("tb");
 		DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMAN);
@@ -125,7 +135,9 @@ public final class CustomEditorConfigurerTests {
 
 		MutablePropertyValues pvs = new MutablePropertyValues();
 		pvs.add("date", "2.12.1975");
-		bf.registerBeanDefinition("tb", new RootBeanDefinition(TestBean.class, pvs));
+		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
+		bd.setPropertyValues(pvs);
+		bf.registerBeanDefinition("tb", bd);
 
 		TestBean tb = (TestBean) bf.getBean("tb");
 		DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMAN);
@@ -143,7 +155,9 @@ public final class CustomEditorConfigurerTests {
 
 		MutablePropertyValues pvs = new MutablePropertyValues();
 		pvs.add("stringArray", "xxx");
-		bf.registerBeanDefinition("tb", new RootBeanDefinition(TestBean.class, pvs));
+		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
+		bd.setPropertyValues(pvs);
+		bf.registerBeanDefinition("tb", bd);
 
 		TestBean tb = (TestBean) bf.getBean("tb");
 		assertTrue(tb.getStringArray() != null && tb.getStringArray().length == 1);
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/DeprecatedBeanWarnerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/DeprecatedBeanWarnerTests.java
index 6ae7cf7400..4ed025b09b 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/config/DeprecatedBeanWarnerTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/DeprecatedBeanWarnerTests.java
@@ -38,6 +38,7 @@ public class DeprecatedBeanWarnerTests {
 
 
 	@Test
+	@SuppressWarnings("deprecation")
 	public void postProcess() {
 		beanFactory = new DefaultListableBeanFactory();
 		BeanDefinition def = new RootBeanDefinition(MyDeprecatedBean.class);
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java
index 8b1a7079c7..a7faf0cc08 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/ObjectFactoryCreatingFactoryBeanTests.java
@@ -16,21 +16,25 @@
 
 package org.springframework.beans.factory.config;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.mock;
+import static test.util.TestResourceUtils.qualifiedResource;
+
 import java.util.Date;
+
 import javax.inject.Provider;
 
 import org.junit.After;
-import static org.junit.Assert.*;
-import static org.mockito.BDDMockito.given;
-import static org.mockito.Mockito.mock;
-
 import org.junit.Before;
 import org.junit.Test;
-import static test.util.TestResourceUtils.*;
-
 import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.ObjectFactory;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.core.io.Resource;
 import org.springframework.util.SerializationTestUtils;
 
@@ -45,11 +49,12 @@ public class ObjectFactoryCreatingFactoryBeanTests {
 	private static final Resource CONTEXT =
 		qualifiedResource(ObjectFactoryCreatingFactoryBeanTests.class, "context.xml");
 
-	private XmlBeanFactory beanFactory;
+	private DefaultListableBeanFactory beanFactory;
 
 	@Before
 	public void setUp() {
-		this.beanFactory = new XmlBeanFactory(CONTEXT);
+		this.beanFactory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions(CONTEXT);
 		this.beanFactory.setSerializationId("test");
 	}
 
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java
index 73daf724a3..6ec0c706e6 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java
@@ -16,11 +16,15 @@
 
 package org.springframework.beans.factory.config;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
 import static test.util.TestResourceUtils.qualifiedResource;
 
 import org.junit.Test;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.core.io.Resource;
 
 import test.beans.ITestBean;
@@ -39,7 +43,8 @@ public class PropertyPathFactoryBeanTests {
 
 	@Test
 	public void testPropertyPathFactoryBeanWithSingletonResult() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
 		assertEquals(new Integer(12), xbf.getBean("propertyPath1"));
 		assertEquals(new Integer(11), xbf.getBean("propertyPath2"));
 		assertEquals(new Integer(10), xbf.getBean("tb.age"));
@@ -53,7 +58,8 @@ public class PropertyPathFactoryBeanTests {
 
 	@Test
 	public void testPropertyPathFactoryBeanWithPrototypeResult() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
 		assertNull(xbf.getType("tb.spouse"));
 		assertEquals(TestBean.class, xbf.getType("propertyPath3"));
 		Object result1 = xbf.getBean("tb.spouse");
@@ -72,14 +78,16 @@ public class PropertyPathFactoryBeanTests {
 
 	@Test
 	public void testPropertyPathFactoryBeanWithNullResult() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
 		assertNull(xbf.getType("tb.spouse.spouse"));
 		assertNull(xbf.getBean("tb.spouse.spouse"));
 	}
 
 	@Test
 	public void testPropertyPathFactoryBeanAsInnerBean() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONTEXT);
 		TestBean spouse = (TestBean) xbf.getBean("otb.spouse");
 		TestBean tbWithInner = (TestBean) xbf.getBean("tbWithInner");
 		assertSame(spouse, tbWithInner.getSpouse());
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java
index 931dd10e8e..ab67af35a3 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java
@@ -371,7 +371,8 @@ public final class PropertyResourceConfigurerTests {
 			pvs2.add("name", "name${var}${var}${");
 			pvs2.add("spouse", new RuntimeBeanReference("${ref}"));
 			pvs2.add("someMap", singletonMap);
-			RootBeanDefinition parent = new RootBeanDefinition(TestBean.class, pvs1);
+			RootBeanDefinition parent = new RootBeanDefinition(TestBean.class);
+			parent.setPropertyValues(pvs1);
 			ChildBeanDefinition bd = new ChildBeanDefinition("${parent}", pvs2);
 			factory.registerBeanDefinition("parent1", parent);
 			factory.registerBeanDefinition("tb1", bd);
@@ -382,7 +383,8 @@ public final class PropertyResourceConfigurerTests {
 			pvs.add("name", "name${var}${var}${");
 			pvs.add("spouse", new RuntimeBeanReference("${ref}"));
 			pvs.add("someMap", singletonMap);
-			RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, pvs);
+			RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
+			bd.setPropertyValues(pvs);
 			factory.registerBeanDefinition("tb1", bd);
 		}
 
@@ -412,7 +414,9 @@ public final class PropertyResourceConfigurerTests {
 		someMap.put("key2", "${age}name");
 		MutablePropertyValues innerPvs = new MutablePropertyValues();
 		innerPvs.add("touchy", "${os.name}");
-		someMap.put("key3", new RootBeanDefinition(TestBean.class, innerPvs));
+		RootBeanDefinition innerBd = new RootBeanDefinition(TestBean.class);
+		innerBd.setPropertyValues(innerPvs);
+		someMap.put("key3", innerBd);
 		MutablePropertyValues innerPvs2 = new MutablePropertyValues(innerPvs);
 		someMap.put("${key4}", new BeanDefinitionHolder(new ChildBeanDefinition("tb1", innerPvs2), "child"));
 		pvs.add("someMap", someMap);
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionBuilderTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionBuilderTests.java
index 6eecc322e8..365ae6b958 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionBuilderTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionBuilderTests.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.
@@ -20,6 +20,8 @@ import java.util.Arrays;
 
 import junit.framework.TestCase;
 
+import org.springframework.beans.factory.config.BeanDefinition;
+
 import test.beans.TestBean;
 
 /**
@@ -31,7 +33,8 @@ public class BeanDefinitionBuilderTests extends TestCase {
 	public void testBeanClassWithSimpleProperty() {
 		String[] dependsOn = new String[] { "A", "B", "C" };
 		BeanDefinitionBuilder bdb = BeanDefinitionBuilder.rootBeanDefinition(TestBean.class);
-		bdb.setSingleton(false).addPropertyReference("age", "15");
+		bdb.setScope(BeanDefinition.SCOPE_PROTOTYPE);
+		bdb.addPropertyReference("age", "15");
 		for (int i = 0; i < dependsOn.length; i++) {
 			bdb.addDependsOn(dependsOn[i]);
 		}
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionTests.java
index cb365b39fd..c761254fda 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanDefinitionTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2006 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.
@@ -18,6 +18,7 @@ package org.springframework.beans.factory.support;
 
 import junit.framework.TestCase;
 
+import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.BeanDefinitionHolder;
 
 import test.beans.TestBean;
@@ -120,10 +121,11 @@ public class BeanDefinitionTests extends TestCase {
 		bd.getPropertyValues().add("name", "myName");
 		bd.getPropertyValues().add("age", "99");
 
-		ChildBeanDefinition childBd = new ChildBeanDefinition("bd");
+		GenericBeanDefinition childBd = new GenericBeanDefinition();
+		childBd.setParentName("bd");
 
 		RootBeanDefinition mergedBd = new RootBeanDefinition(bd);
-		mergedBd.overrideFrom(childBd);
+		mergedBd.overrideFrom((BeanDefinition) childBd);
 		assertEquals(2, mergedBd.getConstructorArgumentValues().getArgumentCount());
 		assertEquals(2, mergedBd.getPropertyValues().size());
 		assertEquals(bd, mergedBd);
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java
index 2849614541..b3516282d4 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java
@@ -16,6 +16,13 @@
 
 package org.springframework.beans.factory.support;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
@@ -28,24 +35,21 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import static org.junit.Assert.*;
-
 import org.junit.Test;
 import org.mockito.Mockito;
+import org.springframework.beans.PropertyEditorRegistrar;
+import org.springframework.beans.PropertyEditorRegistry;
+import org.springframework.beans.factory.BeanCreationException;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.beans.propertyeditors.CustomNumberEditor;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.UrlResource;
 
 import test.beans.GenericBean;
 import test.beans.GenericIntegerBean;
 import test.beans.GenericSetOfIntegerBean;
 import test.beans.TestBean;
 
-import org.springframework.beans.PropertyEditorRegistrar;
-import org.springframework.beans.PropertyEditorRegistry;
-import org.springframework.beans.factory.BeanCreationException;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.beans.propertyeditors.CustomNumberEditor;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.UrlResource;
-
 /**
  * @author Juergen Hoeller
  * @author Chris Beams
@@ -94,7 +98,8 @@ public class BeanFactoryGenericsTests {
 		bf.registerSingleton("resource1", new UrlResource("http://localhost:8080"));
 		bf.registerSingleton("resource2", new UrlResource("http://localhost:9090"));
 
-		RootBeanDefinition rbd = new RootBeanDefinition(GenericIntegerBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE);
+		RootBeanDefinition rbd = new RootBeanDefinition(GenericIntegerBean.class);
+		rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
 		bf.registerBeanDefinition("genericBean", rbd);
 		GenericIntegerBean gb = (GenericIntegerBean) bf.getBean("genericBean");
 
@@ -126,7 +131,8 @@ public class BeanFactoryGenericsTests {
 	public void testGenericListPropertyWithOptionalAutowiring() throws MalformedURLException {
 		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
 
-		RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE);
+		RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
+		rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
 		bf.registerBeanDefinition("genericBean", rbd);
 		GenericBean gb = (GenericBean) bf.getBean("genericBean");
 
@@ -152,7 +158,9 @@ public class BeanFactoryGenericsTests {
 
 	@Test
 	public void testGenericListOfArraysProperty() throws MalformedURLException {
-		XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("genericBeanTests.xml", getClass()));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
+				new ClassPathResource("genericBeanTests.xml", getClass()));
 		GenericBean gb = (GenericBean) bf.getBean("listOfArrays");
 
 		assertEquals(1, gb.getListOfArrays().size());
@@ -186,7 +194,8 @@ public class BeanFactoryGenericsTests {
 		bf.registerSingleton("integer1", new Integer(4));
 		bf.registerSingleton("integer2", new Integer(5));
 
-		RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
+		RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
+		rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
 		bf.registerBeanDefinition("genericBean", rbd);
 		GenericBean gb = (GenericBean) bf.getBean("genericBean");
 
@@ -198,7 +207,8 @@ public class BeanFactoryGenericsTests {
 	public void testGenericSetConstructorWithOptionalAutowiring() {
 		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
 
-		RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
+		RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
+		rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
 		bf.registerBeanDefinition("genericBean", rbd);
 		GenericBean gb = (GenericBean) bf.getBean("genericBean");
 
@@ -236,7 +246,8 @@ public class BeanFactoryGenericsTests {
 		bf.registerSingleton("resource1", new UrlResource("http://localhost:8080"));
 		bf.registerSingleton("resource2", new UrlResource("http://localhost:9090"));
 
-		RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
+		RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
+		rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
 		bf.registerBeanDefinition("genericBean", rbd);
 		GenericBean gb = (GenericBean) bf.getBean("genericBean");
 
@@ -252,7 +263,8 @@ public class BeanFactoryGenericsTests {
 		bf.registerSingleton("resource1", new UrlResource("http://localhost:8080"));
 		bf.registerSingleton("resource2", new UrlResource("http://localhost:9090"));
 
-		RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
+		RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
+		rbd.setAutowireMode(RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
 		bf.registerBeanDefinition("genericBean", rbd);
 		GenericBean gb = (GenericBean) bf.getBean("genericBean");
 
@@ -576,7 +588,9 @@ public class BeanFactoryGenericsTests {
 
 	@Test
 	public void testGenericListBean() throws Exception {
-		XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("genericBeanTests.xml", getClass()));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
+				new ClassPathResource("genericBeanTests.xml", getClass()));
 		List list = (List) bf.getBean("list");
 		assertEquals(1, list.size());
 		assertEquals(new URL("http://localhost:8080"), list.get(0));
@@ -584,7 +598,9 @@ public class BeanFactoryGenericsTests {
 
 	@Test
 	public void testGenericSetBean() throws Exception {
-		XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("genericBeanTests.xml", getClass()));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
+				new ClassPathResource("genericBeanTests.xml", getClass()));
 		Set set = (Set) bf.getBean("set");
 		assertEquals(1, set.size());
 		assertEquals(new URL("http://localhost:8080"), set.iterator().next());
@@ -592,7 +608,9 @@ public class BeanFactoryGenericsTests {
 
 	@Test
 	public void testGenericMapBean() throws Exception {
-		XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("genericBeanTests.xml", getClass()));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
+				new ClassPathResource("genericBeanTests.xml", getClass()));
 		Map map = (Map) bf.getBean("map");
 		assertEquals(1, map.size());
 		assertEquals(new Integer(10), map.keySet().iterator().next());
@@ -601,7 +619,9 @@ public class BeanFactoryGenericsTests {
 
 	@Test
 	public void testGenericallyTypedIntegerBean() throws Exception {
-		XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("genericBeanTests.xml", getClass()));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
+				new ClassPathResource("genericBeanTests.xml", getClass()));
 		GenericIntegerBean gb = (GenericIntegerBean) bf.getBean("integerBean");
 		assertEquals(new Integer(10), gb.getGenericProperty());
 		assertEquals(new Integer(20), gb.getGenericListProperty().get(0));
@@ -610,7 +630,9 @@ public class BeanFactoryGenericsTests {
 
 	@Test
 	public void testGenericallyTypedSetOfIntegerBean() throws Exception {
-		XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("genericBeanTests.xml", getClass()));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
+				new ClassPathResource("genericBeanTests.xml", getClass()));
 		GenericSetOfIntegerBean gb = (GenericSetOfIntegerBean) bf.getBean("setOfIntegerBean");
 		assertEquals(new Integer(10), gb.getGenericProperty().iterator().next());
 		assertEquals(new Integer(20), gb.getGenericListProperty().get(0).iterator().next());
@@ -619,7 +641,9 @@ public class BeanFactoryGenericsTests {
 
 	@Test
 	public void testSetBean() throws Exception {
-		XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("genericBeanTests.xml", getClass()));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
+				new ClassPathResource("genericBeanTests.xml", getClass()));
 		UrlSet us = (UrlSet) bf.getBean("setBean");
 		assertEquals(1, us.size());
 		assertEquals(new URL("http://www.springframework.org"), us.iterator().next());
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java
index d4c80b410d..65e380d3e2 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java
@@ -16,11 +16,11 @@
 
 package org.springframework.beans.factory.support.security;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertNull;
-import static junit.framework.Assert.assertTrue;
-import static junit.framework.Assert.fail;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.lang.reflect.Method;
 import java.net.URL;
@@ -56,7 +56,7 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.beans.factory.support.SecurityContextProvider;
 import org.springframework.beans.factory.support.security.support.ConstructorBean;
 import org.springframework.beans.factory.support.security.support.CustomCallbackBean;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.core.io.DefaultResourceLoader;
 import org.springframework.core.io.Resource;
 
@@ -72,7 +72,7 @@ import org.springframework.core.io.Resource;
  */
 public class CallbacksSecurityTests {
 
-	private XmlBeanFactory beanFactory;
+	private DefaultListableBeanFactory beanFactory;
 	private SecurityContextProvider provider;
 
 	private static class NonPrivilegedBean {
@@ -312,7 +312,8 @@ public class CallbacksSecurityTests {
 		DefaultResourceLoader drl = new DefaultResourceLoader();
 		Resource config = drl
 				.getResource("/org/springframework/beans/factory/support/security/callbacks.xml");
-		beanFactory = new XmlBeanFactory(config);
+		beanFactory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(beanFactory).loadBeanDefinitions(config);
 		beanFactory.setSecurityContextProvider(provider);
 	}
 
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java
index e2a0071022..490d0a7e1b 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractBeanFactoryTests.java
@@ -20,7 +20,6 @@ import java.beans.PropertyEditorSupport;
 import java.util.StringTokenizer;
 
 import junit.framework.TestCase;
-import junit.framework.Assert;
 
 import org.springframework.beans.BeansException;
 import org.springframework.beans.PropertyBatchUpdateException;
@@ -88,7 +87,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase {
 	 */
 	public void testLifecycleCallbacks() {
 		LifecycleBean lb = (LifecycleBean) getBeanFactory().getBean("lifecycle");
-		Assert.assertEquals("lifecycle", lb.getBeanName());
+		assertEquals("lifecycle", lb.getBeanName());
 		// The dummy business method will throw an exception if the
 		// necessary callbacks weren't invoked in the right order.
 		lb.businessMethod();
@@ -365,4 +364,4 @@ class MustBeInitialized implements InitializingBean {
 			throw new RuntimeException("Factory didn't call afterPropertiesSet() on MustBeInitialized object");
 	}
 
-}
\ No newline at end of file
+}
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractListableBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractListableBeanFactoryTests.java
index 403b4735bb..6a04c54074 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractListableBeanFactoryTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AbstractListableBeanFactoryTests.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.
@@ -20,8 +20,6 @@ import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.FactoryBean;
 import org.springframework.beans.factory.ListableBeanFactory;
 
-import junit.framework.Assert;
-
 import test.beans.TestBean;
 
 /**
@@ -48,24 +46,24 @@ public abstract class AbstractListableBeanFactoryTests extends AbstractBeanFacto
 
 	protected final void assertCount(int count) {
 		String[] defnames = getListableBeanFactory().getBeanDefinitionNames();
-		Assert.assertTrue("We should have " + count + " beans, not " + defnames.length, defnames.length == count);
+		assertTrue("We should have " + count + " beans, not " + defnames.length, defnames.length == count);
 	}
 
 	public void assertTestBeanCount(int count) {
 		String[] defNames = getListableBeanFactory().getBeanNamesForType(TestBean.class, true, false);
-		Assert.assertTrue("We should have " + count + " beans for class org.springframework.beans.TestBean, not " +
+		assertTrue("We should have " + count + " beans for class org.springframework.beans.TestBean, not " +
 				defNames.length, defNames.length == count);
 
 		int countIncludingFactoryBeans = count + 2;
 		String[] names = getListableBeanFactory().getBeanNamesForType(TestBean.class, true, true);
-		Assert.assertTrue("We should have " + countIncludingFactoryBeans +
+		assertTrue("We should have " + countIncludingFactoryBeans +
 				" beans for class org.springframework.beans.TestBean, not " + names.length,
 				names.length == countIncludingFactoryBeans);
 	}
 
 	public void testGetDefinitionsForNoSuchClass() {
 		String[] defnames = getListableBeanFactory().getBeanNamesForType(String.class);
-		Assert.assertTrue("No string definitions", defnames.length == 0);
+		assertTrue("No string definitions", defnames.length == 0);
 	}
 
 	/**
@@ -73,18 +71,18 @@ public abstract class AbstractListableBeanFactoryTests extends AbstractBeanFacto
 	 * what type factories may return, and it may even change over time.)
 	 */
 	public void testGetCountForFactoryClass() {
-		Assert.assertTrue("Should have 2 factories, not " +
+		assertTrue("Should have 2 factories, not " +
 				getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length,
 				getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length == 2);
 
-		Assert.assertTrue("Should have 2 factories, not " +
+		assertTrue("Should have 2 factories, not " +
 				getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length,
 				getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length == 2);
 	}
 
 	public void testContainsBeanDefinition() {
-		Assert.assertTrue(getListableBeanFactory().containsBeanDefinition("rod"));
-		Assert.assertTrue(getListableBeanFactory().containsBeanDefinition("roderick"));
+		assertTrue(getListableBeanFactory().containsBeanDefinition("rod"));
+		assertTrue(getListableBeanFactory().containsBeanDefinition("roderick"));
 	}
 
-}
\ No newline at end of file
+}
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java
index 7c97931666..9cc414ee65 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/AutowireWithExclusionTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2009 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.
@@ -16,9 +16,7 @@
 
 package org.springframework.beans.factory.xml;
 
-import junit.framework.Assert;
 import junit.framework.TestCase;
-import test.beans.TestBean;
 
 import org.springframework.beans.factory.config.PropertiesFactoryBean;
 import org.springframework.beans.factory.config.RuntimeBeanReference;
@@ -26,6 +24,8 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.beans.factory.support.RootBeanDefinition;
 import org.springframework.core.io.ClassPathResource;
 
+import test.beans.TestBean;
+
 /**
  * @author Rob Harrop
  * @author Juergen Hoeller
@@ -34,43 +34,45 @@ public class AutowireWithExclusionTests extends TestCase {
 
 	public void testByTypeAutowireWithAutoSelfExclusion() throws Exception {
 		CountingFactory.reset();
-		XmlBeanFactory beanFactory = getBeanFactory("autowire-with-exclusion.xml");
+		DefaultListableBeanFactory beanFactory = getBeanFactory("autowire-with-exclusion.xml");
 		beanFactory.preInstantiateSingletons();
 		TestBean rob = (TestBean) beanFactory.getBean("rob");
 		TestBean sally = (TestBean) beanFactory.getBean("sally");
 		assertEquals(sally, rob.getSpouse());
-		Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
+		assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
 	}
 
 	public void testByTypeAutowireWithExclusion() throws Exception {
 		CountingFactory.reset();
-		XmlBeanFactory beanFactory = getBeanFactory("autowire-with-exclusion.xml");
+		DefaultListableBeanFactory beanFactory = getBeanFactory("autowire-with-exclusion.xml");
 		beanFactory.preInstantiateSingletons();
 		TestBean rob = (TestBean) beanFactory.getBean("rob");
 		assertEquals("props1", rob.getSomeProperties().getProperty("name"));
-		Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
+		assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
 	}
 
 	public void testByTypeAutowireWithExclusionInParentFactory() throws Exception {
 		CountingFactory.reset();
-		XmlBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml");
+		DefaultListableBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml");
 		parent.preInstantiateSingletons();
 		DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
-		RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE);
+		RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class);
+		robDef.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
 		robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally"));
 		child.registerBeanDefinition("rob2", robDef);
 		TestBean rob = (TestBean) child.getBean("rob2");
 		assertEquals("props1", rob.getSomeProperties().getProperty("name"));
-		Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
+		assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
 	}
 
 	public void testByTypeAutowireWithPrimaryInParentFactory() throws Exception {
 		CountingFactory.reset();
-		XmlBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml");
+		DefaultListableBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml");
 		parent.getBeanDefinition("props1").setPrimary(true);
 		parent.preInstantiateSingletons();
 		DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
-		RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE);
+		RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class);
+		robDef.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
 		robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally"));
 		child.registerBeanDefinition("rob2", robDef);
 		RootBeanDefinition propsDef = new RootBeanDefinition(PropertiesFactoryBean.class);
@@ -78,15 +80,16 @@ public class AutowireWithExclusionTests extends TestCase {
 		child.registerBeanDefinition("props3", propsDef);
 		TestBean rob = (TestBean) child.getBean("rob2");
 		assertEquals("props1", rob.getSomeProperties().getProperty("name"));
-		Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
+		assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
 	}
 
 	public void testByTypeAutowireWithPrimaryOverridingParentFactory() throws Exception {
 		CountingFactory.reset();
-		XmlBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml");
+		DefaultListableBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml");
 		parent.preInstantiateSingletons();
 		DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
-		RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE);
+		RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class);
+		robDef.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
 		robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally"));
 		child.registerBeanDefinition("rob2", robDef);
 		RootBeanDefinition propsDef = new RootBeanDefinition(PropertiesFactoryBean.class);
@@ -95,16 +98,17 @@ public class AutowireWithExclusionTests extends TestCase {
 		child.registerBeanDefinition("props3", propsDef);
 		TestBean rob = (TestBean) child.getBean("rob2");
 		assertEquals("props3", rob.getSomeProperties().getProperty("name"));
-		Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
+		assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
 	}
 
 	public void testByTypeAutowireWithPrimaryInParentAndChild() throws Exception {
 		CountingFactory.reset();
-		XmlBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml");
+		DefaultListableBeanFactory parent = getBeanFactory("autowire-with-exclusion.xml");
 		parent.getBeanDefinition("props1").setPrimary(true);
 		parent.preInstantiateSingletons();
 		DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
-		RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE);
+		RootBeanDefinition robDef = new RootBeanDefinition(TestBean.class);
+		robDef.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
 		robDef.getPropertyValues().add("spouse", new RuntimeBeanReference("sally"));
 		child.registerBeanDefinition("rob2", robDef);
 		RootBeanDefinition propsDef = new RootBeanDefinition(PropertiesFactoryBean.class);
@@ -113,29 +117,29 @@ public class AutowireWithExclusionTests extends TestCase {
 		child.registerBeanDefinition("props3", propsDef);
 		TestBean rob = (TestBean) child.getBean("rob2");
 		assertEquals("props3", rob.getSomeProperties().getProperty("name"));
-		Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
+		assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
 	}
 
 	public void testByTypeAutowireWithInclusion() throws Exception {
 		CountingFactory.reset();
-		XmlBeanFactory beanFactory = getBeanFactory("autowire-with-inclusion.xml");
+		DefaultListableBeanFactory beanFactory = getBeanFactory("autowire-with-inclusion.xml");
 		beanFactory.preInstantiateSingletons();
 		TestBean rob = (TestBean) beanFactory.getBean("rob");
 		assertEquals("props1", rob.getSomeProperties().getProperty("name"));
-		Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
+		assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
 	}
 
 	public void testByTypeAutowireWithSelectiveInclusion() throws Exception {
 		CountingFactory.reset();
-		XmlBeanFactory beanFactory = getBeanFactory("autowire-with-selective-inclusion.xml");
+		DefaultListableBeanFactory beanFactory = getBeanFactory("autowire-with-selective-inclusion.xml");
 		beanFactory.preInstantiateSingletons();
 		TestBean rob = (TestBean) beanFactory.getBean("rob");
 		assertEquals("props1", rob.getSomeProperties().getProperty("name"));
-		Assert.assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
+		assertEquals(1, CountingFactory.getFactoryBeanInstanceCount());
 	}
 
 	public void testConstructorAutowireWithAutoSelfExclusion() throws Exception {
-		XmlBeanFactory beanFactory = getBeanFactory("autowire-constructor-with-exclusion.xml");
+		DefaultListableBeanFactory beanFactory = getBeanFactory("autowire-constructor-with-exclusion.xml");
 		TestBean rob = (TestBean) beanFactory.getBean("rob");
 		TestBean sally = (TestBean) beanFactory.getBean("sally");
 		assertEquals(sally, rob.getSpouse());
@@ -147,13 +151,16 @@ public class AutowireWithExclusionTests extends TestCase {
 	}
 
 	public void testConstructorAutowireWithExclusion() throws Exception {
-		XmlBeanFactory beanFactory = getBeanFactory("autowire-constructor-with-exclusion.xml");
+		DefaultListableBeanFactory beanFactory = getBeanFactory("autowire-constructor-with-exclusion.xml");
 		TestBean rob = (TestBean) beanFactory.getBean("rob");
 		assertEquals("props1", rob.getSomeProperties().getProperty("name"));
 	}
 
-	private XmlBeanFactory getBeanFactory(String configPath) {
-		return new XmlBeanFactory(new ClassPathResource(configPath, getClass()));
+	private DefaultListableBeanFactory getBeanFactory(String configPath) {
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
+				new ClassPathResource(configPath, getClass()));
+		return bf;
 	}
 
 }
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectingReaderEventListener.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectingReaderEventListener.java
index 021f9bb81d..1924dac82e 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectingReaderEventListener.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectingReaderEventListener.java
@@ -19,6 +19,7 @@ package org.springframework.beans.factory.xml;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.LinkedHashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -38,9 +39,9 @@ public class CollectingReaderEventListener implements ReaderEventListener {
 
 	private final List defaults = new LinkedList();
 
-	private final Map componentDefinitions = CollectionFactory.createLinkedMapIfPossible(8);
+	private final Map componentDefinitions = new LinkedHashMap<>(8);
 
-	private final Map aliasMap = CollectionFactory.createLinkedMapIfPossible(8);
+	private final Map aliasMap = new LinkedHashMap<>(8);
 
 	private final List imports = new LinkedList();
 
@@ -92,4 +93,4 @@ public class CollectingReaderEventListener implements ReaderEventListener {
 		return Collections.unmodifiableList(this.imports);
 	}
 
-}
\ No newline at end of file
+}
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java
index 0f3be3b006..f57b78d259 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/CollectionsWithDefaultTypesTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2009 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.
@@ -16,25 +16,30 @@
 
 package org.springframework.beans.factory.xml;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import java.util.List;
 import java.util.Map;
 
-import static org.junit.Assert.*;
 import org.junit.Test;
-import test.beans.TestBean;
-
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.core.io.ClassPathResource;
 
+import test.beans.TestBean;
+
 /**
  * @author Rob Harrop
  * @author Juergen Hoeller
  */
 public class CollectionsWithDefaultTypesTests {
 
-	private final XmlBeanFactory beanFactory;
+	private final DefaultListableBeanFactory beanFactory;
 
 	public CollectionsWithDefaultTypesTests() {
-		this.beanFactory = new XmlBeanFactory(new ClassPathResource("collectionsWithDefaultTypes.xml", getClass()));
+		this.beanFactory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions(
+				new ClassPathResource("collectionsWithDefaultTypes.xml", getClass()));
 	}
 
 	@Test
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DefaultLifecycleMethodsTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DefaultLifecycleMethodsTests.java
index 558e58681a..d79ff06cbb 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/DefaultLifecycleMethodsTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/DefaultLifecycleMethodsTests.java
@@ -18,6 +18,7 @@ package org.springframework.beans.factory.xml;
 
 import junit.framework.TestCase;
 
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.core.io.ClassPathResource;
 
 /**
@@ -25,11 +26,13 @@ import org.springframework.core.io.ClassPathResource;
  */
 public class DefaultLifecycleMethodsTests extends TestCase {
 
-	private XmlBeanFactory beanFactory;
+	private DefaultListableBeanFactory beanFactory;
 
 	@Override
 	protected void setUp() throws Exception {
-		this.beanFactory = new XmlBeanFactory(new ClassPathResource("defaultLifecycleMethods.xml", getClass()));
+		this.beanFactory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions(new ClassPathResource(
+				"defaultLifecycleMethods.xml", getClass()));
 	}
 
 	public void testLifecycleMethodsInvoked() {
@@ -49,7 +52,9 @@ public class DefaultLifecycleMethodsTests extends TestCase {
 
 	public void testIgnoreDefaultLifecycleMethods() throws Exception {
 		try {
-			XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("ignoreDefaultLifecycleMethods.xml", getClass()));
+			DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+			new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
+					new ClassPathResource("ignoreDefaultLifecycleMethods.xml", getClass()));
 			bf.preInstantiateSingletons();
 			bf.destroySingletons();
 		}
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/MetadataAttachmentTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/MetadataAttachmentTests.java
index 8cb697a755..9a98ab4c15 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/MetadataAttachmentTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/MetadataAttachmentTests.java
@@ -20,6 +20,7 @@ import junit.framework.TestCase;
 
 import org.springframework.beans.PropertyValue;
 import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.core.io.ClassPathResource;
 
 /**
@@ -27,11 +28,13 @@ import org.springframework.core.io.ClassPathResource;
  */
 public class MetadataAttachmentTests extends TestCase {
 
-	private XmlBeanFactory beanFactory;
+	private DefaultListableBeanFactory beanFactory;
 
 	@Override
 	protected void setUp() throws Exception {
-		this.beanFactory = new XmlBeanFactory(new ClassPathResource("withMeta.xml", getClass()));
+		this.beanFactory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions(
+				new ClassPathResource("withMeta.xml", getClass()));
 	}
 
 	public void testMetadataAttachment() throws Exception {
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/ProfileXmlBeanDefinitionTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/ProfileXmlBeanDefinitionTests.java
index 33788f98db..62c5962f86 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/ProfileXmlBeanDefinitionTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/ProfileXmlBeanDefinitionTests.java
@@ -21,8 +21,8 @@ import static org.junit.Assert.assertThat;
 
 import org.hamcrest.Description;
 import org.hamcrest.Matcher;
+import org.hamcrest.TypeSafeMatcher;
 import org.junit.Test;
-import org.junit.internal.matchers.TypeSafeMatcher;
 import org.springframework.beans.factory.support.BeanDefinitionRegistry;
 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.core.env.ConfigurableEnvironment;
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandlerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandlerTests.java
index c031ae52e9..f941602888 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandlerTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandlerTests.java
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals;
 
 import org.junit.Test;
 import org.springframework.beans.factory.BeanDefinitionStoreException;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.core.io.ClassPathResource;
 
 import test.beans.DummyBean;
@@ -32,7 +33,7 @@ public class SimpleConstructorNamespaceHandlerTests {
 
 	@Test
 	public void simpleValue() throws Exception {
-		XmlBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
+		DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
 		String name = "simple";
 		//		beanFactory.getBean("simple1", DummyBean.class);
 		DummyBean nameValue = beanFactory.getBean(name, DummyBean.class);
@@ -41,7 +42,7 @@ public class SimpleConstructorNamespaceHandlerTests {
 
 	@Test
 	public void simpleRef() throws Exception {
-		XmlBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
+		DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
 		String name = "simple-ref";
 		//		beanFactory.getBean("name-value1", TestBean.class);
 		DummyBean nameValue = beanFactory.getBean(name, DummyBean.class);
@@ -50,7 +51,7 @@ public class SimpleConstructorNamespaceHandlerTests {
 
 	@Test
 	public void nameValue() throws Exception {
-		XmlBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
+		DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
 		String name = "name-value";
 		//		beanFactory.getBean("name-value1", TestBean.class);
 		TestBean nameValue = beanFactory.getBean(name, TestBean.class);
@@ -60,7 +61,7 @@ public class SimpleConstructorNamespaceHandlerTests {
 
 	@Test
 	public void nameRef() throws Exception {
-		XmlBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
+		DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
 		TestBean nameValue = beanFactory.getBean("name-value", TestBean.class);
 		DummyBean nameRef = beanFactory.getBean("name-ref", DummyBean.class);
 
@@ -70,7 +71,7 @@ public class SimpleConstructorNamespaceHandlerTests {
 
 	@Test
 	public void typeIndexedValue() throws Exception {
-		XmlBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
+		DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
 		DummyBean typeRef = beanFactory.getBean("indexed-value", DummyBean.class);
 
 		assertEquals("at", typeRef.getName());
@@ -80,7 +81,7 @@ public class SimpleConstructorNamespaceHandlerTests {
 
 	@Test
 	public void typeIndexedRef() throws Exception {
-		XmlBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
+		DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
 		DummyBean typeRef = beanFactory.getBean("indexed-ref", DummyBean.class);
 
 		assertEquals("some-name", typeRef.getName());
@@ -89,20 +90,23 @@ public class SimpleConstructorNamespaceHandlerTests {
 
 	@Test(expected = BeanDefinitionStoreException.class)
 	public void ambiguousConstructor() throws Exception {
-		new XmlBeanFactory(new ClassPathResource("simpleConstructorNamespaceHandlerTestsWithErrors.xml", getClass()));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
+				new ClassPathResource("simpleConstructorNamespaceHandlerTestsWithErrors.xml", getClass()));
 	}
 
 	@Test
 	public void constructorWithNameEndingInRef() throws Exception {
-		XmlBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
+		DefaultListableBeanFactory beanFactory = createFactory("simpleConstructorNamespaceHandlerTests.xml");
 		DummyBean derivedBean = beanFactory.getBean("beanWithRefConstructorArg", DummyBean.class);
 		assertEquals(10, derivedBean.getAge());
 		assertEquals("silly name", derivedBean.getName());
 	}
 
-	private XmlBeanFactory createFactory(String resourceName) {
-		XmlBeanFactory fact = new XmlBeanFactory(new ClassPathResource(resourceName, getClass()));
-		//fact.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer());
-		return fact;
+	private DefaultListableBeanFactory createFactory(String resourceName) {
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(
+				new ClassPathResource(resourceName, getClass()));
+		return bf;
 	}
-}
\ No newline at end of file
+}
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerTests.java
index a7e543780d..badce0656b 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/SimplePropertyNamespaceHandlerTests.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.
@@ -17,13 +17,15 @@
 package org.springframework.beans.factory.xml;
 
 import static org.junit.Assert.assertEquals;
+
 import org.junit.Test;
+import org.springframework.beans.factory.BeanDefinitionStoreException;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.core.io.ClassPathResource;
+
 import test.beans.ITestBean;
 import test.beans.TestBean;
 
-import org.springframework.beans.factory.BeanDefinitionStoreException;
-import org.springframework.core.io.ClassPathResource;
-
 /**
  * @author Rob Harrop
  * @author Juergen Hoeller
@@ -33,8 +35,9 @@ public class SimplePropertyNamespaceHandlerTests {
 
 	@Test
 	public void simpleBeanConfigured() throws Exception {
-		XmlBeanFactory beanFactory =
-				new XmlBeanFactory(new ClassPathResource("simplePropertyNamespaceHandlerTests.xml", getClass()));
+		DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(beanFactory).loadBeanDefinitions(
+				new ClassPathResource("simplePropertyNamespaceHandlerTests.xml", getClass()));
 		ITestBean rob = (TestBean) beanFactory.getBean("rob");
 		ITestBean sally = (TestBean) beanFactory.getBean("sally");
 		assertEquals("Rob Harrop", rob.getName());
@@ -44,8 +47,9 @@ public class SimplePropertyNamespaceHandlerTests {
 
 	@Test
 	public void innerBeanConfigured() throws Exception {
-		XmlBeanFactory beanFactory =
-				new XmlBeanFactory(new ClassPathResource("simplePropertyNamespaceHandlerTests.xml", getClass()));
+		DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(beanFactory).loadBeanDefinitions(
+				new ClassPathResource("simplePropertyNamespaceHandlerTests.xml", getClass()));
 		TestBean sally = (TestBean) beanFactory.getBean("sally2");
 		ITestBean rob = sally.getSpouse();
 		assertEquals("Rob Harrop", rob.getName());
@@ -55,13 +59,16 @@ public class SimplePropertyNamespaceHandlerTests {
 
 	@Test(expected = BeanDefinitionStoreException.class)
 	public void withPropertyDefinedTwice() throws Exception {
-		new XmlBeanFactory(new ClassPathResource("simplePropertyNamespaceHandlerTestsWithErrors.xml", getClass()));
+		DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(beanFactory).loadBeanDefinitions(
+				new ClassPathResource("simplePropertyNamespaceHandlerTestsWithErrors.xml", getClass()));
 	}
 
 	@Test
 	public void propertyWithNameEndingInRef() throws Exception {
-		XmlBeanFactory beanFactory =
-				new XmlBeanFactory(new ClassPathResource("simplePropertyNamespaceHandlerTests.xml", getClass()));
+		DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(beanFactory).loadBeanDefinitions(
+				new ClassPathResource("simplePropertyNamespaceHandlerTests.xml", getClass()));
 		ITestBean sally = (TestBean) beanFactory.getBean("derivedSally");
 		assertEquals("r", sally.getSpouse().getName());
 	}
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanCollectionTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanCollectionTests.java
index eacf97579e..18f616eb14 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanCollectionTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlBeanCollectionTests.java
@@ -16,7 +16,14 @@
 
 package org.springframework.beans.factory.xml;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.IdentityHashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
@@ -27,21 +34,19 @@ import java.util.Properties;
 import java.util.Set;
 import java.util.TreeMap;
 import java.util.TreeSet;
-import java.util.IdentityHashMap;
-import java.util.HashSet;
 import java.util.concurrent.CopyOnWriteArraySet;
 
 import org.junit.Test;
-import static org.junit.Assert.*;
-import test.beans.TestBean;
-
 import org.springframework.beans.factory.BeanCreationException;
 import org.springframework.beans.factory.BeanDefinitionStoreException;
 import org.springframework.beans.factory.config.ListFactoryBean;
 import org.springframework.beans.factory.config.MapFactoryBean;
 import org.springframework.beans.factory.config.SetFactoryBean;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.core.io.ClassPathResource;
 
+import test.beans.TestBean;
+
 /**
  * Tests for collections in XML bean definitions.
  *
@@ -51,10 +56,12 @@ import org.springframework.core.io.ClassPathResource;
  */
 public class XmlBeanCollectionTests {
 
-	private final XmlBeanFactory beanFactory;
+	private final DefaultListableBeanFactory beanFactory;
 
 	public XmlBeanCollectionTests() {
-		this.beanFactory = new XmlBeanFactory(new ClassPathResource("collections.xml", getClass()));
+		this.beanFactory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions(
+				new ClassPathResource("collections.xml", getClass()));
 	}
 
 	@Test
diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlListableBeanFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlListableBeanFactoryTests.java
index 1025fffe40..5b6e88a155 100644
--- a/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlListableBeanFactoryTests.java
+++ b/spring-beans/src/test/java/org/springframework/beans/factory/xml/XmlListableBeanFactoryTests.java
@@ -21,8 +21,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import junit.framework.Assert;
-
 import org.springframework.beans.BeansException;
 import org.springframework.beans.MutablePropertyValues;
 import org.springframework.beans.factory.BeanFactory;
@@ -44,21 +42,25 @@ public class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTest
 
 	private DefaultListableBeanFactory parent;
 
-	private XmlBeanFactory factory;
+	private DefaultListableBeanFactory factory;
 
 	@Override
 	protected void setUp() {
 		parent = new DefaultListableBeanFactory();
 		Map m = new HashMap();
 		m.put("name", "Albert");
-		parent.registerBeanDefinition("father",
-			new RootBeanDefinition(TestBean.class, new MutablePropertyValues(m)));
+		RootBeanDefinition bd1 = new RootBeanDefinition(TestBean.class);
+		bd1.setPropertyValues(new MutablePropertyValues(m));
+		parent.registerBeanDefinition("father", bd1);
 		m = new HashMap();
 		m.put("name", "Roderick");
-		parent.registerBeanDefinition("rod",
-			new RootBeanDefinition(TestBean.class, new MutablePropertyValues(m)));
+		RootBeanDefinition bd2 = new RootBeanDefinition(TestBean.class);
+		bd2.setPropertyValues(new MutablePropertyValues(m));
+		parent.registerBeanDefinition("rod", bd2);
 
-		this.factory = new XmlBeanFactory(new ClassPathResource("test.xml", getClass()), parent);
+		this.factory = new DefaultListableBeanFactory(parent);
+		new XmlBeanDefinitionReader(this.factory).loadBeanDefinitions(
+				new ClassPathResource("test.xml", getClass()));
 		this.factory.addBeanPostProcessor(new BeanPostProcessor() {
 			@Override
 			public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
@@ -106,7 +108,7 @@ public class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTest
 
 	public void testDescriptionButNoProperties() throws Exception {
 		TestBean validEmpty = (TestBean) getBeanFactory().getBean("validEmptyWithDescription");
-		Assert.assertEquals(0, validEmpty.getAge());
+		assertEquals(0, validEmpty.getAge());
 	}
 
 	/**
@@ -117,94 +119,94 @@ public class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTest
 
 		TestBean tb1 = (TestBean) getBeanFactory().getBean("aliased");
 		TestBean alias1 = (TestBean) getBeanFactory().getBean("myalias");
-		Assert.assertTrue(tb1 == alias1);
+		assertTrue(tb1 == alias1);
 		List tb1Aliases = Arrays.asList(getBeanFactory().getAliases("aliased"));
-		Assert.assertEquals(2, tb1Aliases.size());
-		Assert.assertTrue(tb1Aliases.contains("myalias"));
-		Assert.assertTrue(tb1Aliases.contains("youralias"));
-		Assert.assertTrue(beanNames.contains("aliased"));
-		Assert.assertFalse(beanNames.contains("myalias"));
-		Assert.assertFalse(beanNames.contains("youralias"));
+		assertEquals(2, tb1Aliases.size());
+		assertTrue(tb1Aliases.contains("myalias"));
+		assertTrue(tb1Aliases.contains("youralias"));
+		assertTrue(beanNames.contains("aliased"));
+		assertFalse(beanNames.contains("myalias"));
+		assertFalse(beanNames.contains("youralias"));
 
 		TestBean tb2 = (TestBean) getBeanFactory().getBean("multiAliased");
 		TestBean alias2 = (TestBean) getBeanFactory().getBean("alias1");
 		TestBean alias3 = (TestBean) getBeanFactory().getBean("alias2");
 		TestBean alias3a = (TestBean) getBeanFactory().getBean("alias3");
 		TestBean alias3b = (TestBean) getBeanFactory().getBean("alias4");
-		Assert.assertTrue(tb2 == alias2);
-		Assert.assertTrue(tb2 == alias3);
-		Assert.assertTrue(tb2 == alias3a);
-		Assert.assertTrue(tb2 == alias3b);
+		assertTrue(tb2 == alias2);
+		assertTrue(tb2 == alias3);
+		assertTrue(tb2 == alias3a);
+		assertTrue(tb2 == alias3b);
 
 		List tb2Aliases = Arrays.asList(getBeanFactory().getAliases("multiAliased"));
-		Assert.assertEquals(4, tb2Aliases.size());
-		Assert.assertTrue(tb2Aliases.contains("alias1"));
-		Assert.assertTrue(tb2Aliases.contains("alias2"));
-		Assert.assertTrue(tb2Aliases.contains("alias3"));
-		Assert.assertTrue(tb2Aliases.contains("alias4"));
-		Assert.assertTrue(beanNames.contains("multiAliased"));
-		Assert.assertFalse(beanNames.contains("alias1"));
-		Assert.assertFalse(beanNames.contains("alias2"));
-		Assert.assertFalse(beanNames.contains("alias3"));
-		Assert.assertFalse(beanNames.contains("alias4"));
+		assertEquals(4, tb2Aliases.size());
+		assertTrue(tb2Aliases.contains("alias1"));
+		assertTrue(tb2Aliases.contains("alias2"));
+		assertTrue(tb2Aliases.contains("alias3"));
+		assertTrue(tb2Aliases.contains("alias4"));
+		assertTrue(beanNames.contains("multiAliased"));
+		assertFalse(beanNames.contains("alias1"));
+		assertFalse(beanNames.contains("alias2"));
+		assertFalse(beanNames.contains("alias3"));
+		assertFalse(beanNames.contains("alias4"));
 
 		TestBean tb3 = (TestBean) getBeanFactory().getBean("aliasWithoutId1");
 		TestBean alias4 = (TestBean) getBeanFactory().getBean("aliasWithoutId2");
 		TestBean alias5 = (TestBean) getBeanFactory().getBean("aliasWithoutId3");
-		Assert.assertTrue(tb3 == alias4);
-		Assert.assertTrue(tb3 == alias5);
+		assertTrue(tb3 == alias4);
+		assertTrue(tb3 == alias5);
 		List tb3Aliases = Arrays.asList(getBeanFactory().getAliases("aliasWithoutId1"));
-		Assert.assertEquals(2, tb3Aliases.size());
-		Assert.assertTrue(tb3Aliases.contains("aliasWithoutId2"));
-		Assert.assertTrue(tb3Aliases.contains("aliasWithoutId3"));
-		Assert.assertTrue(beanNames.contains("aliasWithoutId1"));
-		Assert.assertFalse(beanNames.contains("aliasWithoutId2"));
-		Assert.assertFalse(beanNames.contains("aliasWithoutId3"));
+		assertEquals(2, tb3Aliases.size());
+		assertTrue(tb3Aliases.contains("aliasWithoutId2"));
+		assertTrue(tb3Aliases.contains("aliasWithoutId3"));
+		assertTrue(beanNames.contains("aliasWithoutId1"));
+		assertFalse(beanNames.contains("aliasWithoutId2"));
+		assertFalse(beanNames.contains("aliasWithoutId3"));
 
 		TestBean tb4 = (TestBean) getBeanFactory().getBean(TestBean.class.getName() + "#0");
-		Assert.assertEquals(null, tb4.getName());
+		assertEquals(null, tb4.getName());
 
 		Map drs = getListableBeanFactory().getBeansOfType(DummyReferencer.class, false, false);
-		Assert.assertEquals(5, drs.size());
-		Assert.assertTrue(drs.containsKey(DummyReferencer.class.getName() + "#0"));
-		Assert.assertTrue(drs.containsKey(DummyReferencer.class.getName() + "#1"));
-		Assert.assertTrue(drs.containsKey(DummyReferencer.class.getName() + "#2"));
+		assertEquals(5, drs.size());
+		assertTrue(drs.containsKey(DummyReferencer.class.getName() + "#0"));
+		assertTrue(drs.containsKey(DummyReferencer.class.getName() + "#1"));
+		assertTrue(drs.containsKey(DummyReferencer.class.getName() + "#2"));
 	}
 
 	public void testFactoryNesting() {
 		ITestBean father = (ITestBean) getBeanFactory().getBean("father");
-		Assert.assertTrue("Bean from root context", father != null);
+		assertTrue("Bean from root context", father != null);
 
 		TestBean rod = (TestBean) getBeanFactory().getBean("rod");
-		Assert.assertTrue("Bean from child context", "Rod".equals(rod.getName()));
-		Assert.assertTrue("Bean has external reference", rod.getSpouse() == father);
+		assertTrue("Bean from child context", "Rod".equals(rod.getName()));
+		assertTrue("Bean has external reference", rod.getSpouse() == father);
 
 		rod = (TestBean) parent.getBean("rod");
-		Assert.assertTrue("Bean from root context", "Roderick".equals(rod.getName()));
+		assertTrue("Bean from root context", "Roderick".equals(rod.getName()));
 	}
 
 	public void testFactoryReferences() {
 		DummyFactory factory = (DummyFactory) getBeanFactory().getBean("&singletonFactory");
 
 		DummyReferencer ref = (DummyReferencer) getBeanFactory().getBean("factoryReferencer");
-		Assert.assertTrue(ref.getTestBean1() == ref.getTestBean2());
-		Assert.assertTrue(ref.getDummyFactory() == factory);
+		assertTrue(ref.getTestBean1() == ref.getTestBean2());
+		assertTrue(ref.getDummyFactory() == factory);
 
 		DummyReferencer ref2 = (DummyReferencer) getBeanFactory().getBean("factoryReferencerWithConstructor");
-		Assert.assertTrue(ref2.getTestBean1() == ref2.getTestBean2());
-		Assert.assertTrue(ref2.getDummyFactory() == factory);
+		assertTrue(ref2.getTestBean1() == ref2.getTestBean2());
+		assertTrue(ref2.getDummyFactory() == factory);
 	}
 
 	public void testPrototypeReferences() {
 		// check that not broken by circular reference resolution mechanism
 		DummyReferencer ref1 = (DummyReferencer) getBeanFactory().getBean("prototypeReferencer");
-		Assert.assertTrue("Not referencing same bean twice", ref1.getTestBean1() != ref1.getTestBean2());
+		assertTrue("Not referencing same bean twice", ref1.getTestBean1() != ref1.getTestBean2());
 		DummyReferencer ref2 = (DummyReferencer) getBeanFactory().getBean("prototypeReferencer");
-		Assert.assertTrue("Not the same referencer", ref1 != ref2);
-		Assert.assertTrue("Not referencing same bean twice", ref2.getTestBean1() != ref2.getTestBean2());
-		Assert.assertTrue("Not referencing same bean twice", ref1.getTestBean1() != ref2.getTestBean1());
-		Assert.assertTrue("Not referencing same bean twice", ref1.getTestBean2() != ref2.getTestBean2());
-		Assert.assertTrue("Not referencing same bean twice", ref1.getTestBean1() != ref2.getTestBean2());
+		assertTrue("Not the same referencer", ref1 != ref2);
+		assertTrue("Not referencing same bean twice", ref2.getTestBean1() != ref2.getTestBean2());
+		assertTrue("Not referencing same bean twice", ref1.getTestBean1() != ref2.getTestBean1());
+		assertTrue("Not referencing same bean twice", ref1.getTestBean2() != ref2.getTestBean2());
+		assertTrue("Not referencing same bean twice", ref1.getTestBean1() != ref2.getTestBean2());
 	}
 
 	public void testBeanPostProcessor() throws Exception {
@@ -212,22 +214,22 @@ public class XmlListableBeanFactoryTests extends AbstractListableBeanFactoryTest
 		TestBean kathy = (TestBean) getBeanFactory().getBean("kathy");
 		DummyFactory factory = (DummyFactory) getBeanFactory().getBean("&singletonFactory");
 		TestBean factoryCreated = (TestBean) getBeanFactory().getBean("singletonFactory");
-		Assert.assertTrue(kerry.isPostProcessed());
-		Assert.assertTrue(kathy.isPostProcessed());
-		Assert.assertTrue(factory.isPostProcessed());
-		Assert.assertTrue(factoryCreated.isPostProcessed());
+		assertTrue(kerry.isPostProcessed());
+		assertTrue(kathy.isPostProcessed());
+		assertTrue(factory.isPostProcessed());
+		assertTrue(factoryCreated.isPostProcessed());
 	}
 
 	public void testEmptyValues() {
 		TestBean rod = (TestBean) getBeanFactory().getBean("rod");
 		TestBean kerry = (TestBean) getBeanFactory().getBean("kerry");
-		Assert.assertTrue("Touchy is empty", "".equals(rod.getTouchy()));
-		Assert.assertTrue("Touchy is empty", "".equals(kerry.getTouchy()));
+		assertTrue("Touchy is empty", "".equals(rod.getTouchy()));
+		assertTrue("Touchy is empty", "".equals(kerry.getTouchy()));
 	}
 
 	public void testCommentsAndCdataInValue() {
 		TestBean bean = (TestBean) getBeanFactory().getBean("commentsInValue");
-		Assert.assertEquals("Failed to handle comments and CDATA properly", "this is a ", bean.getName());
+		assertEquals("Failed to handle comments and CDATA properly", "this is a ", bean.getName());
 	}
 
 }
diff --git a/spring-context-support/src/test/java/org/springframework/mail/javamail/JavaMailSenderTests.java b/spring-context-support/src/test/java/org/springframework/mail/javamail/JavaMailSenderTests.java
index 51eab98cd6..97eb3e7863 100644
--- a/spring-context-support/src/test/java/org/springframework/mail/javamail/JavaMailSenderTests.java
+++ b/spring-context-support/src/test/java/org/springframework/mail/javamail/JavaMailSenderTests.java
@@ -20,8 +20,10 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
+import java.util.GregorianCalendar;
 import java.util.List;
 import java.util.Properties;
+
 import javax.activation.FileTypeMap;
 import javax.mail.Address;
 import javax.mail.Message;
@@ -59,7 +61,7 @@ public class JavaMailSenderTests extends TestCase {
 		simpleMessage.setTo("you@mail.org");
 		simpleMessage.setCc(new String[] {"he@mail.org", "she@mail.org"});
 		simpleMessage.setBcc(new String[] {"us@mail.org", "them@mail.org"});
-		Date sentDate = new Date(2004, 1, 1);
+		Date sentDate = new GregorianCalendar(2004, 1, 1).getTime();
 		simpleMessage.setSentDate(sentDate);
 		simpleMessage.setSubject("my subject");
 		simpleMessage.setText("my text");
@@ -334,7 +336,7 @@ public class JavaMailSenderTests extends TestCase {
 		MimeMessage mimeMessage = sender.createMimeMessage();
 		mimeMessage.setSubject("custom");
 		mimeMessage.setRecipient(Message.RecipientType.TO, new InternetAddress("you@mail.org"));
-		mimeMessage.setSentDate(new Date(2005, 3, 1));
+		mimeMessage.setSentDate(new GregorianCalendar(2005, 3, 1).getTime());
 		sender.send(mimeMessage);
 
 		assertEquals("host", sender.transport.getConnectedHost());
@@ -559,7 +561,7 @@ public class JavaMailSenderTests extends TestCase {
 				throw new MessagingException("No sentDate specified");
 			}
 			if (message.getSubject() != null && message.getSubject().contains("custom")) {
-				assertEquals(new Date(2005, 3, 1), message.getSentDate());
+				assertEquals(new GregorianCalendar(2005, 3, 1).getTime(), message.getSentDate());
 			}
 			this.sentMessages.add(message);
 		}
diff --git a/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java b/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java
index 32c67a0b80..dfe6d48aa7 100644
--- a/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java
+++ b/spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSupportTests.java
@@ -51,19 +51,18 @@ import org.quartz.Trigger;
 import org.quartz.TriggerListener;
 import org.quartz.impl.SchedulerRepository;
 import org.quartz.spi.JobFactory;
-
 import org.springframework.beans.TestBean;
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
 import org.springframework.beans.factory.support.RootBeanDefinition;
 import org.springframework.beans.factory.support.StaticListableBeanFactory;
-import org.springframework.build.junit.Assume;
-import org.springframework.build.junit.TestGroup;
+import org.springframework.tests.Assume;
+import org.springframework.tests.TestGroup;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 import org.springframework.context.support.StaticApplicationContext;
 import org.springframework.core.io.FileSystemResourceLoader;
 import org.springframework.core.task.TaskExecutor;
-import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
+import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.scheduling.TestMethodInvokingTask;
 
 /**
@@ -973,7 +972,7 @@ public class QuartzSupportTests {
 
 		ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(
 				"/org/springframework/scheduling/quartz/databasePersistence.xml");
-		SimpleJdbcTemplate jdbcTemplate = new SimpleJdbcTemplate(ctx.getBean(DataSource.class));
+		JdbcTemplate jdbcTemplate = new JdbcTemplate(ctx.getBean(DataSource.class));
 		assertTrue("No triggers were persisted", jdbcTemplate.queryForList("SELECT * FROM qrtz_triggers").size()>0);
 		Thread.sleep(3000);
 		try {
diff --git a/spring-context-support/src/test/java/org/springframework/ui/jasperreports/JasperReportsUtilsTests.java b/spring-context-support/src/test/java/org/springframework/ui/jasperreports/JasperReportsUtilsTests.java
index 4f8cc86fca..7b9ebb44aa 100644
--- a/spring-context-support/src/test/java/org/springframework/ui/jasperreports/JasperReportsUtilsTests.java
+++ b/spring-context-support/src/test/java/org/springframework/ui/jasperreports/JasperReportsUtilsTests.java
@@ -198,7 +198,7 @@ public class JasperReportsUtilsTests extends TestCase {
 		HSSFRow row = sheet.getRow(3);
 		HSSFCell cell = row.getCell((short) 1);
 		assertNotNull("Cell should not be null", cell);
-		assertEquals("Cell content should be Dear Lord!", "Dear Lord!", cell.getStringCellValue());
+		assertEquals("Cell content should be Dear Lord!", "Dear Lord!", cell.getRichStringCellValue().getString());
 	}
 
 	private JasperReport getReport() throws Exception {
diff --git a/spring-context/src/main/java/org/springframework/context/weaving/DefaultContextLoadTimeWeaver.java b/spring-context/src/main/java/org/springframework/context/weaving/DefaultContextLoadTimeWeaver.java
index b93c8b2df5..495f3c7025 100644
--- a/spring-context/src/main/java/org/springframework/context/weaving/DefaultContextLoadTimeWeaver.java
+++ b/spring-context/src/main/java/org/springframework/context/weaving/DefaultContextLoadTimeWeaver.java
@@ -56,6 +56,7 @@ import org.springframework.instrument.classloading.websphere.WebSphereLoadTimeWe
  * @since 2.5
  * @see org.springframework.context.ConfigurableApplicationContext#LOAD_TIME_WEAVER_BEAN_NAME
  */
+@SuppressWarnings("deprecation")
 public class DefaultContextLoadTimeWeaver implements LoadTimeWeaver, BeanClassLoaderAware, DisposableBean {
 
 	protected final Log logger = LogFactory.getLog(getClass());
diff --git a/spring-context/src/main/java/org/springframework/scripting/config/ScriptBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/scripting/config/ScriptBeanDefinitionParser.java
index eb741dd3fe..23cfe64423 100644
--- a/spring-context/src/main/java/org/springframework/scripting/config/ScriptBeanDefinitionParser.java
+++ b/spring-context/src/main/java/org/springframework/scripting/config/ScriptBeanDefinitionParser.java
@@ -99,6 +99,7 @@ class ScriptBeanDefinitionParser extends AbstractBeanDefinitionParser {
 	 * Registers a {@link ScriptFactoryPostProcessor} if needed.
 	 */
 	@Override
+	@SuppressWarnings("deprecation")
 	protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
 		// Resolve the script source.
 		String value = resolveScriptSource(element, parserContext.getReaderContext());
diff --git a/spring-context/src/main/java/org/springframework/scripting/jruby/JRubyScriptUtils.java b/spring-context/src/main/java/org/springframework/scripting/jruby/JRubyScriptUtils.java
index 2271d1b53d..97b9a3bc43 100644
--- a/spring-context/src/main/java/org/springframework/scripting/jruby/JRubyScriptUtils.java
+++ b/spring-context/src/main/java/org/springframework/scripting/jruby/JRubyScriptUtils.java
@@ -75,6 +75,7 @@ public abstract class JRubyScriptUtils {
 	 * @return the scripted Java object
 	 * @throws JumpException in case of JRuby parsing failure
 	 */
+	@SuppressWarnings("deprecation")
 	public static Object createJRubyObject(String scriptSource, Class[] interfaces, ClassLoader classLoader) {
 		Ruby ruby = initializeRuntime();
 
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 2dfa414c65..e26835163f 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
@@ -51,8 +51,8 @@ import org.springframework.beans.factory.config.MethodInvokingFactoryBean;
 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.beans.factory.support.RootBeanDefinition;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.build.junit.Assume;
-import org.springframework.build.junit.TestGroup;
+import org.springframework.tests.Assume;
+import org.springframework.tests.TestGroup;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 import org.springframework.context.support.GenericApplicationContext;
diff --git a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java
index d5f1e89c62..b6e0f6853e 100644
--- a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java
+++ b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java
@@ -16,8 +16,16 @@
 
 package org.springframework.aop.framework;
 
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.*;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.not;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -45,10 +53,10 @@ import org.springframework.beans.TestBean;
 import org.springframework.beans.factory.BeanCreationException;
 import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.FactoryBean;
-import org.springframework.beans.factory.ListableBeanFactory;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.context.ApplicationListener;
 import org.springframework.context.TestListener;
 import org.springframework.core.io.ClassPathResource;
@@ -56,14 +64,13 @@ import org.springframework.util.SerializationTestUtils;
 
 import test.advice.CountingBeforeAdvice;
 import test.advice.MyThrowsHandler;
+import test.beans.SideEffectBean;
 import test.interceptor.NopInterceptor;
 import test.interceptor.TimestampIntroductionInterceptor;
 import test.mixin.Lockable;
 import test.mixin.LockedException;
 import test.util.TimeStamped;
 
-import test.beans.SideEffectBean;
-
 /**
  * @since 13.03.2003
  * @author Rod Johnson
@@ -93,7 +100,9 @@ public final class ProxyFactoryBeanTests {
 	public void setUp() throws Exception {
 		DefaultListableBeanFactory parent = new DefaultListableBeanFactory();
 		parent.registerBeanDefinition("target2", new RootBeanDefinition(TestListener.class));
-		this.factory = new XmlBeanFactory(new ClassPathResource(CONTEXT, getClass()), parent);
+		this.factory = new DefaultListableBeanFactory(parent);
+		new XmlBeanDefinitionReader((BeanDefinitionRegistry) this.factory).loadBeanDefinitions(
+				new ClassPathResource(CONTEXT, getClass()));
 	}
 
 	@Test
@@ -133,7 +142,8 @@ public final class ProxyFactoryBeanTests {
 
 	private void testDoubleTargetSourceIsRejected(String name) {
 		try {
-			BeanFactory bf = new XmlBeanFactory(new ClassPathResource(DBL_TARGETSOURCE_CONTEXT, CLASS));
+			DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+			new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(DBL_TARGETSOURCE_CONTEXT, CLASS));
 			bf.getBean(name);
 			fail("Should not allow TargetSource to be specified in interceptorNames as well as targetSource property");
 		}
@@ -147,7 +157,8 @@ public final class ProxyFactoryBeanTests {
 	@Test
 	public void testTargetSourceNotAtEndOfInterceptorNamesIsRejected() {
 		try {
-			BeanFactory bf = new XmlBeanFactory(new ClassPathResource(NOTLAST_TARGETSOURCE_CONTEXT, CLASS));
+			DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+			new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(NOTLAST_TARGETSOURCE_CONTEXT, CLASS));
 			bf.getBean("targetSourceNotLast");
 			fail("TargetSource or non-advised object must be last in interceptorNames");
 		}
@@ -160,7 +171,8 @@ public final class ProxyFactoryBeanTests {
 
 	@Test
 	public void testGetObjectTypeWithDirectTarget() {
-		BeanFactory bf = new XmlBeanFactory(new ClassPathResource(TARGETSOURCE_CONTEXT, CLASS));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(TARGETSOURCE_CONTEXT, CLASS));
 
 		// We have a counting before advice here
 		CountingBeforeAdvice cba = (CountingBeforeAdvice) bf.getBean("countingBeforeAdvice");
@@ -176,7 +188,8 @@ public final class ProxyFactoryBeanTests {
 
 	@Test
 	public void testGetObjectTypeWithTargetViaTargetSource() {
-		BeanFactory bf = new XmlBeanFactory(new ClassPathResource(TARGETSOURCE_CONTEXT, CLASS));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(TARGETSOURCE_CONTEXT, CLASS));
 		ITestBean tb = (ITestBean) bf.getBean("viaTargetSource");
 		assertTrue(tb.getName().equals("Adam"));
 		ProxyFactoryBean pfb = (ProxyFactoryBean) bf.getBean("&viaTargetSource");
@@ -185,7 +198,8 @@ public final class ProxyFactoryBeanTests {
 
 	@Test
 	public void testGetObjectTypeWithNoTargetOrTargetSource() {
-		BeanFactory bf = new XmlBeanFactory(new ClassPathResource(TARGETSOURCE_CONTEXT, CLASS));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(TARGETSOURCE_CONTEXT, CLASS));
 
 		ITestBean tb = (ITestBean) bf.getBean("noTarget");
 		try {
@@ -246,7 +260,8 @@ public final class ProxyFactoryBeanTests {
 		// Initial count value set in bean factory XML
 		int INITIAL_COUNT = 10;
 
-		BeanFactory bf = new XmlBeanFactory(new ClassPathResource(PROTOTYPE_CONTEXT, CLASS));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(PROTOTYPE_CONTEXT, CLASS));
 
 		// Check it works without AOP
 		SideEffectBean raw = (SideEffectBean) bf.getBean("prototypeTarget");
@@ -338,7 +353,8 @@ public final class ProxyFactoryBeanTests {
 	 */
 	@Test
 	public void testTargetAsInnerBean() {
-		ListableBeanFactory bf = new XmlBeanFactory(new ClassPathResource(INNER_BEAN_TARGET_CONTEXT, CLASS));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(INNER_BEAN_TARGET_CONTEXT, CLASS));
 		ITestBean itb = (ITestBean) bf.getBean("testBean");
 		assertEquals("innerBeanTarget", itb.getName());
 		assertEquals("Only have proxy and interceptor: no target", 3, bf.getBeanDefinitionCount());
@@ -441,7 +457,8 @@ public final class ProxyFactoryBeanTests {
 
 	@Test
 	public void testCanAddThrowsAdviceWithoutAdvisor() throws Throwable {
-		BeanFactory f = new XmlBeanFactory(new ClassPathResource(THROWS_ADVICE_CONTEXT, CLASS));
+		DefaultListableBeanFactory f = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(f).loadBeanDefinitions(new ClassPathResource(THROWS_ADVICE_CONTEXT, CLASS));
 		MyThrowsHandler th = (MyThrowsHandler) f.getBean("throwsAdvice");
 		CountingBeforeAdvice cba = (CountingBeforeAdvice) f.getBean("countingBeforeAdvice");
 		assertEquals(0, cba.getCalls());
@@ -498,9 +515,10 @@ public final class ProxyFactoryBeanTests {
 
 	@Test
 	public void testEmptyInterceptorNames() {
-		XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource(INVALID_CONTEXT, CLASS));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(INVALID_CONTEXT, CLASS));
 		try {
-			factory.getBean("emptyInterceptorNames");
+			bf.getBean("emptyInterceptorNames");
 			fail("Interceptor names cannot be empty");
 		}
 		catch (BeanCreationException ex) {
@@ -513,9 +531,10 @@ public final class ProxyFactoryBeanTests {
 	 */
 	@Test
 	public void testGlobalsWithoutTarget() {
-		XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource(INVALID_CONTEXT, CLASS));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(INVALID_CONTEXT, CLASS));
 		try {
-			factory.getBean("globalsWithoutTarget");
+			bf.getBean("globalsWithoutTarget");
 			fail("Should require target name");
 		}
 		catch (BeanCreationException ex) {
@@ -554,7 +573,8 @@ public final class ProxyFactoryBeanTests {
 
 	@Test
 	public void testSerializableSingletonProxy() throws Exception {
-		BeanFactory bf = new XmlBeanFactory(new ClassPathResource(SERIALIZATION_CONTEXT, CLASS));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(SERIALIZATION_CONTEXT, CLASS));
 		Person p = (Person) bf.getBean("serializableSingleton");
 		assertSame("Should be a Singleton", p, bf.getBean("serializableSingleton"));
 		Person p2 = (Person) SerializationTestUtils.serializeAndDeserialize(p);
@@ -576,7 +596,8 @@ public final class ProxyFactoryBeanTests {
 
 	@Test
 	public void testSerializablePrototypeProxy() throws Exception {
-		BeanFactory bf = new XmlBeanFactory(new ClassPathResource(SERIALIZATION_CONTEXT, CLASS));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(SERIALIZATION_CONTEXT, CLASS));
 		Person p = (Person) bf.getBean("serializablePrototype");
 		assertNotSame("Should not be a Singleton", p, bf.getBean("serializablePrototype"));
 		Person p2 = (Person) SerializationTestUtils.serializeAndDeserialize(p);
@@ -587,7 +608,8 @@ public final class ProxyFactoryBeanTests {
 
 	@Test
 	public void testSerializableSingletonProxyFactoryBean() throws Exception {
-		BeanFactory bf = new XmlBeanFactory(new ClassPathResource(SERIALIZATION_CONTEXT, CLASS));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(SERIALIZATION_CONTEXT, CLASS));
 		Person p = (Person) bf.getBean("serializableSingleton");
 		ProxyFactoryBean pfb = (ProxyFactoryBean) bf.getBean("&serializableSingleton");
 		ProxyFactoryBean pfb2 = (ProxyFactoryBean) SerializationTestUtils.serializeAndDeserialize(pfb);
@@ -599,14 +621,16 @@ public final class ProxyFactoryBeanTests {
 
 	@Test
 	public void testProxyNotSerializableBecauseOfAdvice() throws Exception {
-		BeanFactory bf = new XmlBeanFactory(new ClassPathResource(SERIALIZATION_CONTEXT, CLASS));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(SERIALIZATION_CONTEXT, CLASS));
 		Person p = (Person) bf.getBean("interceptorNotSerializableSingleton");
 		assertFalse("Not serializable because an interceptor isn't serializable", SerializationTestUtils.isSerializable(p));
 	}
 
 	@Test
 	public void testPrototypeAdvisor() {
-		BeanFactory bf = new XmlBeanFactory(new ClassPathResource(CONTEXT, CLASS));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(CONTEXT, CLASS));
 
 		ITestBean bean1 = (ITestBean) bf.getBean("prototypeTestBeanProxy");
 		ITestBean bean2 = (ITestBean) bf.getBean("prototypeTestBeanProxy");
@@ -637,7 +661,8 @@ public final class ProxyFactoryBeanTests {
 
 	@Test
 	public void testPrototypeInterceptorSingletonTarget() {
-		BeanFactory bf = new XmlBeanFactory(new ClassPathResource(CONTEXT, CLASS));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(CONTEXT, CLASS));
 
 		ITestBean bean1 = (ITestBean) bf.getBean("prototypeTestBeanProxySingletonTarget");
 		ITestBean bean2 = (ITestBean) bf.getBean("prototypeTestBeanProxySingletonTarget");
@@ -671,13 +696,15 @@ public final class ProxyFactoryBeanTests {
 	 */
 	@Test
 	public void testInnerBeanTargetUsingAutowiring() {
-		BeanFactory bf = new XmlBeanFactory(new ClassPathResource(AUTOWIRING_CONTEXT, CLASS));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(AUTOWIRING_CONTEXT, CLASS));
 		bf.getBean("testBean");
 	}
 
 	@Test
 	public void testFrozenFactoryBean() {
-		BeanFactory bf = new XmlBeanFactory(new ClassPathResource(FROZEN_CONTEXT, CLASS));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(FROZEN_CONTEXT, CLASS));
 
 		Advised advised = (Advised)bf.getBean("frozen");
 		assertTrue("The proxy should be frozen", advised.isFrozen());
diff --git a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AutoProxyCreatorTests.java b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AutoProxyCreatorTests.java
index d9237d23b9..4019d568d0 100644
--- a/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AutoProxyCreatorTests.java
+++ b/spring-context/src/test/java/org/springframework/aop/framework/autoproxy/AutoProxyCreatorTests.java
@@ -55,7 +55,8 @@ public final class AutoProxyCreatorTests {
 		proxyCreator.getPropertyValues().add("beanNames", "singletonToBeProxied,innerBean,singletonFactoryToBeProxied");
 		sac.getDefaultListableBeanFactory().registerBeanDefinition("beanNameAutoProxyCreator", proxyCreator);
 
-		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, RootBeanDefinition.AUTOWIRE_BY_TYPE);
+		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
+		bd.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
 		RootBeanDefinition innerBean = new RootBeanDefinition(TestBean.class);
 		bd.getPropertyValues().add("spouse", new BeanDefinitionHolder(innerBean, "innerBean"));
 		sac.getDefaultListableBeanFactory().registerBeanDefinition("singletonToBeProxied", bd);
diff --git a/spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java b/spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java
index e47669eaf8..68f7342e4c 100644
--- a/spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java
+++ b/spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java
@@ -16,19 +16,21 @@
 
 package org.springframework.aop.scope;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
 
-import static org.junit.Assert.*;
 import org.junit.Test;
-
 import org.springframework.aop.support.AopUtils;
 import org.springframework.beans.ITestBean;
 import org.springframework.beans.TestBean;
 import org.springframework.beans.factory.config.SimpleMapScope;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
 import org.springframework.context.support.GenericApplicationContext;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.util.SerializationTestUtils;
@@ -51,14 +53,16 @@ public class ScopedProxyTests {
 	/* SPR-2108 */
 	@Test
 	public void testProxyAssignable() throws Exception {
-		XmlBeanFactory bf = new XmlBeanFactory(MAP_CONTEXT);
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(MAP_CONTEXT);
 		Object baseMap = bf.getBean("singletonMap");
 		assertTrue(baseMap instanceof Map);
 	}
 
 	@Test
 	public void testSimpleProxy() throws Exception {
-		XmlBeanFactory bf = new XmlBeanFactory(MAP_CONTEXT);
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(MAP_CONTEXT);
 		Object simpleMap = bf.getBean("simpleMap");
 		assertTrue(simpleMap instanceof Map);
 		assertTrue(simpleMap instanceof HashMap);
@@ -82,7 +86,8 @@ public class ScopedProxyTests {
 
 	@Test
 	public void testJdkScopedProxy() throws Exception {
-		XmlBeanFactory bf = new XmlBeanFactory(TESTBEAN_CONTEXT);
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(TESTBEAN_CONTEXT);
 		bf.setSerializationId("X");
 		SimpleMapScope scope = new SimpleMapScope();
 		bf.registerScope("request", scope);
@@ -111,7 +116,8 @@ public class ScopedProxyTests {
 
 	@Test
 	public void testCglibScopedProxy() throws Exception {
-		XmlBeanFactory bf = new XmlBeanFactory(LIST_CONTEXT);
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(LIST_CONTEXT);
 		bf.setSerializationId("Y");
 		SimpleMapScope scope = new SimpleMapScope();
 		bf.registerScope("request", scope);
diff --git a/spring-context/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceTests.java b/spring-context/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceTests.java
index 5de96fc526..c0a695c452 100644
--- a/spring-context/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceTests.java
+++ b/spring-context/src/test/java/org/springframework/aop/target/CommonsPoolTargetSourceTests.java
@@ -16,7 +16,10 @@
 
 package org.springframework.aop.target;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.util.NoSuchElementException;
 
@@ -27,7 +30,8 @@ import org.junit.Test;
 import org.springframework.aop.framework.Advised;
 import org.springframework.beans.Person;
 import org.springframework.beans.SerializablePerson;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
+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.util.SerializationTestUtils;
@@ -50,11 +54,13 @@ public class CommonsPoolTargetSourceTests {
 	 */
 	private static final int INITIAL_COUNT = 10;
 
-	private XmlBeanFactory beanFactory;
+	private DefaultListableBeanFactory beanFactory;
 
 	@Before
 	public void setUp() throws Exception {
-		this.beanFactory = new XmlBeanFactory(new ClassPathResource(getClass().getSimpleName() + "-context.xml", getClass()));
+		this.beanFactory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(this.beanFactory).loadBeanDefinitions(
+				new ClassPathResource(getClass().getSimpleName() + "-context.xml", getClass()));
 	}
 
 	/**
diff --git a/spring-context/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java b/spring-context/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java
index b588561321..d6911ee72f 100644
--- a/spring-context/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java
+++ b/spring-context/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java
@@ -20,7 +20,6 @@ import java.beans.PropertyEditorSupport;
 import java.util.StringTokenizer;
 
 import junit.framework.TestCase;
-import junit.framework.Assert;
 
 import org.springframework.beans.BeansException;
 import org.springframework.beans.PropertyBatchUpdateException;
@@ -79,7 +78,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase {
 	 */
 	public void testLifecycleCallbacks() {
 		LifecycleBean lb = (LifecycleBean) getBeanFactory().getBean("lifecycle");
-		Assert.assertEquals("lifecycle", lb.getBeanName());
+		assertEquals("lifecycle", lb.getBeanName());
 		// The dummy business method will throw an exception if the
 		// necessary callbacks weren't invoked in the right order.
 		lb.businessMethod();
@@ -327,4 +326,4 @@ public abstract class AbstractBeanFactoryTests extends TestCase {
 		}
 	}
 
-}
\ No newline at end of file
+}
diff --git a/spring-context/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java b/spring-context/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java
index d683491a1f..855f23af39 100644
--- a/spring-context/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java
+++ b/spring-context/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.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.
@@ -16,8 +16,6 @@
 
 package org.springframework.beans.factory;
 
-import junit.framework.Assert;
-
 import org.springframework.beans.TestBean;
 
 /**
@@ -44,24 +42,24 @@ public abstract class AbstractListableBeanFactoryTests extends AbstractBeanFacto
 
 	protected final void assertCount(int count) {
 		String[] defnames = getListableBeanFactory().getBeanDefinitionNames();
-		Assert.assertTrue("We should have " + count + " beans, not " + defnames.length, defnames.length == count);
+		assertTrue("We should have " + count + " beans, not " + defnames.length, defnames.length == count);
 	}
 
 	public void assertTestBeanCount(int count) {
 		String[] defNames = getListableBeanFactory().getBeanNamesForType(TestBean.class, true, false);
-		Assert.assertTrue("We should have " + count + " beans for class org.springframework.beans.TestBean, not " +
+		assertTrue("We should have " + count + " beans for class org.springframework.beans.TestBean, not " +
 				defNames.length, defNames.length == count);
 
 		int countIncludingFactoryBeans = count + 2;
 		String[] names = getListableBeanFactory().getBeanNamesForType(TestBean.class, true, true);
-		Assert.assertTrue("We should have " + countIncludingFactoryBeans +
+		assertTrue("We should have " + countIncludingFactoryBeans +
 				" beans for class org.springframework.beans.TestBean, not " + names.length,
 				names.length == countIncludingFactoryBeans);
 	}
 
 	public void testGetDefinitionsForNoSuchClass() {
 		String[] defnames = getListableBeanFactory().getBeanNamesForType(String.class);
-		Assert.assertTrue("No string definitions", defnames.length == 0);
+		assertTrue("No string definitions", defnames.length == 0);
 	}
 
 	/**
@@ -69,18 +67,18 @@ public abstract class AbstractListableBeanFactoryTests extends AbstractBeanFacto
 	 * what type factories may return, and it may even change over time.)
 	 */
 	public void testGetCountForFactoryClass() {
-		Assert.assertTrue("Should have 2 factories, not " +
+		assertTrue("Should have 2 factories, not " +
 				getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length,
 				getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length == 2);
 
-		Assert.assertTrue("Should have 2 factories, not " +
+		assertTrue("Should have 2 factories, not " +
 				getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length,
 				getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length == 2);
 	}
 
 	public void testContainsBeanDefinition() {
-		Assert.assertTrue(getListableBeanFactory().containsBeanDefinition("rod"));
-		Assert.assertTrue(getListableBeanFactory().containsBeanDefinition("roderick"));
+		assertTrue(getListableBeanFactory().containsBeanDefinition("rod"));
+		assertTrue(getListableBeanFactory().containsBeanDefinition("roderick"));
 	}
 
-}
\ No newline at end of file
+}
diff --git a/spring-context/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java b/spring-context/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java
index 496cc1d63b..d42adc1daf 100644
--- a/spring-context/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java
+++ b/spring-context/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java
@@ -19,12 +19,11 @@ package org.springframework.beans.factory.parsing;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.LinkedHashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
-import org.springframework.core.CollectionFactory;
-
 /**
  * @author Rob Harrop
  * @author Juergen Hoeller
@@ -33,9 +32,9 @@ public class CollectingReaderEventListener implements ReaderEventListener {
 
 	private final List defaults = new LinkedList();
 
-	private final Map componentDefinitions = CollectionFactory.createLinkedMapIfPossible(8);
+	private final Map componentDefinitions = new LinkedHashMap<>(8);
 
-	private final Map> aliasMap = CollectionFactory.createLinkedMapIfPossible(8);
+	private final Map> aliasMap = new LinkedHashMap<>(8);
 
 	private final List imports = new LinkedList();
 
diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java
index 997523aaf6..3eed0d7cfc 100644
--- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java
+++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java
@@ -116,7 +116,6 @@ public final class XmlBeanFactoryTests {
 	private static final ClassPathResource NO_SUCH_FACTORY_METHOD_CONTEXT = classPathResource("-noSuchFactoryMethod.xml");
 	private static final ClassPathResource RECURSIVE_IMPORT_CONTEXT = classPathResource("-recursiveImport.xml");
 	private static final ClassPathResource RESOURCE_CONTEXT = classPathResource("-resource.xml");
-	private static final ClassPathResource RESOURCE_IMPORT_CONTEXT = classPathResource("-resourceImport.xml");
 	private static final ClassPathResource SATISFIED_ALL_DEP_CONTEXT = classPathResource("-satisfiedAllDepCheck.xml");
 	private static final ClassPathResource SATISFIED_OBJECT_DEP_CONTEXT = classPathResource("-satisfiedObjectDepCheck.xml");
 	private static final ClassPathResource SATISFIED_SIMPLE_DEP_CONTEXT = classPathResource("-satisfiedSimpleDepCheck.xml");
@@ -135,7 +134,8 @@ public final class XmlBeanFactoryTests {
 
 	/* SPR-2368 */
 	public @Test void testCollectionsReferredToAsRefLocals() throws Exception {
-		XmlBeanFactory factory = new XmlBeanFactory(COLLECTIONS_XSD_CONTEXT);
+		DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(factory).loadBeanDefinitions(COLLECTIONS_XSD_CONTEXT);
 		factory.preInstantiateSingletons();
 	}
 
@@ -296,8 +296,10 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testInheritanceFromParentFactoryPrototype() throws Exception {
-		XmlBeanFactory parent = new XmlBeanFactory(PARENT_CONTEXT);
-		XmlBeanFactory child = new XmlBeanFactory(CHILD_CONTEXT, parent);
+		DefaultListableBeanFactory parent = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(parent).loadBeanDefinitions(PARENT_CONTEXT);
+		DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
+		new XmlBeanDefinitionReader(child).loadBeanDefinitions(CHILD_CONTEXT);
 		assertEquals(TestBean.class, child.getType("inheritsFromParentFactory"));
 		TestBean inherits = (TestBean) child.getBean("inheritsFromParentFactory");
 		// Name property value is overridden
@@ -309,8 +311,10 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testInheritanceWithDifferentClass() throws Exception {
-		XmlBeanFactory parent = new XmlBeanFactory(PARENT_CONTEXT);
-		XmlBeanFactory child = new XmlBeanFactory(CHILD_CONTEXT, parent);
+		DefaultListableBeanFactory parent = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(parent).loadBeanDefinitions(PARENT_CONTEXT);
+		DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
+		new XmlBeanDefinitionReader(child).loadBeanDefinitions(CHILD_CONTEXT);
 		assertEquals(DerivedTestBean.class, child.getType("inheritsWithClass"));
 		DerivedTestBean inherits = (DerivedTestBean) child.getBean("inheritsWithDifferentClass");
 		// Name property value is overridden
@@ -321,8 +325,10 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testInheritanceWithClass() throws Exception {
-		XmlBeanFactory parent = new XmlBeanFactory(PARENT_CONTEXT);
-		XmlBeanFactory child = new XmlBeanFactory(CHILD_CONTEXT, parent);
+		DefaultListableBeanFactory parent = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(parent).loadBeanDefinitions(PARENT_CONTEXT);
+		DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
+		new XmlBeanDefinitionReader(child).loadBeanDefinitions(CHILD_CONTEXT);
 		assertEquals(DerivedTestBean.class, child.getType("inheritsWithClass"));
 		DerivedTestBean inherits = (DerivedTestBean) child.getBean("inheritsWithClass");
 		// Name property value is overridden
@@ -333,8 +339,10 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testPrototypeInheritanceFromParentFactoryPrototype() throws Exception {
-		XmlBeanFactory parent = new XmlBeanFactory(PARENT_CONTEXT);
-		XmlBeanFactory child = new XmlBeanFactory(CHILD_CONTEXT, parent);
+		DefaultListableBeanFactory parent = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(parent).loadBeanDefinitions(PARENT_CONTEXT);
+		DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
+		new XmlBeanDefinitionReader(child).loadBeanDefinitions(CHILD_CONTEXT);
 		assertEquals(TestBean.class, child.getType("prototypeInheritsFromParentFactoryPrototype"));
 		TestBean inherits = (TestBean) child.getBean("prototypeInheritsFromParentFactoryPrototype");
 		// Name property value is overridden
@@ -350,8 +358,10 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testPrototypeInheritanceFromParentFactorySingleton() throws Exception {
-		XmlBeanFactory parent = new XmlBeanFactory(PARENT_CONTEXT);
-		XmlBeanFactory child = new XmlBeanFactory(CHILD_CONTEXT, parent);
+		DefaultListableBeanFactory parent = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(parent).loadBeanDefinitions(PARENT_CONTEXT);
+		DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
+		new XmlBeanDefinitionReader(child).loadBeanDefinitions(CHILD_CONTEXT);
 		TestBean inherits = (TestBean) child.getBean("protoypeInheritsFromParentFactorySingleton");
 		// Name property value is overridden
 		assertTrue(inherits.getName().equals("prototypeOverridesInheritedSingleton"));
@@ -380,7 +390,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testAbstractParentBeans() {
-		XmlBeanFactory parent = new XmlBeanFactory(PARENT_CONTEXT);
+		DefaultListableBeanFactory parent = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(parent).loadBeanDefinitions(PARENT_CONTEXT);
 		parent.preInstantiateSingletons();
 		assertTrue(parent.isSingleton("inheritedTestBeanWithoutClass"));
 
@@ -404,7 +415,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testDependenciesMaterializeThis() throws Exception {
-		XmlBeanFactory xbf = new XmlBeanFactory(DEP_MATERIALIZE_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(DEP_MATERIALIZE_CONTEXT);
 
 		assertEquals(2, xbf.getBeansOfType(DummyBo.class, true, false).size());
 		assertEquals(3, xbf.getBeansOfType(DummyBo.class, true, true).size());
@@ -421,8 +433,10 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testChildOverridesParentBean() throws Exception {
-		XmlBeanFactory parent = new XmlBeanFactory(PARENT_CONTEXT);
-		XmlBeanFactory child = new XmlBeanFactory(CHILD_CONTEXT, parent);
+		DefaultListableBeanFactory parent = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(parent).loadBeanDefinitions(PARENT_CONTEXT);
+		DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
+		new XmlBeanDefinitionReader(child).loadBeanDefinitions(CHILD_CONTEXT);
 		TestBean inherits = (TestBean) child.getBean("inheritedTestBean");
 		// Name property value is overridden
 		assertTrue(inherits.getName().equals("overrideParentBean"));
@@ -437,8 +451,10 @@ public final class XmlBeanFactoryTests {
 	 * If a singleton does this the factory will fail to load.
 	 */
 	public @Test void testBogusParentageFromParentFactory() throws Exception {
-		XmlBeanFactory parent = new XmlBeanFactory(PARENT_CONTEXT);
-		XmlBeanFactory child = new XmlBeanFactory(CHILD_CONTEXT, parent);
+		DefaultListableBeanFactory parent = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(parent).loadBeanDefinitions(PARENT_CONTEXT);
+		DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
+		new XmlBeanDefinitionReader(child).loadBeanDefinitions(CHILD_CONTEXT);
 		try {
 			child.getBean("bogusParent", TestBean.class);
 			fail();
@@ -456,8 +472,10 @@ public final class XmlBeanFactoryTests {
 	 * instances even if derived from a prototype
 	 */
 	public @Test void testSingletonInheritsFromParentFactoryPrototype() throws Exception {
-		XmlBeanFactory parent = new XmlBeanFactory(PARENT_CONTEXT);
-		XmlBeanFactory child = new XmlBeanFactory(CHILD_CONTEXT, parent);
+		DefaultListableBeanFactory parent = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(parent).loadBeanDefinitions(PARENT_CONTEXT);
+		DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
+		new XmlBeanDefinitionReader(child).loadBeanDefinitions(CHILD_CONTEXT);
 		TestBean inherits = (TestBean) child.getBean("singletonInheritsFromParentFactoryPrototype");
 		// Name property value is overriden
 		assertTrue(inherits.getName().equals("prototype-override"));
@@ -468,16 +486,20 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testSingletonFromParent() {
-		XmlBeanFactory parent = new XmlBeanFactory(PARENT_CONTEXT);
+		DefaultListableBeanFactory parent = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(parent).loadBeanDefinitions(PARENT_CONTEXT);
 		TestBean beanFromParent = (TestBean) parent.getBean("inheritedTestBeanSingleton");
-		XmlBeanFactory child = new XmlBeanFactory(CHILD_CONTEXT, parent);
+		DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
+		new XmlBeanDefinitionReader(child).loadBeanDefinitions(CHILD_CONTEXT);
 		TestBean beanFromChild = (TestBean) child.getBean("inheritedTestBeanSingleton");
 		assertTrue("singleton from parent and child is the same", beanFromParent == beanFromChild);
 	}
 
 	public @Test void testNestedPropertyValue() {
-		XmlBeanFactory parent = new XmlBeanFactory(PARENT_CONTEXT);
-		XmlBeanFactory child = new XmlBeanFactory(CHILD_CONTEXT, parent);
+		DefaultListableBeanFactory parent = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(parent).loadBeanDefinitions(PARENT_CONTEXT);
+		DefaultListableBeanFactory child = new DefaultListableBeanFactory(parent);
+		new XmlBeanDefinitionReader(child).loadBeanDefinitions(CHILD_CONTEXT);
 		IndexedTestBean bean = (IndexedTestBean) child.getBean("indexedTestBean");
 		assertEquals("name applied correctly", "myname", bean.getArray()[0].getName());
 	}
@@ -571,19 +593,22 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testFactoryReferenceCircle() {
-		XmlBeanFactory xbf = new XmlBeanFactory(FACTORY_CIRCLE_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(FACTORY_CIRCLE_CONTEXT);
 		TestBean tb = (TestBean) xbf.getBean("singletonFactory");
 		DummyFactory db = (DummyFactory) xbf.getBean("&singletonFactory");
 		assertTrue(tb == db.getOtherTestBean());
 	}
 
 	public @Test void testFactoryReferenceWithDoublePrefix() {
-		XmlBeanFactory xbf = new XmlBeanFactory(FACTORY_CIRCLE_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(FACTORY_CIRCLE_CONTEXT);
 		assertThat(xbf.getBean("&&singletonFactory"), instanceOf(DummyFactory.class));
 	}
 
 	public @Test void testComplexFactoryReferenceCircle() {
-		XmlBeanFactory xbf = new XmlBeanFactory(COMPLEX_FACTORY_CIRCLE_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(COMPLEX_FACTORY_CIRCLE_CONTEXT);
 		xbf.getBean("proxy1");
 		// check that unused instances from autowiring got removed
 		assertEquals(4, xbf.getSingletonCount());
@@ -594,7 +619,8 @@ public final class XmlBeanFactoryTests {
 
 	public @Test void testNoSuchFactoryBeanMethod() {
 		try {
-			XmlBeanFactory xbf = new XmlBeanFactory(NO_SUCH_FACTORY_METHOD_CONTEXT);
+			DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+			new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(NO_SUCH_FACTORY_METHOD_CONTEXT);
 			assertNotNull(xbf.getBean("defaultTestBean"));
 			fail("Should not get invalid bean");
 		}
@@ -604,7 +630,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testInitMethodIsInvoked() throws Exception {
-		XmlBeanFactory xbf = new XmlBeanFactory(INITIALIZERS_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(INITIALIZERS_CONTEXT);
 		DoubleInitializer in = (DoubleInitializer) xbf.getBean("init-method1");
 		// Initializer should have doubled value
 		assertEquals(14, in.getNum());
@@ -614,7 +641,8 @@ public final class XmlBeanFactoryTests {
 	 * Test that if a custom initializer throws an exception, it's handled correctly
 	 */
 	public @Test void testInitMethodThrowsException() {
-		XmlBeanFactory xbf = new XmlBeanFactory(INITIALIZERS_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(INITIALIZERS_CONTEXT);
 		try {
 			xbf.getBean("init-method2");
 			fail();
@@ -627,7 +655,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testNoSuchInitMethod() throws Exception {
-		XmlBeanFactory xbf = new XmlBeanFactory(INITIALIZERS_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(INITIALIZERS_CONTEXT);
 		try {
 			xbf.getBean("init-method3");
 			fail();
@@ -645,7 +674,8 @@ public final class XmlBeanFactoryTests {
 	 */
 	public @Test void testInitializingBeanAndInitMethod() throws Exception {
 		InitAndIB.constructed = false;
-		XmlBeanFactory xbf = new XmlBeanFactory(INITIALIZERS_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(INITIALIZERS_CONTEXT);
 		assertFalse(InitAndIB.constructed);
 		xbf.preInstantiateSingletons();
 		assertFalse(InitAndIB.constructed);
@@ -664,7 +694,8 @@ public final class XmlBeanFactoryTests {
 	 */
 	public @Test void testInitializingBeanAndSameInitMethod() throws Exception {
 		InitAndIB.constructed = false;
-		XmlBeanFactory xbf = new XmlBeanFactory(INITIALIZERS_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(INITIALIZERS_CONTEXT);
 		assertFalse(InitAndIB.constructed);
 		xbf.preInstantiateSingletons();
 		assertFalse(InitAndIB.constructed);
@@ -680,7 +711,8 @@ public final class XmlBeanFactoryTests {
 
 	public @Test void testDefaultLazyInit() throws Exception {
 		InitAndIB.constructed = false;
-		XmlBeanFactory xbf = new XmlBeanFactory(DEFAULT_LAZY_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(DEFAULT_LAZY_CONTEXT);
 		assertFalse(InitAndIB.constructed);
 		xbf.preInstantiateSingletons();
 		assertTrue(InitAndIB.constructed);
@@ -693,8 +725,9 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testNoSuchXmlFile() throws Exception {
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
 		try {
-			new XmlBeanFactory(MISSING_CONTEXT);
+			new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(MISSING_CONTEXT);
 			fail("Must not create factory from missing XML");
 		}
 		catch (BeanDefinitionStoreException expected) {
@@ -702,8 +735,9 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testInvalidXmlFile() throws Exception {
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
 		try {
-			new XmlBeanFactory(INVALID_CONTEXT);
+			new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(INVALID_CONTEXT);
 			fail("Must not create factory from invalid XML");
 		}
 		catch (BeanDefinitionStoreException expected) {
@@ -711,8 +745,9 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testUnsatisfiedObjectDependencyCheck() throws Exception {
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
 		try {
-			XmlBeanFactory xbf = new XmlBeanFactory(UNSATISFIED_OBJECT_DEP_CONTEXT);
+			new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(UNSATISFIED_OBJECT_DEP_CONTEXT);
 			xbf.getBean("a", DependenciesBean.class);
 			fail("Must have thrown an UnsatisfiedDependencyException");
 		}
@@ -721,8 +756,9 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testUnsatisfiedSimpleDependencyCheck() throws Exception {
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
 		try {
-			XmlBeanFactory xbf = new XmlBeanFactory(UNSATISFIED_SIMPLE_DEP_CONTEXT);
+			new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(UNSATISFIED_SIMPLE_DEP_CONTEXT);
 			xbf.getBean("a", DependenciesBean.class);
 			fail("Must have thrown an UnsatisfiedDependencyException");
 		}
@@ -731,21 +767,24 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testSatisfiedObjectDependencyCheck() throws Exception {
-		XmlBeanFactory xbf = new XmlBeanFactory(SATISFIED_OBJECT_DEP_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(SATISFIED_OBJECT_DEP_CONTEXT);
 		DependenciesBean a = (DependenciesBean) xbf.getBean("a");
 		assertNotNull(a.getSpouse());
 		assertEquals(xbf, a.getBeanFactory());
 	}
 
 	public @Test void testSatisfiedSimpleDependencyCheck() throws Exception {
-		XmlBeanFactory xbf = new XmlBeanFactory(SATISFIED_SIMPLE_DEP_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(SATISFIED_SIMPLE_DEP_CONTEXT);
 		DependenciesBean a = (DependenciesBean) xbf.getBean("a");
 		assertEquals(a.getAge(), 33);
 	}
 
 	public @Test void testUnsatisfiedAllDependencyCheck() throws Exception {
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
 		try {
-			XmlBeanFactory xbf = new XmlBeanFactory(UNSATISFIED_ALL_DEP_CONTEXT);
+			new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(UNSATISFIED_ALL_DEP_CONTEXT);
 			xbf.getBean("a", DependenciesBean.class);
 			fail("Must have thrown an UnsatisfiedDependencyException");
 		}
@@ -754,7 +793,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testSatisfiedAllDependencyCheck() throws Exception {
-		XmlBeanFactory xbf = new XmlBeanFactory(SATISFIED_ALL_DEP_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(SATISFIED_ALL_DEP_CONTEXT);
 		DependenciesBean a = (DependenciesBean) xbf.getBean("a");
 		assertEquals(a.getAge(), 33);
 		assertNotNull(a.getName());
@@ -762,23 +802,27 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testAutowire() throws Exception {
-		XmlBeanFactory xbf = new XmlBeanFactory(AUTOWIRE_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(AUTOWIRE_CONTEXT);
 		TestBean spouse = new TestBean("kerry", 0);
 		xbf.registerSingleton("spouse", spouse);
 		doTestAutowire(xbf);
 	}
 
 	public @Test void testAutowireWithParent() throws Exception {
-		XmlBeanFactory xbf = new XmlBeanFactory(AUTOWIRE_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(AUTOWIRE_CONTEXT);
 		DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
 		MutablePropertyValues pvs = new MutablePropertyValues();
 		pvs.add("name", "kerry");
-		lbf.registerBeanDefinition("spouse", new RootBeanDefinition(TestBean.class, pvs));
+		RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
+		bd.setPropertyValues(pvs);
+		lbf.registerBeanDefinition("spouse", bd);
 		xbf.setParentBeanFactory(lbf);
 		doTestAutowire(xbf);
 	}
 
-	private void doTestAutowire(XmlBeanFactory xbf) throws Exception {
+	private void doTestAutowire(DefaultListableBeanFactory xbf) throws Exception {
 		DependenciesBean rod1 = (DependenciesBean) xbf.getBean("rod1");
 		TestBean kerry = (TestBean) xbf.getBean("spouse");
 		// should have been autowired
@@ -827,7 +871,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testAutowireWithDefault() throws Exception {
-		XmlBeanFactory xbf = new XmlBeanFactory(DEFAULT_AUTOWIRE_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(DEFAULT_AUTOWIRE_CONTEXT);
 
 		DependenciesBean rod1 = (DependenciesBean) xbf.getBean("rod1");
 		// should have been autowired
@@ -848,7 +893,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testAutowireByConstructor() throws Exception {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 		ConstructorDependenciesBean rod1 = (ConstructorDependenciesBean) xbf.getBean("rod1");
 		TestBean kerry = (TestBean) xbf.getBean("kerry2");
 		// should have been autowired
@@ -884,7 +930,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testAutowireByConstructorWithSimpleValues() throws Exception {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 
 		ConstructorDependenciesBean rod5 = (ConstructorDependenciesBean) xbf.getBean("rod5");
 		TestBean kerry1 = (TestBean) xbf.getBean("kerry1");
@@ -912,7 +959,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testRelatedCausesFromConstructorResolution() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 
 		try {
 			xbf.getBean("rod2Accessor");
@@ -925,7 +973,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testConstructorArgResolution() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 		TestBean kerry1 = (TestBean) xbf.getBean("kerry1");
 		TestBean kerry2 = (TestBean) xbf.getBean("kerry2");
 
@@ -972,7 +1021,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testPrototypeWithExplicitArguments() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 		SimpleConstructorArgBean cd1 = (SimpleConstructorArgBean) xbf.getBean("rod18");
 		assertEquals(0, cd1.getAge());
 		SimpleConstructorArgBean cd2 = (SimpleConstructorArgBean) xbf.getBean("rod18", 98);
@@ -986,13 +1036,15 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testConstructorArgWithSingleMatch() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 		File file = (File) xbf.getBean("file");
 		assertEquals(File.separator + "test", file.getPath());
 	}
 
 	public @Test void testThrowsExceptionOnTooManyArguments() throws Exception {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 		try {
 			xbf.getBean("rod7", ConstructorDependenciesBean.class);
 			fail("Should have thrown BeanCreationException");
@@ -1002,7 +1054,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testThrowsExceptionOnAmbiguousResolution() throws Exception {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 		try {
 			xbf.getBean("rod8", ConstructorDependenciesBean.class);
 			fail("Must have thrown UnsatisfiedDependencyException");
@@ -1058,7 +1111,8 @@ public final class XmlBeanFactoryTests {
 		PreparingBean2.destroyed = false;
 		DependingBean.destroyCount = 0;
 		HoldingBean.destroyCount = 0;
-		XmlBeanFactory xbf = new XmlBeanFactory(resource);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(resource);
 		xbf.preInstantiateSingletons();
 		xbf.destroySingletons();
 		assertTrue(PreparingBean1.prepared);
@@ -1078,7 +1132,8 @@ public final class XmlBeanFactoryTests {
 	 * must rather only be picked up when the bean is instantiated.
 	 */
 	public @Test void testClassNotFoundWithDefaultBeanClassLoader() {
-		BeanFactory factory = new XmlBeanFactory(CLASS_NOT_FOUND_CONTEXT);
+		DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(factory).loadBeanDefinitions(CLASS_NOT_FOUND_CONTEXT);
 		// cool, no errors, so the rubbish class name in the bean def was not resolved
 		try {
 			// let's resolve the bean definition; must blow up
@@ -1100,7 +1155,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testResourceAndInputStream() throws IOException {
-		XmlBeanFactory xbf = new XmlBeanFactory(RESOURCE_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(RESOURCE_CONTEXT);
 		// comes from "resourceImport.xml"
 		ResourceTestBean resource1 = (ResourceTestBean) xbf.getBean("resource1");
 		// comes from "resource.xml"
@@ -1122,7 +1178,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testClassPathResourceWithImport() {
-		XmlBeanFactory xbf = new XmlBeanFactory(RESOURCE_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(RESOURCE_CONTEXT);
 		// comes from "resourceImport.xml"
 		xbf.getBean("resource1", ResourceTestBean.class);
 		// comes from "resource.xml"
@@ -1131,7 +1188,8 @@ public final class XmlBeanFactoryTests {
 
 	public @Test void testUrlResourceWithImport() {
 		URL url = getClass().getResource(RESOURCE_CONTEXT.getPath());
-		XmlBeanFactory xbf = new XmlBeanFactory(new UrlResource(url));
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(new UrlResource(url));
 		// comes from "resourceImport.xml"
 		xbf.getBean("resource1", ResourceTestBean.class);
 		// comes from "resource.xml"
@@ -1140,7 +1198,8 @@ public final class XmlBeanFactoryTests {
 
 	public @Test void testFileSystemResourceWithImport() throws URISyntaxException {
 		String file = getClass().getResource(RESOURCE_CONTEXT.getPath()).toURI().getPath();
-		XmlBeanFactory xbf = new XmlBeanFactory(new FileSystemResource(file));
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(new FileSystemResource(file));
 		// comes from "resourceImport.xml"
 		xbf.getBean("resource1", ResourceTestBean.class);
 		// comes from "resource.xml"
@@ -1148,8 +1207,9 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testRecursiveImport() {
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
 		try {
-			new XmlBeanFactory(RECURSIVE_IMPORT_CONTEXT);
+			new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(RECURSIVE_IMPORT_CONTEXT);
 			fail("Should have thrown BeanDefinitionStoreException");
 		}
 		catch (BeanDefinitionStoreException ex) {
@@ -1344,7 +1404,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testConstructorArgWithSingleSimpleTypeMatch() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 
 		SingleSimpleTypeConstructorBean bean = (SingleSimpleTypeConstructorBean) xbf.getBean("beanWithBoolean");
 		assertTrue(bean.isSingleBoolean());
@@ -1354,7 +1415,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testConstructorArgWithDoubleSimpleTypeMatch() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 
 		SingleSimpleTypeConstructorBean bean = (SingleSimpleTypeConstructorBean) xbf.getBean("beanWithBooleanAndString");
 		assertTrue(bean.isSecondBoolean());
@@ -1366,33 +1428,38 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testDoubleBooleanAutowire() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 		DoubleBooleanConstructorBean bean = (DoubleBooleanConstructorBean) xbf.getBean("beanWithDoubleBoolean");
 		assertEquals(Boolean.TRUE, bean.boolean1);
 		assertEquals(Boolean.FALSE, bean.boolean2);
 	}
 
 	public @Test void testDoubleBooleanAutowireWithIndex() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 		DoubleBooleanConstructorBean bean = (DoubleBooleanConstructorBean) xbf.getBean("beanWithDoubleBooleanAndIndex");
 		assertEquals(Boolean.FALSE, bean.boolean1);
 		assertEquals(Boolean.TRUE, bean.boolean2);
 	}
 
 	public @Test void testLenientDependencyMatching() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 		LenientDependencyTestBean bean = (LenientDependencyTestBean) xbf.getBean("lenientDependencyTestBean");
 		assertTrue(bean.tb instanceof DerivedTestBean);
 	}
 
 	public @Test void testLenientDependencyMatchingFactoryMethod() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 		LenientDependencyTestBean bean = (LenientDependencyTestBean) xbf.getBean("lenientDependencyTestBeanFactoryMethod");
 		assertTrue(bean.tb instanceof DerivedTestBean);
 	}
 
 	public @Test void testNonLenientDependencyMatching() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 		AbstractBeanDefinition bd = (AbstractBeanDefinition) xbf.getBeanDefinition("lenientDependencyTestBean");
 		bd.setLenientConstructorResolution(false);
 		try {
@@ -1407,7 +1474,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testNonLenientDependencyMatchingFactoryMethod() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 		AbstractBeanDefinition bd = (AbstractBeanDefinition) xbf.getBeanDefinition("lenientDependencyTestBeanFactoryMethod");
 		bd.setLenientConstructorResolution(false);
 		try {
@@ -1422,7 +1490,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testJavaLangStringConstructor() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 		AbstractBeanDefinition bd = (AbstractBeanDefinition) xbf.getBeanDefinition("string");
 		bd.setLenientConstructorResolution(false);
 		String str = (String) xbf.getBean("string");
@@ -1430,7 +1499,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testCustomStringConstructor() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 		AbstractBeanDefinition bd = (AbstractBeanDefinition) xbf.getBeanDefinition("stringConstructor");
 		bd.setLenientConstructorResolution(false);
 		StringConstructorTestBean tb = (StringConstructorTestBean) xbf.getBean("stringConstructor");
@@ -1438,7 +1508,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testPrimitiveConstructorArray() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 		ConstructorArrayTestBean bean = (ConstructorArrayTestBean) xbf.getBean("constructorArray");
 		assertTrue(bean.array instanceof int[]);
 		assertEquals(1, ((int[]) bean.array).length);
@@ -1446,7 +1517,8 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testIndexedPrimitiveConstructorArray() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 		ConstructorArrayTestBean bean = (ConstructorArrayTestBean) xbf.getBean("indexedConstructorArray");
 		assertTrue(bean.array instanceof int[]);
 		assertEquals(1, ((int[]) bean.array).length);
@@ -1454,14 +1526,16 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testStringConstructorArrayNoType() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 		ConstructorArrayTestBean bean = (ConstructorArrayTestBean) xbf.getBean("constructorArrayNoType");
 		assertTrue(bean.array instanceof String[]);
 		assertEquals(0, ((String[]) bean.array).length);
 	}
 
 	public @Test void testStringConstructorArrayNoTypeNonLenient() {
-		XmlBeanFactory xbf = new XmlBeanFactory(CONSTRUCTOR_ARG_CONTEXT);
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
 		AbstractBeanDefinition bd = (AbstractBeanDefinition) xbf.getBeanDefinition("constructorArrayNoType");
 		bd.setLenientConstructorResolution(false);
 		ConstructorArrayTestBean bean = (ConstructorArrayTestBean) xbf.getBean("constructorArrayNoType");
@@ -1470,8 +1544,9 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testWithDuplicateName() throws Exception {
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
 		try {
-			new XmlBeanFactory(TEST_WITH_DUP_NAMES_CONTEXT);
+			new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(TEST_WITH_DUP_NAMES_CONTEXT);
 			fail("Duplicate name not detected");
 		}
 		catch (BeansException ex) {
@@ -1480,8 +1555,9 @@ public final class XmlBeanFactoryTests {
 	}
 
 	public @Test void testWithDuplicateNameInAlias() throws Exception {
+		DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
 		try {
-			new XmlBeanFactory(TEST_WITH_DUP_NAME_IN_ALIAS_CONTEXT);
+			new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(TEST_WITH_DUP_NAME_IN_ALIAS_CONTEXT);
 			fail("Duplicate name not detected");
 		}
 		catch (BeansException e) {
diff --git a/spring-context/src/test/java/org/springframework/cache/config/AnnotationNamespaceDrivenTests.java b/spring-context/src/test/java/org/springframework/cache/config/AnnotationNamespaceDrivenTests.java
index 44b931dfe6..b6785792a5 100644
--- a/spring-context/src/test/java/org/springframework/cache/config/AnnotationNamespaceDrivenTests.java
+++ b/spring-context/src/test/java/org/springframework/cache/config/AnnotationNamespaceDrivenTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010-2011 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.
@@ -16,7 +16,7 @@
 
 package org.springframework.cache.config;
 
-import junit.framework.Assert;
+import static org.junit.Assert.assertSame;
 
 import org.junit.Test;
 import org.springframework.cache.interceptor.CacheInterceptor;
@@ -39,6 +39,6 @@ public class AnnotationNamespaceDrivenTests extends AbstractAnnotationTests {
 	public void testKeyStrategy() throws Exception {
 		CacheInterceptor ci = ctx.getBean("org.springframework.cache.interceptor.CacheInterceptor#0",
 				CacheInterceptor.class);
-		Assert.assertSame(ctx.getBean("keyGenerator"), ci.getKeyGenerator());
+		assertSame(ctx.getBean("keyGenerator"), ci.getKeyGenerator());
 	}
 }
diff --git a/spring-context/src/test/java/org/springframework/cache/config/EnableCachingTests.java b/spring-context/src/test/java/org/springframework/cache/config/EnableCachingTests.java
index 04f232cc84..0a611c0bbf 100644
--- a/spring-context/src/test/java/org/springframework/cache/config/EnableCachingTests.java
+++ b/spring-context/src/test/java/org/springframework/cache/config/EnableCachingTests.java
@@ -16,12 +16,11 @@
 
 package org.springframework.cache.config;
 
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
 import java.util.Arrays;
 
-import junit.framework.Assert;
-
 import org.junit.Test;
 import org.springframework.beans.factory.BeanCreationException;
 import org.springframework.cache.CacheManager;
@@ -53,7 +52,7 @@ public class EnableCachingTests extends AbstractAnnotationTests {
 	@Test
 	public void testKeyStrategy() throws Exception {
 		CacheInterceptor ci = ctx.getBean(CacheInterceptor.class);
-		Assert.assertSame(ctx.getBean(KeyGenerator.class), ci.getKeyGenerator());
+		assertSame(ctx.getBean(KeyGenerator.class), ci.getKeyGenerator());
 	}
 
 	// --- local tests -------
diff --git a/spring-context/src/test/java/org/springframework/context/access/ContextSingletonBeanFactoryLocatorTests.java b/spring-context/src/test/java/org/springframework/context/access/ContextSingletonBeanFactoryLocatorTests.java
index 6c63077602..59137c7516 100644
--- a/spring-context/src/test/java/org/springframework/context/access/ContextSingletonBeanFactoryLocatorTests.java
+++ b/spring-context/src/test/java/org/springframework/context/access/ContextSingletonBeanFactoryLocatorTests.java
@@ -16,14 +16,16 @@
 
 package org.springframework.context.access;
 
-import static org.junit.Assert.*;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
+import org.junit.Test;
 import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.access.BeanFactoryLocator;
 import org.springframework.beans.factory.access.BeanFactoryReference;
 import org.springframework.beans.factory.access.SingletonBeanFactoryLocatorTests;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.context.ApplicationContext;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.util.ClassUtils;
@@ -43,8 +45,10 @@ public class ContextSingletonBeanFactoryLocatorTests extends SingletonBeanFactor
 	public void testBaseBeanFactoryDefs() {
 		// Just test the base BeanFactory/AppContext defs we are going to work
 		// with in other tests.
-		new XmlBeanFactory(new ClassPathResource("/org/springframework/beans/factory/access/beans1.xml"));
-		new XmlBeanFactory(new ClassPathResource("/org/springframework/beans/factory/access/beans2.xml"));
+		new XmlBeanDefinitionReader(new DefaultListableBeanFactory()).loadBeanDefinitions(new ClassPathResource(
+				"/org/springframework/beans/factory/access/beans1.xml"));
+		new XmlBeanDefinitionReader(new DefaultListableBeanFactory()).loadBeanDefinitions(new ClassPathResource(
+				"/org/springframework/beans/factory/access/beans2.xml"));
 	}
 
 	@Override
diff --git a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java
index 7154230505..d35b5396fd 100644
--- a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java
+++ b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationProcessorPerformanceTests.java
@@ -31,8 +31,8 @@ import org.springframework.beans.factory.annotation.Required;
 import org.springframework.beans.factory.config.RuntimeBeanReference;
 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.build.junit.Assume;
-import org.springframework.build.junit.TestGroup;
+import org.springframework.tests.Assume;
+import org.springframework.tests.TestGroup;
 import org.springframework.context.support.GenericApplicationContext;
 import org.springframework.util.StopWatch;
 
diff --git a/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java b/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java
index 5029e1c7e6..62aa1411a3 100644
--- a/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java
+++ b/spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java
@@ -34,6 +34,7 @@ import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.NoSuchBeanDefinitionException;
 import org.springframework.beans.factory.ObjectFactory;
 import org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor;
+import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor;
 import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
@@ -171,9 +172,15 @@ public class CommonAnnotationBeanPostProcessorTests {
 		CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();
 		bpp.setResourceFactory(bf);
 		bf.addBeanPostProcessor(bpp);
-		bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ResourceInjectionBean.class, false));
-		bf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class, false));
-		bf.registerBeanDefinition("testBean2", new RootBeanDefinition(TestBean.class, false));
+		RootBeanDefinition abd = new RootBeanDefinition(ResourceInjectionBean.class);
+		abd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
+		bf.registerBeanDefinition("annotatedBean", abd);
+		RootBeanDefinition tbd1 = new RootBeanDefinition(TestBean.class);
+		tbd1.setScope(BeanDefinition.SCOPE_PROTOTYPE);
+		bf.registerBeanDefinition("testBean", tbd1);
+		RootBeanDefinition tbd2 = new RootBeanDefinition(TestBean.class);
+		tbd2.setScope(BeanDefinition.SCOPE_PROTOTYPE);
+		bf.registerBeanDefinition("testBean2", tbd2);
 
 		ResourceInjectionBean bean = (ResourceInjectionBean) bf.getBean("annotatedBean");
 		assertTrue(bean.initCalled);
@@ -202,8 +209,12 @@ public class CommonAnnotationBeanPostProcessorTests {
 		CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();
 		bpp.setBeanFactory(bf);
 		bf.addBeanPostProcessor(bpp);
-		bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ExtendedResourceInjectionBean.class, false));
-		bf.registerBeanDefinition("testBean4", new RootBeanDefinition(TestBean.class, false));
+		RootBeanDefinition abd = new RootBeanDefinition(ExtendedResourceInjectionBean.class);
+		abd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
+		bf.registerBeanDefinition("annotatedBean", abd);
+		RootBeanDefinition tbd = new RootBeanDefinition(TestBean.class);
+		tbd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
+		bf.registerBeanDefinition("testBean4", tbd);
 
 		bf.registerResolvableDependency(BeanFactory.class, bf);
 		bf.registerResolvableDependency(INestedTestBean.class, new ObjectFactory() {
diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/AutowiredConfigurationTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/AutowiredConfigurationTests.java
index 2051c97fe0..896e9b2a4f 100644
--- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/AutowiredConfigurationTests.java
+++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/AutowiredConfigurationTests.java
@@ -25,8 +25,9 @@ import test.beans.TestBean;
 import org.springframework.beans.factory.BeanCreationException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Scope;
@@ -79,7 +80,9 @@ public class AutowiredConfigurationTests {
 	 */
 	@Test(expected=BeanCreationException.class)
 	public void testAutowiredConfigurationConstructorsAreNotSupported() {
-		XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource("annotation-config.xml", AutowiredConstructorConfig.class));
+		DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(factory).loadBeanDefinitions(
+				new ClassPathResource("annotation-config.xml", AutowiredConstructorConfig.class));
 		GenericApplicationContext ctx = new GenericApplicationContext(factory);
 		ctx.registerBeanDefinition("config1", new RootBeanDefinition(AutowiredConstructorConfig.class));
 		ctx.registerBeanDefinition("config2", new RootBeanDefinition(ColorConfig.class));
diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassAspectIntegrationTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassAspectIntegrationTests.java
index 9c94716494..47b3d2abb5 100644
--- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassAspectIntegrationTests.java
+++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassAspectIntegrationTests.java
@@ -16,14 +16,15 @@
 
 package org.springframework.context.annotation.configuration;
 
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.*;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
 
 import org.aspectj.lang.annotation.Aspect;
 import org.aspectj.lang.annotation.Before;
 import org.junit.Test;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.ConfigurationClassPostProcessor;
@@ -47,8 +48,10 @@ import test.beans.TestBean;
  */
 public class ConfigurationClassAspectIntegrationTests {
 	private void assertAdviceWasApplied(Class configClass) {
-		GenericApplicationContext ctx = new GenericApplicationContext(
-					new XmlBeanFactory(new ClassPathResource("aspectj-autoproxy-config.xml", ConfigurationClassAspectIntegrationTests.class)));
+		DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(factory).loadBeanDefinitions(
+				new ClassPathResource("aspectj-autoproxy-config.xml", ConfigurationClassAspectIntegrationTests.class));
+		GenericApplicationContext ctx = new GenericApplicationContext(factory);
 		ctx.addBeanFactoryPostProcessor(new ConfigurationClassPostProcessor());
 		ctx.registerBeanDefinition("config", new RootBeanDefinition(configClass));
 		ctx.refresh();
diff --git a/spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java b/spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java
index 4a9a4db08d..592337551c 100644
--- a/spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java
+++ b/spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java
@@ -86,7 +86,7 @@ public class EventPublicationInterceptorTests {
 		class TestContext extends StaticApplicationContext {
 			@Override
 			protected void onRefresh() throws BeansException {
-				addListener(listener);
+				addApplicationListener(listener);
 			}
 		}
 
diff --git a/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java b/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java
index b49857d8cb..3384916c08 100644
--- a/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java
+++ b/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java
@@ -38,8 +38,8 @@ 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.build.junit.Assume;
-import org.springframework.build.junit.TestGroup;
+import org.springframework.tests.Assume;
+import org.springframework.tests.TestGroup;
 import org.springframework.context.annotation.AnnotationConfigUtils;
 import org.springframework.context.support.GenericApplicationContext;
 import org.springframework.util.SerializationTestUtils;
diff --git a/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextMulticasterTests.java b/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextMulticasterTests.java
index 9c7ea0ca65..39651c9370 100644
--- a/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextMulticasterTests.java
+++ b/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextMulticasterTests.java
@@ -54,7 +54,7 @@ public class StaticApplicationContextMulticasterTests extends AbstractApplicatio
 		parent.registerSingleton(StaticApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME,
 				TestApplicationEventMulticaster.class, null);
 		parent.refresh();
-		parent.addListener(parentListener) ;
+		parent.addApplicationListener(parentListener) ;
 
 		parent.getStaticMessageSource().addMessage("code1", Locale.getDefault(), "message1");
 
@@ -66,7 +66,7 @@ public class StaticApplicationContextMulticasterTests extends AbstractApplicatio
 		Resource resource = new ClassPathResource("testBeans.properties", getClass());
 		reader.loadBeanDefinitions(new EncodedResource(resource, "ISO-8859-1"));
 		sac.refresh();
-		sac.addListener(listener);
+		sac.addApplicationListener(listener);
 
 		sac.getStaticMessageSource().addMessage("code2", Locale.getDefault(), "message2");
 
diff --git a/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextTests.java b/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextTests.java
index 1c63274f19..acddae3ff1 100644
--- a/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextTests.java
+++ b/spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextTests.java
@@ -48,7 +48,7 @@ public class StaticApplicationContextTests extends AbstractApplicationContextTes
 		m.put("name", "Albert");
 		parent.registerPrototype("father", TestBean.class, new MutablePropertyValues(m));
 		parent.refresh();
-		parent.addListener(parentListener) ;
+		parent.addApplicationListener(parentListener) ;
 
 		parent.getStaticMessageSource().addMessage("code1", Locale.getDefault(), "message1");
 
@@ -59,7 +59,7 @@ public class StaticApplicationContextTests extends AbstractApplicationContextTes
 		PropertiesBeanDefinitionReader reader = new PropertiesBeanDefinitionReader(sac.getDefaultListableBeanFactory());
 		reader.loadBeanDefinitions(new ClassPathResource("testBeans.properties", getClass()));
 		sac.refresh();
-		sac.addListener(listener);
+		sac.addApplicationListener(listener);
 
 		sac.getStaticMessageSource().addMessage("code2", Locale.getDefault(), "message2");
 
diff --git a/spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java b/spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java
index 9fa8ddd436..8a94e8326e 100644
--- a/spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java
+++ b/spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java
@@ -208,7 +208,7 @@ public class StaticMessageSourceTests extends AbstractApplicationContextTests {
 		parent.registerPrototype("father", org.springframework.beans.TestBean.class, new MutablePropertyValues(m));
 
 		parent.refresh();
-		parent.addListener(parentListener);
+		parent.addApplicationListener(parentListener);
 
 		this.sac = new StaticApplicationContext(parent);
 
@@ -221,7 +221,7 @@ public class StaticMessageSourceTests extends AbstractApplicationContextTests {
 		PropertiesBeanDefinitionReader reader = new PropertiesBeanDefinitionReader(sac.getDefaultListableBeanFactory());
 		reader.loadBeanDefinitions(new ClassPathResource("testBeans.properties", getClass()));
 		sac.refresh();
-		sac.addListener(listener);
+		sac.addApplicationListener(listener);
 
 		StaticMessageSource messageSource = sac.getStaticMessageSource();
 		Map usMessages = new HashMap(3);
diff --git a/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceTests.java b/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceTests.java
index 6fcefd9d75..6b0fb87da7 100644
--- a/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceTests.java
+++ b/spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceTests.java
@@ -36,6 +36,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.ConfigurablePropertyAccessor;
 import org.springframework.beans.PropertyAccessorFactory;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
 import org.springframework.beans.factory.support.RootBeanDefinition;
 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
@@ -112,7 +113,9 @@ public class FormattingConversionServiceTests {
 	@Test
 	public void testFormatFieldForValueInjectionUsingMetaAnnotations() {
 		AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext();
-		ac.registerBeanDefinition("valueBean", new RootBeanDefinition(MetaValueBean.class, false));
+		RootBeanDefinition bd = new RootBeanDefinition(MetaValueBean.class);
+		bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
+		ac.registerBeanDefinition("valueBean", bd);
 		ac.registerBeanDefinition("conversionService", new RootBeanDefinition(FormattingConversionServiceFactoryBean.class));
 		ac.registerBeanDefinition("ppc", new RootBeanDefinition(PropertyPlaceholderConfigurer.class));
 		ac.refresh();
diff --git a/spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterTests.java b/spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterTests.java
index 83011aec3b..26b0af991d 100644
--- a/spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterTests.java
+++ b/spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterTests.java
@@ -37,7 +37,7 @@ import org.springframework.aop.framework.ProxyFactory;
 import org.springframework.beans.TestBean;
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.jmx.AbstractMBeanServerTests;
 import org.springframework.jmx.IJmxTestBean;
@@ -155,7 +155,8 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
 	}
 
 	public void testAutodetectMBeans() throws Exception {
-		XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("autodetectMBeans.xml", getClass()));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("autodetectMBeans.xml", getClass()));
 		try {
 			bf.getBean("exporter");
 			MBeanServer server = (MBeanServer) bf.getBean("server");
@@ -171,7 +172,8 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
 	}
 
 	public void testAutodetectWithExclude() throws Exception {
-		XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("autodetectMBeans.xml", getClass()));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("autodetectMBeans.xml", getClass()));
 		try {
 			bf.getBean("exporter");
 			MBeanServer server = (MBeanServer) bf.getBean("server");
@@ -189,7 +191,8 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
 	}
 
 	public void testAutodetectLazyMBeans() throws Exception {
-		XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("autodetectLazyMBeans.xml", getClass()));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("autodetectLazyMBeans.xml", getClass()));
 		try {
 			bf.getBean("exporter");
 			MBeanServer server = (MBeanServer) bf.getBean("server");
@@ -209,7 +212,8 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
 	}
 
 	public void testAutodetectNoMBeans() throws Exception {
-		XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("autodetectNoMBeans.xml", getClass()));
+		DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+		new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("autodetectNoMBeans.xml", getClass()));
 		try {
 			bf.getBean("exporter");
 		} finally {
diff --git a/spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java b/spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java
index d4be14d47b..60f96bdb17 100644
--- a/spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java
+++ b/spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java
@@ -22,8 +22,8 @@ import java.util.concurrent.atomic.AtomicInteger;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.springframework.build.junit.Assume;
-import org.springframework.build.junit.TestGroup;
+import org.springframework.tests.Assume;
+import org.springframework.tests.TestGroup;
 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
diff --git a/spring-context/src/test/java/org/springframework/scheduling/backportconcurrent/ConcurrentTaskExecutorTests.java b/spring-context/src/test/java/org/springframework/scheduling/backportconcurrent/ConcurrentTaskExecutorTests.java
index 0d8729dfdf..eee6c1029a 100644
--- a/spring-context/src/test/java/org/springframework/scheduling/backportconcurrent/ConcurrentTaskExecutorTests.java
+++ b/spring-context/src/test/java/org/springframework/scheduling/backportconcurrent/ConcurrentTaskExecutorTests.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.
@@ -24,6 +24,7 @@ import org.springframework.core.task.NoOpRunnable;
  * @author Rick Evans
  * @author Juergen Hoeller
  */
+@Deprecated
 public class ConcurrentTaskExecutorTests extends TestCase {
 
 	public void testZeroArgCtorResultsInDefaultTaskExecutorBeingUsed() throws Exception {
diff --git a/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java b/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java
index f45f032382..e0945fab1d 100644
--- a/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java
+++ b/spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java
@@ -29,6 +29,7 @@ import org.springframework.scheduling.TestMethodInvokingTask;
  * @author Juergen Hoeller
  * @since 20.02.2004
  */
+@Deprecated
 public class TimerSupportTests extends TestCase {
 
 	public void testTimerFactoryBean() throws Exception {
diff --git a/spring-context/src/test/java/org/springframework/scheduling/timer/TimerTaskExecutorTests.java b/spring-context/src/test/java/org/springframework/scheduling/timer/TimerTaskExecutorTests.java
index 2469e55823..c9397abba4 100644
--- a/spring-context/src/test/java/org/springframework/scheduling/timer/TimerTaskExecutorTests.java
+++ b/spring-context/src/test/java/org/springframework/scheduling/timer/TimerTaskExecutorTests.java
@@ -28,6 +28,7 @@ import org.junit.Test;
  * @author Rick Evans
  * @author Chris Beams
  */
+@Deprecated
 public final class TimerTaskExecutorTests {
 
 	@Test(expected=IllegalArgumentException.class)
diff --git a/spring-context/src/test/java/org/springframework/scripting/jruby/JRubyScriptFactoryTests.java b/spring-context/src/test/java/org/springframework/scripting/jruby/JRubyScriptFactoryTests.java
index 962e72b766..dd338997f0 100644
--- a/spring-context/src/test/java/org/springframework/scripting/jruby/JRubyScriptFactoryTests.java
+++ b/spring-context/src/test/java/org/springframework/scripting/jruby/JRubyScriptFactoryTests.java
@@ -19,7 +19,6 @@ package org.springframework.scripting.jruby;
 import java.util.Map;
 
 import junit.framework.TestCase;
-import junit.framework.Assert;
 
 import org.springframework.aop.support.AopUtils;
 import org.springframework.aop.target.dynamic.Refreshable;
@@ -55,14 +54,14 @@ public class JRubyScriptFactoryTests extends TestCase {
 		assertFalse("Scripted object should not be instance of Refreshable", calc instanceof Refreshable);
 		assertFalse("Scripted object should not be instance of Refreshable", messenger instanceof Refreshable);
 
-		Assert.assertEquals(calc, calc);
-		Assert.assertEquals(messenger, messenger);
+		assertEquals(calc, calc);
+		assertEquals(messenger, messenger);
 		assertTrue(!messenger.equals(calc));
 		assertNotSame(messenger.hashCode(), calc.hashCode());
 		assertTrue(!messenger.toString().equals(calc.toString()));
 
 		String desiredMessage = "Hello World!";
-		Assert.assertEquals("Message is incorrect", desiredMessage, messenger.getMessage());
+		assertEquals("Message is incorrect", desiredMessage, messenger.getMessage());
 	}
 
 	public void testNonStaticScript() throws Exception {
@@ -73,12 +72,12 @@ public class JRubyScriptFactoryTests extends TestCase {
 		assertTrue("Should be an instance of Refreshable", messenger instanceof Refreshable);
 
 		String desiredMessage = "Hello World!";
-		Assert.assertEquals("Message is incorrect.", desiredMessage, messenger.getMessage());
+		assertEquals("Message is incorrect.", desiredMessage, messenger.getMessage());
 
 		Refreshable refreshable = (Refreshable) messenger;
 		refreshable.refresh();
 
-		Assert.assertEquals("Message is incorrect after refresh.", desiredMessage, messenger.getMessage());
+		assertEquals("Message is incorrect after refresh.", desiredMessage, messenger.getMessage());
 		assertEquals("Incorrect refresh count", 2, refreshable.getRefreshCount());
 	}
 
@@ -142,14 +141,14 @@ public class JRubyScriptFactoryTests extends TestCase {
 		TestBean testBean = (TestBean) ctx.getBean("testBean");
 
 		Messenger messenger = (Messenger) ctx.getBean("messenger");
-		Assert.assertEquals("Hello World!", messenger.getMessage());
+		assertEquals("Hello World!", messenger.getMessage());
 		assertFalse(messenger instanceof Refreshable);
 
 		TestBeanAwareMessenger messengerByType = (TestBeanAwareMessenger) ctx.getBean("messengerByType");
-		Assert.assertEquals(testBean, messengerByType.getTestBean());
+		assertEquals(testBean, messengerByType.getTestBean());
 
 		TestBeanAwareMessenger messengerByName = (TestBeanAwareMessenger) ctx.getBean("messengerByName");
-		Assert.assertEquals(testBean, messengerByName.getTestBean());
+		assertEquals(testBean, messengerByName.getTestBean());
 	}
 
 	public void testPrototypeScriptFromTag() throws Exception {
@@ -159,12 +158,12 @@ public class JRubyScriptFactoryTests extends TestCase {
 
 		assertNotSame(messenger, messenger2);
 		assertSame(messenger.getClass(), messenger2.getClass());
-		Assert.assertEquals("Hello World!", messenger.getMessage());
-		Assert.assertEquals("Hello World!", messenger2.getMessage());
+		assertEquals("Hello World!", messenger.getMessage());
+		assertEquals("Hello World!", messenger2.getMessage());
 		messenger.setMessage("Bye World!");
 		messenger2.setMessage("Byebye World!");
-		Assert.assertEquals("Bye World!", messenger.getMessage());
-		Assert.assertEquals("Byebye World!", messenger2.getMessage());
+		assertEquals("Bye World!", messenger.getMessage());
+		assertEquals("Byebye World!", messenger2.getMessage());
 	}
 
 	public void testInlineScriptFromTag() throws Exception {
@@ -177,18 +176,18 @@ public class JRubyScriptFactoryTests extends TestCase {
 	public void testRefreshableFromTag() throws Exception {
 		ApplicationContext ctx = new ClassPathXmlApplicationContext("jruby-with-xsd.xml", getClass());
 		Messenger messenger = (Messenger) ctx.getBean("refreshableMessenger");
-		Assert.assertEquals("Hello World!", messenger.getMessage());
+		assertEquals("Hello World!", messenger.getMessage());
 		assertTrue("Messenger should be Refreshable", messenger instanceof Refreshable);
 	}
 
 	public void testThatMultipleScriptInterfacesAreSupported() throws Exception {
 		ApplicationContext ctx = new ClassPathXmlApplicationContext("jruby-with-xsd.xml", getClass());
 		Messenger messenger = (Messenger) ctx.getBean("calculatingMessenger");
-		Assert.assertEquals("Hello World!", messenger.getMessage());
+		assertEquals("Hello World!", messenger.getMessage());
 
 		// cool, now check that the Calculator interface is also exposed
 		Calculator calc = (Calculator) messenger;
-		Assert.assertEquals(0, calc.add(2, -2));
+		assertEquals(0, calc.add(2, -2));
 	}
 
 	public void testWithComplexArg() throws Exception {
@@ -270,7 +269,7 @@ public class JRubyScriptFactoryTests extends TestCase {
 	public void testAOP() throws Exception {
 		ApplicationContext ctx = new ClassPathXmlApplicationContext("jruby-aop.xml", getClass());
 		Messenger messenger = (Messenger) ctx.getBean("messenger");
-		Assert.assertEquals(new StringBuffer("Hello World!").reverse().toString(), messenger.getMessage());
+		assertEquals(new StringBuffer("Hello World!").reverse().toString(), messenger.getMessage());
 	}
 
 
diff --git a/spring-context/src/test/java/org/springframework/scripting/support/ScriptFactoryPostProcessorTests.java b/spring-context/src/test/java/org/springframework/scripting/support/ScriptFactoryPostProcessorTests.java
index 47b6581727..17272b825a 100644
--- a/spring-context/src/test/java/org/springframework/scripting/support/ScriptFactoryPostProcessorTests.java
+++ b/spring-context/src/test/java/org/springframework/scripting/support/ScriptFactoryPostProcessorTests.java
@@ -205,7 +205,7 @@ public class ScriptFactoryPostProcessorTests extends TestCase {
 		ctx.registerBeanDefinition("messenger", BeanDefinitionBuilder.rootBeanDefinition(StubMessenger.class).getBeanDefinition());
 
 		BeanDefinitionBuilder scriptedBeanBuilder = BeanDefinitionBuilder.rootBeanDefinition(GroovyScriptFactory.class);
-		scriptedBeanBuilder.setSingleton(false);
+		scriptedBeanBuilder.setScope(BeanDefinition.SCOPE_PROTOTYPE);
 		scriptedBeanBuilder.addConstructorArgValue(DELEGATING_SCRIPT);
 		scriptedBeanBuilder.addPropertyReference("messenger", "messenger");
 
diff --git a/spring-context/src/test/java/org/springframework/validation/DataBinderFieldAccessTests.java b/spring-context/src/test/java/org/springframework/validation/DataBinderFieldAccessTests.java
index 543999cc89..e64219c59c 100644
--- a/spring-context/src/test/java/org/springframework/validation/DataBinderFieldAccessTests.java
+++ b/spring-context/src/test/java/org/springframework/validation/DataBinderFieldAccessTests.java
@@ -20,7 +20,6 @@ import java.beans.PropertyEditorSupport;
 import java.util.Map;
 
 import junit.framework.TestCase;
-import junit.framework.Assert;
 
 import org.springframework.beans.FieldAccessBean;
 import org.springframework.beans.MutablePropertyValues;
@@ -106,7 +105,7 @@ public class DataBinderFieldAccessTests extends TestCase {
 			assertTrue("Correct number of age errors", br.getFieldErrorCount("age") == 1);
 			assertEquals("32x", binder.getBindingResult().getFieldValue("age"));
 			assertEquals("32x", binder.getBindingResult().getFieldError("age").getRejectedValue());
-			Assert.assertEquals(0, tb.getAge());
+			assertEquals(0, tb.getAge());
 		}
 	}
 
@@ -152,7 +151,7 @@ public class DataBinderFieldAccessTests extends TestCase {
 			assertTrue("Correct number of age errors", br.getFieldErrorCount("age") == 1);
 			assertEquals("32x", binder.getBindingResult().getFieldValue("age"));
 			assertEquals("32x", binder.getBindingResult().getFieldError("age").getRejectedValue());
-			Assert.assertEquals(0, tb.getAge());
+			assertEquals(0, tb.getAge());
 
 			assertTrue("Does not have spouse errors", !br.hasFieldErrors("spouse"));
 			assertEquals("Kerry", binder.getBindingResult().getFieldValue("spouse"));
diff --git a/spring-core/src/test/java/org/springframework/core/CollectionFactoryTests.java b/spring-core/src/test/java/org/springframework/core/CollectionFactoryTests.java
index 3e7d144b5c..45b27e2dc4 100644
--- a/spring-core/src/test/java/org/springframework/core/CollectionFactoryTests.java
+++ b/spring-core/src/test/java/org/springframework/core/CollectionFactoryTests.java
@@ -33,21 +33,25 @@ import org.springframework.util.MultiValueMap;
  */
 public class CollectionFactoryTests extends TestCase {
 
+	@SuppressWarnings("deprecation")
 	public void testLinkedSet() {
 		Set set = CollectionFactory.createLinkedSetIfPossible(16);
 		assertTrue(set instanceof LinkedHashSet);
 	}
 
+	@SuppressWarnings("deprecation")
 	public void testLinkedMap() {
 		Map map = CollectionFactory.createLinkedMapIfPossible(16);
 		assertTrue(map instanceof LinkedHashMap);
 	}
 
+	@SuppressWarnings("deprecation")
 	public void testIdentityMap() {
 		Map map = CollectionFactory.createIdentityMapIfPossible(16);
 		assertTrue(map instanceof IdentityHashMap);
 	}
 
+	@SuppressWarnings("deprecation")
 	public void testConcurrentMap() {
 		Map map = CollectionFactory.createConcurrentMapIfPossible(16);
 		assertTrue(map.getClass().getName().endsWith("ConcurrentHashMap"));
@@ -58,6 +62,7 @@ public class CollectionFactoryTests extends TestCase {
 		assertTrue(map.getClass().getName().endsWith("MultiValueMap"));
 	}
 
+	@SuppressWarnings("deprecation")
 	public void testConcurrentMapWithExplicitInterface() {
 		ConcurrentMap map = CollectionFactory.createConcurrentMap(16);
 		assertTrue(map.getClass().getSuperclass().getName().endsWith("ConcurrentHashMap"));
diff --git a/spring-core/src/test/java/org/springframework/core/GenericCollectionTypeResolverTests.java b/spring-core/src/test/java/org/springframework/core/GenericCollectionTypeResolverTests.java
index c7e2b7e620..bb70889aae 100644
--- a/spring-core/src/test/java/org/springframework/core/GenericCollectionTypeResolverTests.java
+++ b/spring-core/src/test/java/org/springframework/core/GenericCollectionTypeResolverTests.java
@@ -25,8 +25,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import junit.framework.Assert;
-
 import org.springframework.beans.GenericBean;
 import org.springframework.core.io.Resource;
 
@@ -96,11 +94,11 @@ public class GenericCollectionTypeResolverTests extends AbstractGenericsTests {
 
 	public void testProgrammaticListIntrospection() throws Exception {
 		Method setter = GenericBean.class.getMethod("setResourceList", List.class);
-		Assert.assertEquals(Resource.class,
+		assertEquals(Resource.class,
 				GenericCollectionTypeResolver.getCollectionParameterType(new MethodParameter(setter, 0)));
 
 		Method getter = GenericBean.class.getMethod("getResourceList");
-		Assert.assertEquals(Resource.class,
+		assertEquals(Resource.class,
 				GenericCollectionTypeResolver.getCollectionReturnType(getter));
 	}
 
diff --git a/spring-core/src/test/java/org/springframework/core/NestedExceptionTests.java b/spring-core/src/test/java/org/springframework/core/NestedExceptionTests.java
index 12046e979d..dff4290936 100644
--- a/spring-core/src/test/java/org/springframework/core/NestedExceptionTests.java
+++ b/spring-core/src/test/java/org/springframework/core/NestedExceptionTests.java
@@ -20,7 +20,6 @@ import java.io.ByteArrayOutputStream;
 import java.io.PrintWriter;
 
 import junit.framework.TestCase;
-import junit.framework.Assert;
 
 /**
  * @author Rod Johnson
@@ -52,7 +51,7 @@ public class NestedExceptionTests extends TestCase {
 		Exception rootCause = new Exception(rootCauseMesg);
 		// Making a class abstract doesn't _really_ prevent instantiation :-)
 		NestedRuntimeException nex = new NestedRuntimeException(myMessage, rootCause) {};
-		Assert.assertEquals(nex.getCause(), rootCause);
+		assertEquals(nex.getCause(), rootCause);
 		assertTrue(nex.getMessage().indexOf(myMessage) != -1);
 		assertTrue(nex.getMessage().indexOf(rootCauseMesg) != -1);
 
@@ -90,7 +89,7 @@ public class NestedExceptionTests extends TestCase {
 		Exception rootCause = new Exception(rootCauseMesg);
 		// Making a class abstract doesn't _really_ prevent instantiation :-)
 		NestedCheckedException nex = new NestedCheckedException(myMessage, rootCause) {};
-		Assert.assertEquals(nex.getCause(), rootCause);
+		assertEquals(nex.getCause(), rootCause);
 		assertTrue(nex.getMessage().indexOf(myMessage) != -1);
 		assertTrue(nex.getMessage().indexOf(rootCauseMesg) != -1);
 
diff --git a/spring-core/src/test/java/org/springframework/core/convert/support/DefaultConversionTests.java b/spring-core/src/test/java/org/springframework/core/convert/support/DefaultConversionTests.java
index 2e4f86cb0c..3dde490705 100644
--- a/spring-core/src/test/java/org/springframework/core/convert/support/DefaultConversionTests.java
+++ b/spring-core/src/test/java/org/springframework/core/convert/support/DefaultConversionTests.java
@@ -401,7 +401,7 @@ public class DefaultConversionTests {
 	public void convertArrayToObjectAssignableTargetType() {
 		Long[] array = new Long[] { 3L };
 		Long[] result = (Long[]) conversionService.convert(array, Object.class);
-		assertEquals(array, result);
+		assertArrayEquals(array, result);
 	}
 
 	@Test
diff --git a/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java b/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java
index fadd6933a7..01dd03c770 100644
--- a/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java
+++ b/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java
@@ -35,8 +35,6 @@ import java.util.UUID;
 
 import org.junit.Test;
 
-import org.springframework.build.junit.Assume;
-import org.springframework.build.junit.TestGroup;
 import org.springframework.core.convert.ConversionFailedException;
 import org.springframework.core.convert.ConverterNotFoundException;
 import org.springframework.core.convert.TypeDescriptor;
@@ -46,6 +44,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.tests.Assume;
+import org.springframework.tests.TestGroup;
 import org.springframework.util.StopWatch;
 import org.springframework.util.StringUtils;
 
diff --git a/spring-core/src/test/java/org/springframework/core/enums/LabeledEnumTests.java b/spring-core/src/test/java/org/springframework/core/enums/LabeledEnumTests.java
index 04b5ad53a5..4bd9a3f182 100644
--- a/spring-core/src/test/java/org/springframework/core/enums/LabeledEnumTests.java
+++ b/spring-core/src/test/java/org/springframework/core/enums/LabeledEnumTests.java
@@ -29,6 +29,7 @@ import junit.framework.TestCase;
  * @author Juergen Hoeller
  * @author Sam Brannen
  */
+@Deprecated
 public class LabeledEnumTests extends TestCase {
 
 	private byte[] serializeObject(final Object obj) throws IOException {
diff --git a/spring-core/src/test/java/org/springframework/core/io/support/ResourceArrayPropertyEditorTests.java b/spring-core/src/test/java/org/springframework/core/io/support/ResourceArrayPropertyEditorTests.java
index 19163fa17a..a12d2c0912 100644
--- a/spring-core/src/test/java/org/springframework/core/io/support/ResourceArrayPropertyEditorTests.java
+++ b/spring-core/src/test/java/org/springframework/core/io/support/ResourceArrayPropertyEditorTests.java
@@ -21,6 +21,7 @@ import java.beans.PropertyEditor;
 import static org.junit.Assert.*;
 import org.junit.Test;
 
+import org.springframework.core.env.StandardEnvironment;
 import org.springframework.core.io.Resource;
 
 /**
@@ -67,7 +68,9 @@ public class ResourceArrayPropertyEditorTests {
 
 	@Test(expected=IllegalArgumentException.class)
 	public void testStrictSystemPropertyReplacement() {
-		PropertyEditor editor = new ResourceArrayPropertyEditor(new PathMatchingResourcePatternResolver(), false);
+		PropertyEditor editor = new ResourceArrayPropertyEditor(
+				new PathMatchingResourcePatternResolver(), new StandardEnvironment(),
+				false);
 		System.setProperty("test.prop", "foo");
 		try {
 			editor.setAsText("${test.prop}-${bar}");
diff --git a/spring-core/src/test/java/org/springframework/core/style/ToStringCreatorTests.java b/spring-core/src/test/java/org/springframework/core/style/ToStringCreatorTests.java
index 49650303b8..f353d34fb1 100644
--- a/spring-core/src/test/java/org/springframework/core/style/ToStringCreatorTests.java
+++ b/spring-core/src/test/java/org/springframework/core/style/ToStringCreatorTests.java
@@ -17,13 +17,14 @@
 package org.springframework.core.style;
 
 import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import junit.framework.TestCase;
 
-import org.springframework.core.CollectionFactory;
 import org.springframework.util.ObjectUtils;
 
 /**
@@ -65,7 +66,7 @@ public class ToStringCreatorTests extends TestCase {
 	}
 
 	private Map getMap() {
-		Map map = CollectionFactory.createLinkedMapIfPossible(3);
+		Map map = new LinkedHashMap(3);
 		map.put("Keri", "Softball");
 		map.put("Scot", "Fishing");
 		map.put("Keith", "Flag Football");
@@ -96,7 +97,7 @@ public class ToStringCreatorTests extends TestCase {
 	}
 
 	public void testSet() {
-		Set set = CollectionFactory.createLinkedSetIfPossible(3);
+		Set set = new LinkedHashSet<>(3);
 		set.add(s1);
 		set.add(s2);
 		set.add(s3);
diff --git a/spring-build-junit/src/main/java/org/springframework/build/junit/Assume.java b/spring-core/src/test/java/org/springframework/tests/Assume.java
similarity index 91%
rename from spring-build-junit/src/main/java/org/springframework/build/junit/Assume.java
rename to spring-core/src/test/java/org/springframework/tests/Assume.java
index 7b916d0b59..801cd93ad7 100644
--- a/spring-build-junit/src/main/java/org/springframework/build/junit/Assume.java
+++ b/spring-core/src/test/java/org/springframework/tests/Assume.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2013 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package org.springframework.build.junit;
+package org.springframework.tests;
 
 import static org.junit.Assume.assumeFalse;
 
@@ -24,8 +24,9 @@ import org.apache.commons.logging.Log;
 import org.junit.internal.AssumptionViolatedException;
 
 /**
- * Provides utility methods that allow JUnit tests to {@link Assume} certain conditions
- * hold {@code true}. If the assumption fails, it means the test should be skipped.
+ * Provides utility methods that allow JUnit tests to {@link org.junit.Assume} certain
+ * conditions hold {@code true}. If the assumption fails, it means the test should be
+ * skipped.
  *
  * 

For example, if a set of tests require at least JDK 1.7 it can use * {@code Assume#atLeast(JdkVersion.JAVA_17)} as shown below: diff --git a/spring-build-junit/src/main/java/org/springframework/build/junit/JavaVersion.java b/spring-core/src/test/java/org/springframework/tests/JavaVersion.java similarity index 95% rename from spring-build-junit/src/main/java/org/springframework/build/junit/JavaVersion.java rename to spring-core/src/test/java/org/springframework/tests/JavaVersion.java index db9fee370f..b36319b2c4 100644 --- a/spring-build-junit/src/main/java/org/springframework/build/junit/JavaVersion.java +++ b/spring-core/src/test/java/org/springframework/tests/JavaVersion.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.build.junit; +package org.springframework.tests; /** * Enumeration of known JDK versions. diff --git a/spring-build-junit/src/test/java/org/springframework/build/junit/JavaVersionTest.java b/spring-core/src/test/java/org/springframework/tests/JavaVersionTests.java similarity index 90% rename from spring-build-junit/src/test/java/org/springframework/build/junit/JavaVersionTest.java rename to spring-core/src/test/java/org/springframework/tests/JavaVersionTests.java index 1600d4ca19..82b51e0014 100644 --- a/spring-build-junit/src/test/java/org/springframework/build/junit/JavaVersionTest.java +++ b/spring-core/src/test/java/org/springframework/tests/JavaVersionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.build.junit; +package org.springframework.tests; import static org.hamcrest.Matchers.startsWith; import static org.junit.Assert.*; @@ -26,7 +26,7 @@ import org.junit.Test; * * @author Phillip Webb */ -public class JavaVersionTest { +public class JavaVersionTests { @Test public void runningVersion() { diff --git a/spring-jdbc/src/test/java/org/springframework/build/test/hamcrest/Matchers.java b/spring-core/src/test/java/org/springframework/tests/Matchers.java similarity index 97% rename from spring-jdbc/src/test/java/org/springframework/build/test/hamcrest/Matchers.java rename to spring-core/src/test/java/org/springframework/tests/Matchers.java index 7bb3744d60..826bd1c732 100644 --- a/spring-jdbc/src/test/java/org/springframework/build/test/hamcrest/Matchers.java +++ b/spring-core/src/test/java/org/springframework/tests/Matchers.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.build.test.hamcrest; +package org.springframework.tests; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; diff --git a/spring-core/src/test/java/org/springframework/build/test/mockito/MockitoUtils.java b/spring-core/src/test/java/org/springframework/tests/MockitoUtils.java similarity index 97% rename from spring-core/src/test/java/org/springframework/build/test/mockito/MockitoUtils.java rename to spring-core/src/test/java/org/springframework/tests/MockitoUtils.java index 63d4524987..0fb20f3010 100644 --- a/spring-core/src/test/java/org/springframework/build/test/mockito/MockitoUtils.java +++ b/spring-core/src/test/java/org/springframework/tests/MockitoUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.build.test.mockito; +package org.springframework.tests; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; diff --git a/spring-build-junit/src/main/java/org/springframework/build/junit/TestGroup.java b/spring-core/src/test/java/org/springframework/tests/TestGroup.java similarity index 94% rename from spring-build-junit/src/main/java/org/springframework/build/junit/TestGroup.java rename to spring-core/src/test/java/org/springframework/tests/TestGroup.java index 3be8b83514..638c5b861b 100644 --- a/spring-build-junit/src/main/java/org/springframework/build/junit/TestGroup.java +++ b/spring-core/src/test/java/org/springframework/tests/TestGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.build.junit; +package org.springframework.tests; import java.util.Collections; import java.util.EnumSet; diff --git a/spring-build-junit/src/test/java/org/springframework/build/junit/TestGroupTest.java b/spring-core/src/test/java/org/springframework/tests/TestGroupTests.java similarity index 94% rename from spring-build-junit/src/test/java/org/springframework/build/junit/TestGroupTest.java rename to spring-core/src/test/java/org/springframework/tests/TestGroupTests.java index 2b30f29931..2b4860fd72 100644 --- a/spring-build-junit/src/test/java/org/springframework/build/junit/TestGroupTest.java +++ b/spring-core/src/test/java/org/springframework/tests/TestGroupTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.build.junit; +package org.springframework.tests; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; @@ -32,7 +32,7 @@ import org.junit.rules.ExpectedException; * * @author Phillip Webb */ -public class TestGroupTest { +public class TestGroupTests { @Rule public ExpectedException thrown = ExpectedException.none(); diff --git a/spring-core/src/test/java/org/springframework/tests/package-info.java b/spring-core/src/test/java/org/springframework/tests/package-info.java new file mode 100644 index 0000000000..545c413c98 --- /dev/null +++ b/spring-core/src/test/java/org/springframework/tests/package-info.java @@ -0,0 +1,22 @@ +/* + * Copyright 2002-2013 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 + * + * http://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. + */ + +/** + * Shared utilities that are used internally throughout the test suite but are not + * published. This package should not be confused with {@code org.springframework.test} + * which contains published code from the 'spring-test' module. + */ +package org.springframework.tests; diff --git a/spring-core/src/test/java/org/springframework/util/AutoPopulatingListTests.java b/spring-core/src/test/java/org/springframework/util/AutoPopulatingListTests.java index 6eb67d0661..ff97d15d92 100644 --- a/spring-core/src/test/java/org/springframework/util/AutoPopulatingListTests.java +++ b/spring-core/src/test/java/org/springframework/util/AutoPopulatingListTests.java @@ -19,7 +19,6 @@ package org.springframework.util; import java.util.LinkedList; import junit.framework.*; -import junit.framework.Assert; import org.springframework.beans.TestBean; @@ -72,14 +71,14 @@ public class AutoPopulatingListTests extends TestCase { for(int x = 0; x < list.size(); x++) { Object element = list.get(x); if(element instanceof TestBean) { - junit.framework.Assert.assertEquals(x, ((TestBean) element).getAge()); + assertEquals(x, ((TestBean) element).getAge()); } } } public void testSerialization() throws Exception { AutoPopulatingList list = new AutoPopulatingList(TestBean.class); - Assert.assertEquals(list, SerializationTestUtils.serializeAndDeserialize(list)); + assertEquals(list, SerializationTestUtils.serializeAndDeserialize(list)); } diff --git a/spring-core/src/test/java/org/springframework/util/CachingMapDecoratorTests.java b/spring-core/src/test/java/org/springframework/util/CachingMapDecoratorTests.java index 4f87898432..8e6dcc566d 100644 --- a/spring-core/src/test/java/org/springframework/util/CachingMapDecoratorTests.java +++ b/spring-core/src/test/java/org/springframework/util/CachingMapDecoratorTests.java @@ -27,6 +27,7 @@ import junit.framework.TestCase; * @author Keith Donald * @author Juergen Hoeller */ +@Deprecated public class CachingMapDecoratorTests extends TestCase { public void testValidCache() { diff --git a/spring-core/src/test/java/org/springframework/util/ClassUtilsTests.java b/spring-core/src/test/java/org/springframework/util/ClassUtilsTests.java index 39761fb5de..e8ab847406 100644 --- a/spring-core/src/test/java/org/springframework/util/ClassUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/ClassUtilsTests.java @@ -41,6 +41,8 @@ import org.springframework.beans.TestBean; */ public class ClassUtilsTests extends TestCase { + private ClassLoader classLoader = getClass().getClassLoader(); + @Override public void setUp() { InnerClass.noArgCalled = false; @@ -49,56 +51,56 @@ public class ClassUtilsTests extends TestCase { } public void testIsPresent() throws Exception { - assertTrue(ClassUtils.isPresent("java.lang.String")); - assertFalse(ClassUtils.isPresent("java.lang.MySpecialString")); + assertTrue(ClassUtils.isPresent("java.lang.String", classLoader)); + assertFalse(ClassUtils.isPresent("java.lang.MySpecialString", classLoader)); } public void testForName() throws ClassNotFoundException { - assertEquals(String.class, ClassUtils.forName("java.lang.String")); - assertEquals(String[].class, ClassUtils.forName("java.lang.String[]")); - assertEquals(String[].class, ClassUtils.forName(String[].class.getName())); - assertEquals(String[][].class, ClassUtils.forName(String[][].class.getName())); - assertEquals(String[][][].class, ClassUtils.forName(String[][][].class.getName())); - assertEquals(TestBean.class, ClassUtils.forName("org.springframework.beans.TestBean")); - assertEquals(TestBean[].class, ClassUtils.forName("org.springframework.beans.TestBean[]")); - assertEquals(TestBean[].class, ClassUtils.forName(TestBean[].class.getName())); - assertEquals(TestBean[][].class, ClassUtils.forName("org.springframework.beans.TestBean[][]")); - assertEquals(TestBean[][].class, ClassUtils.forName(TestBean[][].class.getName())); - assertEquals(short[][][].class, ClassUtils.forName("[[[S")); + assertEquals(String.class, ClassUtils.forName("java.lang.String", classLoader)); + assertEquals(String[].class, ClassUtils.forName("java.lang.String[]", classLoader)); + assertEquals(String[].class, ClassUtils.forName(String[].class.getName(), classLoader)); + assertEquals(String[][].class, ClassUtils.forName(String[][].class.getName(), classLoader)); + assertEquals(String[][][].class, ClassUtils.forName(String[][][].class.getName(), classLoader)); + assertEquals(TestBean.class, ClassUtils.forName("org.springframework.beans.TestBean", classLoader)); + assertEquals(TestBean[].class, ClassUtils.forName("org.springframework.beans.TestBean[]", classLoader)); + assertEquals(TestBean[].class, ClassUtils.forName(TestBean[].class.getName(), classLoader)); + assertEquals(TestBean[][].class, ClassUtils.forName("org.springframework.beans.TestBean[][]", classLoader)); + assertEquals(TestBean[][].class, ClassUtils.forName(TestBean[][].class.getName(), classLoader)); + assertEquals(short[][][].class, ClassUtils.forName("[[[S", classLoader)); } public void testForNameWithPrimitiveClasses() throws ClassNotFoundException { - assertEquals(boolean.class, ClassUtils.forName("boolean")); - assertEquals(byte.class, ClassUtils.forName("byte")); - assertEquals(char.class, ClassUtils.forName("char")); - assertEquals(short.class, ClassUtils.forName("short")); - assertEquals(int.class, ClassUtils.forName("int")); - assertEquals(long.class, ClassUtils.forName("long")); - assertEquals(float.class, ClassUtils.forName("float")); - assertEquals(double.class, ClassUtils.forName("double")); - assertEquals(void.class, ClassUtils.forName("void")); + assertEquals(boolean.class, ClassUtils.forName("boolean", classLoader)); + assertEquals(byte.class, ClassUtils.forName("byte", classLoader)); + assertEquals(char.class, ClassUtils.forName("char", classLoader)); + assertEquals(short.class, ClassUtils.forName("short", classLoader)); + assertEquals(int.class, ClassUtils.forName("int", classLoader)); + assertEquals(long.class, ClassUtils.forName("long", classLoader)); + assertEquals(float.class, ClassUtils.forName("float", classLoader)); + assertEquals(double.class, ClassUtils.forName("double", classLoader)); + assertEquals(void.class, ClassUtils.forName("void", classLoader)); } public void testForNameWithPrimitiveArrays() throws ClassNotFoundException { - assertEquals(boolean[].class, ClassUtils.forName("boolean[]")); - assertEquals(byte[].class, ClassUtils.forName("byte[]")); - assertEquals(char[].class, ClassUtils.forName("char[]")); - assertEquals(short[].class, ClassUtils.forName("short[]")); - assertEquals(int[].class, ClassUtils.forName("int[]")); - assertEquals(long[].class, ClassUtils.forName("long[]")); - assertEquals(float[].class, ClassUtils.forName("float[]")); - assertEquals(double[].class, ClassUtils.forName("double[]")); + assertEquals(boolean[].class, ClassUtils.forName("boolean[]", classLoader)); + assertEquals(byte[].class, ClassUtils.forName("byte[]", classLoader)); + assertEquals(char[].class, ClassUtils.forName("char[]", classLoader)); + assertEquals(short[].class, ClassUtils.forName("short[]", classLoader)); + assertEquals(int[].class, ClassUtils.forName("int[]", classLoader)); + assertEquals(long[].class, ClassUtils.forName("long[]", classLoader)); + assertEquals(float[].class, ClassUtils.forName("float[]", classLoader)); + assertEquals(double[].class, ClassUtils.forName("double[]", classLoader)); } public void testForNameWithPrimitiveArraysInternalName() throws ClassNotFoundException { - assertEquals(boolean[].class, ClassUtils.forName(boolean[].class.getName())); - assertEquals(byte[].class, ClassUtils.forName(byte[].class.getName())); - assertEquals(char[].class, ClassUtils.forName(char[].class.getName())); - assertEquals(short[].class, ClassUtils.forName(short[].class.getName())); - assertEquals(int[].class, ClassUtils.forName(int[].class.getName())); - assertEquals(long[].class, ClassUtils.forName(long[].class.getName())); - assertEquals(float[].class, ClassUtils.forName(float[].class.getName())); - assertEquals(double[].class, ClassUtils.forName(double[].class.getName())); + assertEquals(boolean[].class, ClassUtils.forName(boolean[].class.getName(), classLoader)); + assertEquals(byte[].class, ClassUtils.forName(byte[].class.getName(), classLoader)); + assertEquals(char[].class, ClassUtils.forName(char[].class.getName(), classLoader)); + assertEquals(short[].class, ClassUtils.forName(short[].class.getName(), classLoader)); + assertEquals(int[].class, ClassUtils.forName(int[].class.getName(), classLoader)); + assertEquals(long[].class, ClassUtils.forName(long[].class.getName(), classLoader)); + assertEquals(float[].class, ClassUtils.forName(float[].class.getName(), classLoader)); + assertEquals(double[].class, ClassUtils.forName(double[].class.getName(), classLoader)); } public void testGetShortName() { diff --git a/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxXMLReaderTestCase.java b/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxXMLReaderTestCase.java index fab4424ebe..0c3b9f0e49 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxXMLReaderTestCase.java +++ b/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxXMLReaderTestCase.java @@ -31,10 +31,10 @@ import org.junit.Before; import org.junit.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import org.springframework.build.test.mockito.MockitoUtils; -import org.springframework.build.test.mockito.MockitoUtils.InvocationArgumentsAdapter; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; +import org.springframework.tests.MockitoUtils; +import org.springframework.tests.MockitoUtils.InvocationArgumentsAdapter; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; diff --git a/spring-core/src/test/java/org/springframework/util/xml/StaxSourceTests.java b/spring-core/src/test/java/org/springframework/util/xml/StaxSourceTests.java index a2b668fa6d..638b997bc0 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/StaxSourceTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/StaxSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 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. @@ -16,8 +16,13 @@ package org.springframework.util.xml; +import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + import java.io.StringReader; import java.io.StringWriter; + import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.stream.XMLEventReader; @@ -28,7 +33,6 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.stream.StreamResult; -import static org.custommonkey.xmlunit.XMLAssert.*; import org.junit.Before; import org.junit.Test; import org.w3c.dom.Document; @@ -101,4 +105,4 @@ public class StaxSourceTests { transformer.transform(source, new DOMResult(result)); assertXMLEqual("Invalid result", expected, result); } -} \ No newline at end of file +} diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java index 6e112b0e01..97d87d50c3 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java @@ -311,15 +311,10 @@ public class ReflectivePropertyAccessor implements PropertyAccessor { */ protected Method findGetterForProperty(String propertyName, Class clazz, boolean mustBeStatic) { Method[] ms = clazz.getMethods(); - String propertyWriteMethodSuffix; - if (propertyName.length() > 1 && Character.isUpperCase(propertyName.charAt(1))) { - propertyWriteMethodSuffix = propertyName; - } - else { - propertyWriteMethodSuffix = StringUtils.capitalize(propertyName); - } + String propertyMethodSuffix = getPropertyMethodSuffix(propertyName); + // Try "get*" method... - String getterName = "get" + propertyWriteMethodSuffix; + String getterName = "get" + propertyMethodSuffix; for (Method method : ms) { if (!method.isBridge() && method.getName().equals(getterName) && method.getParameterTypes().length == 0 && (!mustBeStatic || Modifier.isStatic(method.getModifiers()))) { @@ -327,7 +322,7 @@ public class ReflectivePropertyAccessor implements PropertyAccessor { } } // Try "is*" method... - getterName = "is" + propertyWriteMethodSuffix; + getterName = "is" + propertyMethodSuffix; for (Method method : ms) { if (!method.isBridge() && method.getName().equals(getterName) && method.getParameterTypes().length == 0 && (boolean.class.equals(method.getReturnType()) || Boolean.class.equals(method.getReturnType())) && @@ -343,7 +338,7 @@ public class ReflectivePropertyAccessor implements PropertyAccessor { */ protected Method findSetterForProperty(String propertyName, Class clazz, boolean mustBeStatic) { Method[] methods = clazz.getMethods(); - String setterName = "set" + StringUtils.capitalize(propertyName); + String setterName = "set" + getPropertyMethodSuffix(propertyName); for (Method method : methods) { if (!method.isBridge() && method.getName().equals(setterName) && method.getParameterTypes().length == 1 && (!mustBeStatic || Modifier.isStatic(method.getModifiers()))) { @@ -353,6 +348,15 @@ public class ReflectivePropertyAccessor implements PropertyAccessor { return null; } + protected String getPropertyMethodSuffix(String propertyName) { + if (propertyName.length() > 1 && Character.isUpperCase(propertyName.charAt(1))) { + return propertyName; + } + else { + return StringUtils.capitalize(propertyName); + } + } + /** * Find a field of a certain name on a specified class */ diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/DefaultComparatorUnitTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/DefaultComparatorUnitTests.java index cf189ad6a1..0bdcb6f740 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/DefaultComparatorUnitTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/DefaultComparatorUnitTests.java @@ -15,7 +15,8 @@ */ package org.springframework.expression.spel; -import junit.framework.Assert; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import org.junit.Test; import org.springframework.expression.EvaluationException; @@ -33,57 +34,57 @@ public class DefaultComparatorUnitTests { public void testPrimitives() throws EvaluationException { TypeComparator comparator = new StandardTypeComparator(); // primitive int - Assert.assertTrue(comparator.compare(1, 2) < 0); - Assert.assertTrue(comparator.compare(1, 1) == 0); - Assert.assertTrue(comparator.compare(2, 1) > 0); + assertTrue(comparator.compare(1, 2) < 0); + assertTrue(comparator.compare(1, 1) == 0); + assertTrue(comparator.compare(2, 1) > 0); - Assert.assertTrue(comparator.compare(1.0d, 2) < 0); - Assert.assertTrue(comparator.compare(1.0d, 1) == 0); - Assert.assertTrue(comparator.compare(2.0d, 1) > 0); + assertTrue(comparator.compare(1.0d, 2) < 0); + assertTrue(comparator.compare(1.0d, 1) == 0); + assertTrue(comparator.compare(2.0d, 1) > 0); - Assert.assertTrue(comparator.compare(1.0f, 2) < 0); - Assert.assertTrue(comparator.compare(1.0f, 1) == 0); - Assert.assertTrue(comparator.compare(2.0f, 1) > 0); + assertTrue(comparator.compare(1.0f, 2) < 0); + assertTrue(comparator.compare(1.0f, 1) == 0); + assertTrue(comparator.compare(2.0f, 1) > 0); - Assert.assertTrue(comparator.compare(1L, 2) < 0); - Assert.assertTrue(comparator.compare(1L, 1) == 0); - Assert.assertTrue(comparator.compare(2L, 1) > 0); + assertTrue(comparator.compare(1L, 2) < 0); + assertTrue(comparator.compare(1L, 1) == 0); + assertTrue(comparator.compare(2L, 1) > 0); - Assert.assertTrue(comparator.compare(1, 2L) < 0); - Assert.assertTrue(comparator.compare(1, 1L) == 0); - Assert.assertTrue(comparator.compare(2, 1L) > 0); + assertTrue(comparator.compare(1, 2L) < 0); + assertTrue(comparator.compare(1, 1L) == 0); + assertTrue(comparator.compare(2, 1L) > 0); - Assert.assertTrue(comparator.compare(1L, 2L) < 0); - Assert.assertTrue(comparator.compare(1L, 1L) == 0); - Assert.assertTrue(comparator.compare(2L, 1L) > 0); + assertTrue(comparator.compare(1L, 2L) < 0); + assertTrue(comparator.compare(1L, 1L) == 0); + assertTrue(comparator.compare(2L, 1L) > 0); } @Test public void testNulls() throws EvaluationException { TypeComparator comparator = new StandardTypeComparator(); - Assert.assertTrue(comparator.compare(null,"abc")<0); - Assert.assertTrue(comparator.compare(null,null)==0); - Assert.assertTrue(comparator.compare("abc",null)>0); + assertTrue(comparator.compare(null,"abc")<0); + assertTrue(comparator.compare(null,null)==0); + assertTrue(comparator.compare("abc",null)>0); } @Test public void testObjects() throws EvaluationException { TypeComparator comparator = new StandardTypeComparator(); - Assert.assertTrue(comparator.compare("a","a")==0); - Assert.assertTrue(comparator.compare("a","b")<0); - Assert.assertTrue(comparator.compare("b","a")>0); + assertTrue(comparator.compare("a","a")==0); + assertTrue(comparator.compare("a","b")<0); + assertTrue(comparator.compare("b","a")>0); } @Test public void testCanCompare() throws EvaluationException { TypeComparator comparator = new StandardTypeComparator(); - Assert.assertTrue(comparator.canCompare(null,1)); - Assert.assertTrue(comparator.canCompare(1,null)); + assertTrue(comparator.canCompare(null,1)); + assertTrue(comparator.canCompare(1,null)); - Assert.assertTrue(comparator.canCompare(2,1)); - Assert.assertTrue(comparator.canCompare("abc","def")); - Assert.assertTrue(comparator.canCompare("abc",3)); - Assert.assertFalse(comparator.canCompare(String.class,3)); + assertTrue(comparator.canCompare(2,1)); + assertTrue(comparator.canCompare("abc","def")); + assertTrue(comparator.canCompare("abc",3)); + assertFalse(comparator.canCompare(String.class,3)); } } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionLanguageScenarioTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionLanguageScenarioTests.java index 388d26d026..1419f1da96 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionLanguageScenarioTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionLanguageScenarioTests.java @@ -16,6 +16,9 @@ package org.springframework.expression.spel; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + import java.awt.Color; import java.util.ArrayList; import java.util.Arrays; @@ -23,8 +26,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import junit.framework.Assert; - import org.junit.Test; import org.springframework.expression.AccessException; import org.springframework.expression.EvaluationContext; @@ -76,14 +77,14 @@ public class ExpressionLanguageScenarioTests extends ExpressionTestCase { // They are reusable value = expr.getValue(); - Assert.assertEquals("hello world", value); - Assert.assertEquals(String.class, value.getClass()); + assertEquals("hello world", value); + assertEquals(String.class, value.getClass()); } catch (EvaluationException ee) { ee.printStackTrace(); - Assert.fail("Unexpected Exception: " + ee.getMessage()); + fail("Unexpected Exception: " + ee.getMessage()); } catch (ParseException pe) { pe.printStackTrace(); - Assert.fail("Unexpected Exception: " + pe.getMessage()); + fail("Unexpected Exception: " + pe.getMessage()); } } @@ -103,16 +104,16 @@ public class ExpressionLanguageScenarioTests extends ExpressionTestCase { Expression expr = parser.parseRaw("#favouriteColour"); Object value = expr.getValue(ctx); - Assert.assertEquals("blue", value); + assertEquals("blue", value); expr = parser.parseRaw("#primes.get(1)"); value = expr.getValue(ctx); - Assert.assertEquals(3, value); + assertEquals(3, value); // all prime numbers > 10 from the list (using selection ?{...}) expr = parser.parseRaw("#primes.?[#this>10]"); value = expr.getValue(ctx); - Assert.assertEquals("[11, 13, 17]", value.toString()); + assertEquals("[11, 13, 17]", value.toString()); } @@ -141,30 +142,30 @@ public class ExpressionLanguageScenarioTests extends ExpressionTestCase { // read it, set it, read it again Expression expr = parser.parseRaw("str"); Object value = expr.getValue(ctx); - Assert.assertEquals("wibble", value); + assertEquals("wibble", value); expr = parser.parseRaw("str"); expr.setValue(ctx, "wobble"); expr = parser.parseRaw("str"); value = expr.getValue(ctx); - Assert.assertEquals("wobble", value); + assertEquals("wobble", value); // or using assignment within the expression expr = parser.parseRaw("str='wabble'"); value = expr.getValue(ctx); expr = parser.parseRaw("str"); value = expr.getValue(ctx); - Assert.assertEquals("wabble", value); + assertEquals("wabble", value); // private property will be accessed through getter() expr = parser.parseRaw("property"); value = expr.getValue(ctx); - Assert.assertEquals(42, value); + assertEquals(42, value); // ... and set through setter expr = parser.parseRaw("property=4"); value = expr.getValue(ctx); expr = parser.parseRaw("property"); value = expr.getValue(ctx); - Assert.assertEquals(4,value); + assertEquals(4,value); } public static String repeat(String s) { return s+s; } @@ -183,14 +184,14 @@ public class ExpressionLanguageScenarioTests extends ExpressionTestCase { Expression expr = parser.parseRaw("#repeat('hello')"); Object value = expr.getValue(ctx); - Assert.assertEquals("hellohello", value); + assertEquals("hellohello", value); } catch (EvaluationException ee) { ee.printStackTrace(); - Assert.fail("Unexpected Exception: " + ee.getMessage()); + fail("Unexpected Exception: " + ee.getMessage()); } catch (ParseException pe) { pe.printStackTrace(); - Assert.fail("Unexpected Exception: " + pe.getMessage()); + fail("Unexpected Exception: " + pe.getMessage()); } } @@ -207,13 +208,13 @@ public class ExpressionLanguageScenarioTests extends ExpressionTestCase { ctx.addPropertyAccessor(new FruitColourAccessor()); Expression expr = parser.parseRaw("orange"); Object value = expr.getValue(ctx); - Assert.assertEquals(Color.orange, value); + assertEquals(Color.orange, value); try { expr.setValue(ctx, Color.blue); - Assert.fail("Should not be allowed to set oranges to be blue !"); + fail("Should not be allowed to set oranges to be blue !"); } catch (SpelEvaluationException ee) { - Assert.assertEquals(ee.getMessageCode(), SpelMessage.PROPERTY_OR_FIELD_NOT_WRITABLE_ON_NULL); + assertEquals(ee.getMessageCode(), SpelMessage.PROPERTY_OR_FIELD_NOT_WRITABLE_ON_NULL); } } @@ -227,14 +228,14 @@ public class ExpressionLanguageScenarioTests extends ExpressionTestCase { ctx.addPropertyAccessor(new VegetableColourAccessor()); Expression expr = parser.parseRaw("pea"); Object value = expr.getValue(ctx); - Assert.assertEquals(Color.green, value); + assertEquals(Color.green, value); try { expr.setValue(ctx, Color.blue); - Assert.fail("Should not be allowed to set peas to be blue !"); + fail("Should not be allowed to set peas to be blue !"); } catch (SpelEvaluationException ee) { - Assert.assertEquals(ee.getMessageCode(), SpelMessage.PROPERTY_OR_FIELD_NOT_WRITABLE_ON_NULL); + assertEquals(ee.getMessageCode(), SpelMessage.PROPERTY_OR_FIELD_NOT_WRITABLE_ON_NULL); } } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionStateTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionStateTests.java index 32de58c8c5..583609b23e 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionStateTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionStateTests.java @@ -16,12 +16,15 @@ package org.springframework.expression.spel; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + import java.util.EmptyStackException; import java.util.HashMap; import java.util.Map; -import junit.framework.Assert; - import org.junit.Test; import org.springframework.core.convert.TypeDescriptor; import org.springframework.expression.EvaluationContext; @@ -42,7 +45,7 @@ public class ExpressionStateTests extends ExpressionTestCase { public void testConstruction() { EvaluationContext context = TestScenarioCreator.getTestEvaluationContext(); ExpressionState state = new ExpressionState(context); - Assert.assertEquals(context,state.getEvaluationContext()); + assertEquals(context,state.getEvaluationContext()); } // Local variables are in variable scopes which come and go during evaluation. Normal variables are @@ -53,129 +56,129 @@ public class ExpressionStateTests extends ExpressionTestCase { ExpressionState state = getState(); Object value = state.lookupLocalVariable("foo"); - Assert.assertNull(value); + assertNull(value); state.setLocalVariable("foo",34); value = state.lookupLocalVariable("foo"); - Assert.assertEquals(34,value); + assertEquals(34,value); state.setLocalVariable("foo",null); value = state.lookupLocalVariable("foo"); - Assert.assertEquals(null,value); + assertEquals(null,value); } @Test public void testVariables() { ExpressionState state = getState(); TypedValue typedValue = state.lookupVariable("foo"); - Assert.assertEquals(TypedValue.NULL,typedValue); + assertEquals(TypedValue.NULL,typedValue); state.setVariable("foo",34); typedValue = state.lookupVariable("foo"); - Assert.assertEquals(34,typedValue.getValue()); - Assert.assertEquals(Integer.class,typedValue.getTypeDescriptor().getType()); + assertEquals(34,typedValue.getValue()); + assertEquals(Integer.class,typedValue.getTypeDescriptor().getType()); state.setVariable("foo","abc"); typedValue = state.lookupVariable("foo"); - Assert.assertEquals("abc",typedValue.getValue()); - Assert.assertEquals(String.class,typedValue.getTypeDescriptor().getType()); + assertEquals("abc",typedValue.getValue()); + assertEquals(String.class,typedValue.getTypeDescriptor().getType()); } @Test public void testNoVariableInteference() { ExpressionState state = getState(); TypedValue typedValue = state.lookupVariable("foo"); - Assert.assertEquals(TypedValue.NULL,typedValue); + assertEquals(TypedValue.NULL,typedValue); state.setLocalVariable("foo",34); typedValue = state.lookupVariable("foo"); - Assert.assertEquals(TypedValue.NULL,typedValue); + assertEquals(TypedValue.NULL,typedValue); state.setVariable("goo","hello"); - Assert.assertNull(state.lookupLocalVariable("goo")); + assertNull(state.lookupLocalVariable("goo")); } @Test public void testLocalVariableNestedScopes() { ExpressionState state = getState(); - Assert.assertEquals(null,state.lookupLocalVariable("foo")); + assertEquals(null,state.lookupLocalVariable("foo")); state.setLocalVariable("foo",12); - Assert.assertEquals(12,state.lookupLocalVariable("foo")); + assertEquals(12,state.lookupLocalVariable("foo")); state.enterScope(null); - Assert.assertEquals(12,state.lookupLocalVariable("foo")); // found in upper scope + assertEquals(12,state.lookupLocalVariable("foo")); // found in upper scope state.setLocalVariable("foo","abc"); - Assert.assertEquals("abc",state.lookupLocalVariable("foo")); // found in nested scope + assertEquals("abc",state.lookupLocalVariable("foo")); // found in nested scope state.exitScope(); - Assert.assertEquals(12,state.lookupLocalVariable("foo")); // found in nested scope + assertEquals(12,state.lookupLocalVariable("foo")); // found in nested scope } @Test public void testRootContextObject() { ExpressionState state = getState(); - Assert.assertEquals(Inventor.class,state.getRootContextObject().getValue().getClass()); + assertEquals(Inventor.class,state.getRootContextObject().getValue().getClass()); // although the root object is being set on the evaluation context, the value in the 'state' remains what it was when constructed ((StandardEvaluationContext) state.getEvaluationContext()).setRootObject(null); - Assert.assertEquals(Inventor.class,state.getRootContextObject().getValue().getClass()); - // Assert.assertEquals(null, state.getRootContextObject().getValue()); + assertEquals(Inventor.class,state.getRootContextObject().getValue().getClass()); + // assertEquals(null, state.getRootContextObject().getValue()); state = new ExpressionState(new StandardEvaluationContext()); - Assert.assertEquals(TypedValue.NULL,state.getRootContextObject()); + assertEquals(TypedValue.NULL,state.getRootContextObject()); ((StandardEvaluationContext)state.getEvaluationContext()).setRootObject(null); - Assert.assertEquals(null,state.getRootContextObject().getValue()); + assertEquals(null,state.getRootContextObject().getValue()); } @Test public void testActiveContextObject() { ExpressionState state = getState(); - Assert.assertEquals(state.getRootContextObject().getValue(),state.getActiveContextObject().getValue()); + assertEquals(state.getRootContextObject().getValue(),state.getActiveContextObject().getValue()); try { state.popActiveContextObject(); - Assert.fail("stack should be empty..."); + fail("stack should be empty..."); } catch (EmptyStackException ese) { // success } state.pushActiveContextObject(new TypedValue(34)); - Assert.assertEquals(34,state.getActiveContextObject().getValue()); + assertEquals(34,state.getActiveContextObject().getValue()); state.pushActiveContextObject(new TypedValue("hello")); - Assert.assertEquals("hello",state.getActiveContextObject().getValue()); + assertEquals("hello",state.getActiveContextObject().getValue()); state.popActiveContextObject(); - Assert.assertEquals(34,state.getActiveContextObject().getValue()); + assertEquals(34,state.getActiveContextObject().getValue()); state.popActiveContextObject(); - Assert.assertEquals(state.getRootContextObject().getValue(),state.getActiveContextObject().getValue()); + assertEquals(state.getRootContextObject().getValue(),state.getActiveContextObject().getValue()); state = new ExpressionState(new StandardEvaluationContext()); - Assert.assertEquals(TypedValue.NULL,state.getActiveContextObject()); + assertEquals(TypedValue.NULL,state.getActiveContextObject()); } @Test public void testPopulatedNestedScopes() { ExpressionState state = getState(); - Assert.assertNull(state.lookupLocalVariable("foo")); + assertNull(state.lookupLocalVariable("foo")); state.enterScope("foo",34); - Assert.assertEquals(34,state.lookupLocalVariable("foo")); + assertEquals(34,state.lookupLocalVariable("foo")); state.enterScope(null); state.setLocalVariable("foo",12); - Assert.assertEquals(12,state.lookupLocalVariable("foo")); + assertEquals(12,state.lookupLocalVariable("foo")); state.exitScope(); - Assert.assertEquals(34,state.lookupLocalVariable("foo")); + assertEquals(34,state.lookupLocalVariable("foo")); state.exitScope(); - Assert.assertNull(state.lookupLocalVariable("goo")); + assertNull(state.lookupLocalVariable("goo")); } @Test @@ -185,33 +188,33 @@ public class ExpressionStateTests extends ExpressionTestCase { // supplied should override root on context ExpressionState state = new ExpressionState(ctx,new TypedValue("i am a string")); TypedValue stateRoot = state.getRootContextObject(); - Assert.assertEquals(String.class,stateRoot.getTypeDescriptor().getType()); - Assert.assertEquals("i am a string",stateRoot.getValue()); + assertEquals(String.class,stateRoot.getTypeDescriptor().getType()); + assertEquals("i am a string",stateRoot.getValue()); } @Test public void testPopulatedNestedScopesMap() { ExpressionState state = getState(); - Assert.assertNull(state.lookupLocalVariable("foo")); - Assert.assertNull(state.lookupLocalVariable("goo")); + assertNull(state.lookupLocalVariable("foo")); + assertNull(state.lookupLocalVariable("goo")); Map m = new HashMap(); m.put("foo",34); m.put("goo","abc"); state.enterScope(m); - Assert.assertEquals(34,state.lookupLocalVariable("foo")); - Assert.assertEquals("abc",state.lookupLocalVariable("goo")); + assertEquals(34,state.lookupLocalVariable("foo")); + assertEquals("abc",state.lookupLocalVariable("goo")); state.enterScope(null); state.setLocalVariable("foo",12); - Assert.assertEquals(12,state.lookupLocalVariable("foo")); - Assert.assertEquals("abc",state.lookupLocalVariable("goo")); + assertEquals(12,state.lookupLocalVariable("foo")); + assertEquals("abc",state.lookupLocalVariable("goo")); state.exitScope(); state.exitScope(); - Assert.assertNull(state.lookupLocalVariable("foo")); - Assert.assertNull(state.lookupLocalVariable("goo")); + assertNull(state.lookupLocalVariable("foo")); + assertNull(state.lookupLocalVariable("goo")); } @Test @@ -219,38 +222,38 @@ public class ExpressionStateTests extends ExpressionTestCase { ExpressionState state = getState(); try { state.operate(Operation.ADD,1,2); - Assert.fail("should have failed"); + fail("should have failed"); } catch (EvaluationException ee) { SpelEvaluationException sEx = (SpelEvaluationException)ee; - Assert.assertEquals(SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES,sEx.getMessageCode()); + assertEquals(SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES,sEx.getMessageCode()); } try { state.operate(Operation.ADD,null,null); - Assert.fail("should have failed"); + fail("should have failed"); } catch (EvaluationException ee) { SpelEvaluationException sEx = (SpelEvaluationException)ee; - Assert.assertEquals(SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES,sEx.getMessageCode()); + assertEquals(SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES,sEx.getMessageCode()); } } @Test public void testComparator() { ExpressionState state = getState(); - Assert.assertEquals(state.getEvaluationContext().getTypeComparator(),state.getTypeComparator()); + assertEquals(state.getEvaluationContext().getTypeComparator(),state.getTypeComparator()); } @Test public void testTypeLocator() throws EvaluationException { ExpressionState state = getState(); - Assert.assertNotNull(state.getEvaluationContext().getTypeLocator()); - Assert.assertEquals(Integer.class,state.findType("java.lang.Integer")); + assertNotNull(state.getEvaluationContext().getTypeLocator()); + assertEquals(Integer.class,state.findType("java.lang.Integer")); try { state.findType("someMadeUpName"); - Assert.fail("Should have failed to find it"); + fail("Should have failed to find it"); } catch (EvaluationException ee) { SpelEvaluationException sEx = (SpelEvaluationException)ee; - Assert.assertEquals(SpelMessage.TYPE_NOT_FOUND,sEx.getMessageCode()); + assertEquals(SpelMessage.TYPE_NOT_FOUND,sEx.getMessageCode()); } } @@ -258,16 +261,16 @@ public class ExpressionStateTests extends ExpressionTestCase { public void testTypeConversion() throws EvaluationException { ExpressionState state = getState(); String s = (String)state.convertValue(34, TypeDescriptor.valueOf(String.class)); - Assert.assertEquals("34",s); + assertEquals("34",s); s = (String)state.convertValue(new TypedValue(34), TypeDescriptor.valueOf(String.class)); - Assert.assertEquals("34",s); + assertEquals("34",s); } @Test public void testPropertyAccessors() { ExpressionState state = getState(); - Assert.assertEquals(state.getEvaluationContext().getPropertyAccessors(),state.getPropertyAccessors()); + assertEquals(state.getEvaluationContext().getPropertyAccessors(),state.getPropertyAccessors()); } /** diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionTestCase.java b/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionTestCase.java index 9433568d9c..74d5aa8e12 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionTestCase.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionTestCase.java @@ -16,11 +16,12 @@ package org.springframework.expression.spel; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + import java.util.Arrays; import java.util.List; -import junit.framework.Assert; - import org.springframework.expression.EvaluationException; import org.springframework.expression.Expression; import org.springframework.expression.ExpressionParser; @@ -54,13 +55,13 @@ public abstract class ExpressionTestCase { try { Expression expr = parser.parseExpression(expression); if (expr == null) { - Assert.fail("Parser returned null for expression"); + fail("Parser returned null for expression"); } if (DEBUG) { SpelUtilities.printAbstractSyntaxTree(System.out, expr); } // Class expressionType = expr.getValueType(); - // Assert.assertEquals("Type of the expression is not as expected. Should be '"+expectedResultType+"' but is + // assertEquals("Type of the expression is not as expected. Should be '"+expectedResultType+"' but is // '"+expressionType+"'", // expectedResultType,expressionType); @@ -71,12 +72,12 @@ public abstract class ExpressionTestCase { if (expectedValue == null) { return; // no point doing other checks } - Assert.assertEquals("Expression returned null value, but expected '" + expectedValue + "'", expectedValue, + assertEquals("Expression returned null value, but expected '" + expectedValue + "'", expectedValue, null); } Class resultType = value.getClass(); - Assert.assertEquals("Type of the actual result was not as expected. Expected '" + expectedResultType + assertEquals("Type of the actual result was not as expected. Expected '" + expectedResultType + "' but result was of type '" + resultType + "'", expectedResultType, resultType); // .equals/* isAssignableFrom */(resultType), truers); @@ -84,17 +85,17 @@ public abstract class ExpressionTestCase { // in the above expression... if (expectedValue instanceof String) { - Assert.assertEquals("Did not get expected value for expression '" + expression + "'.", expectedValue, + assertEquals("Did not get expected value for expression '" + expression + "'.", expectedValue, ExpressionTestCase.stringValueOf(value)); } else { - Assert.assertEquals("Did not get expected value for expression '" + expression + "'.", expectedValue, value); + assertEquals("Did not get expected value for expression '" + expression + "'.", expectedValue, value); } } catch (EvaluationException ee) { ee.printStackTrace(); - Assert.fail("Unexpected Exception: " + ee.getMessage()); + fail("Unexpected Exception: " + ee.getMessage()); } catch (ParseException pe) { pe.printStackTrace(); - Assert.fail("Unexpected Exception: " + pe.getMessage()); + fail("Unexpected Exception: " + pe.getMessage()); } } @@ -102,13 +103,13 @@ public abstract class ExpressionTestCase { try { Expression expr = parser.parseExpression(expression); if (expr == null) { - Assert.fail("Parser returned null for expression"); + fail("Parser returned null for expression"); } if (DEBUG) { SpelUtilities.printAbstractSyntaxTree(System.out, expr); } // Class expressionType = expr.getValueType(); - // Assert.assertEquals("Type of the expression is not as expected. Should be '"+expectedResultType+"' but is + // assertEquals("Type of the expression is not as expected. Should be '"+expectedResultType+"' but is // '"+expressionType+"'", // expectedResultType,expressionType); @@ -116,23 +117,23 @@ public abstract class ExpressionTestCase { if (value == null) { if (expectedValue == null) return; // no point doing other checks - Assert.assertEquals("Expression returned null value, but expected '" + expectedValue + "'", expectedValue, + assertEquals("Expression returned null value, but expected '" + expectedValue + "'", expectedValue, null); } Class resultType = value.getClass(); - Assert.assertEquals("Type of the actual result was not as expected. Expected '" + expectedResultType + assertEquals("Type of the actual result was not as expected. Expected '" + expectedResultType + "' but result was of type '" + resultType + "'", expectedResultType, resultType); // .equals/* isAssignableFrom */(resultType), truers); - Assert.assertEquals("Did not get expected value for expression '" + expression + "'.", expectedValue, value); + assertEquals("Did not get expected value for expression '" + expression + "'.", expectedValue, value); // isAssignableFrom would allow some room for compatibility // in the above expression... } catch (EvaluationException ee) { SpelEvaluationException ex = (SpelEvaluationException) ee; ex.printStackTrace(); - Assert.fail("Unexpected EvaluationException: " + ex.getMessage()); + fail("Unexpected EvaluationException: " + ex.getMessage()); } catch (ParseException pe) { - Assert.fail("Unexpected ParseException: " + pe.getMessage()); + fail("Unexpected ParseException: " + pe.getMessage()); } } @@ -151,7 +152,7 @@ public abstract class ExpressionTestCase { try { Expression e = parser.parseExpression(expression); if (e == null) { - Assert.fail("Parser returned null for expression"); + fail("Parser returned null for expression"); } if (DEBUG) { SpelUtilities.printAbstractSyntaxTree(System.out, e); @@ -161,19 +162,19 @@ public abstract class ExpressionTestCase { if (expectedValue == null) return; // no point doing other // checks - Assert.assertEquals("Expression returned null value, but expected '" + expectedValue + "'", expectedValue, + assertEquals("Expression returned null value, but expected '" + expectedValue + "'", expectedValue, null); } Class resultType = value.getClass(); if (expectedValue instanceof String) { - Assert.assertEquals("Did not get expected value for expression '" + expression + "'.", expectedValue, + assertEquals("Did not get expected value for expression '" + expression + "'.", expectedValue, ExpressionTestCase.stringValueOf(value)); } else { - Assert.assertEquals("Did not get expected value for expression '" + expression + "'.", expectedValue, value); + assertEquals("Did not get expected value for expression '" + expression + "'.", expectedValue, value); } -// Assert.assertEquals("Did not get expected value for expression '" + expression + "'.", expectedValue, +// assertEquals("Did not get expected value for expression '" + expression + "'.", expectedValue, // ExpressionTestCase.stringValueOf(value)); - Assert.assertEquals("Type of the result was not as expected. Expected '" + expectedClassOfResult + assertEquals("Type of the result was not as expected. Expected '" + expectedClassOfResult + "' but result was of type '" + resultType + "'", expectedClassOfResult .equals/* isAssignableFrom */(resultType), true); // TODO isAssignableFrom would allow some room for compatibility @@ -182,16 +183,16 @@ public abstract class ExpressionTestCase { boolean isWritable = e.isWritable(eContext); if (isWritable != shouldBeWritable) { if (shouldBeWritable) - Assert.fail("Expected the expression to be writable but it is not"); + fail("Expected the expression to be writable but it is not"); else - Assert.fail("Expected the expression to be readonly but it is not"); + fail("Expected the expression to be readonly but it is not"); } } catch (EvaluationException ee) { ee.printStackTrace(); - Assert.fail("Unexpected Exception: " + ee.getMessage()); + fail("Unexpected Exception: " + ee.getMessage()); } catch (ParseException pe) { pe.printStackTrace(); - Assert.fail("Unexpected Exception: " + pe.getMessage()); + fail("Unexpected Exception: " + pe.getMessage()); } } @@ -222,7 +223,7 @@ public abstract class ExpressionTestCase { try { Expression expr = parser.parseExpression(expression); if (expr == null) { - Assert.fail("Parser returned null for expression"); + fail("Parser returned null for expression"); } if (expectedReturnType != null) { @SuppressWarnings("unused") @@ -231,18 +232,18 @@ public abstract class ExpressionTestCase { @SuppressWarnings("unused") Object value = expr.getValue(eContext); } - Assert.fail("Should have failed with message " + expectedMessage); + fail("Should have failed with message " + expectedMessage); } catch (EvaluationException ee) { SpelEvaluationException ex = (SpelEvaluationException) ee; if (ex.getMessageCode() != expectedMessage) { // System.out.println(ex.getMessage()); ex.printStackTrace(); - Assert.assertEquals("Failed to get expected message", expectedMessage, ex.getMessageCode()); + assertEquals("Failed to get expected message", expectedMessage, ex.getMessageCode()); } if (otherProperties != null && otherProperties.length != 0) { // first one is expected position of the error within the string int pos = ((Integer) otherProperties[0]).intValue(); - Assert.assertEquals("Did not get correct position reported in error ", pos, ex.getPosition()); + assertEquals("Did not get correct position reported in error ", pos, ex.getPosition()); if (otherProperties.length > 1) { // Check inserts match Object[] inserts = ex.getInserts(); @@ -251,25 +252,25 @@ public abstract class ExpressionTestCase { } if (inserts.length < otherProperties.length - 1) { ex.printStackTrace(); - Assert.fail("Cannot check " + (otherProperties.length - 1) + fail("Cannot check " + (otherProperties.length - 1) + " properties of the exception, it only has " + inserts.length + " inserts"); } for (int i = 1; i < otherProperties.length; i++) { if (otherProperties[i] == null) { if (inserts[i - 1] != null) { ex.printStackTrace(); - Assert.fail("Insert does not match, expected 'null' but insert value was '" + inserts[i - 1] + fail("Insert does not match, expected 'null' but insert value was '" + inserts[i - 1] + "'"); } } else if (inserts[i - 1] == null) { if (otherProperties[i] != null) { ex.printStackTrace(); - Assert.fail("Insert does not match, expected '" + otherProperties[i] + fail("Insert does not match, expected '" + otherProperties[i] + "' but insert value was 'null'"); } } else if (!inserts[i - 1].equals(otherProperties[i])) { ex.printStackTrace(); - Assert.fail("Insert does not match, expected '" + otherProperties[i] + "' but insert value was '" + fail("Insert does not match, expected '" + otherProperties[i] + "' but insert value was '" + inserts[i - 1] + "'"); } } @@ -277,7 +278,7 @@ public abstract class ExpressionTestCase { } } catch (ParseException pe) { pe.printStackTrace(); - Assert.fail("Unexpected Exception: " + pe.getMessage()); + fail("Unexpected Exception: " + pe.getMessage()); } } @@ -293,16 +294,16 @@ public abstract class ExpressionTestCase { try { Expression expr = parser.parseExpression(expression); SpelUtilities.printAbstractSyntaxTree(System.out, expr); - Assert.fail("Parsing should have failed!"); + fail("Parsing should have failed!"); } catch (ParseException pe) { // pe.printStackTrace(); // Throwable t = pe.getCause(); // if (t == null) { -// Assert.fail("ParseException caught with no defined cause"); +// fail("ParseException caught with no defined cause"); // } // if (!(t instanceof SpelEvaluationException)) { // t.printStackTrace(); -// Assert.fail("Cause of parse exception is not a SpelException"); +// fail("Cause of parse exception is not a SpelException"); // } // SpelEvaluationException ex = (SpelEvaluationException) t; // pe.printStackTrace(); @@ -310,12 +311,12 @@ public abstract class ExpressionTestCase { if (ex.getMessageCode() != expectedMessage) { // System.out.println(ex.getMessage()); ex.printStackTrace(); - Assert.assertEquals("Failed to get expected message", expectedMessage, ex.getMessageCode()); + assertEquals("Failed to get expected message", expectedMessage, ex.getMessageCode()); } if (otherProperties != null && otherProperties.length != 0) { // first one is expected position of the error within the string int pos = ((Integer) otherProperties[0]).intValue(); - Assert.assertEquals("Did not get correct position reported in error ", pos, ex.getPosition()); + assertEquals("Did not get correct position reported in error ", pos, ex.getPosition()); if (otherProperties.length > 1) { // Check inserts match Object[] inserts = ex.getInserts(); @@ -324,13 +325,13 @@ public abstract class ExpressionTestCase { } if (inserts.length < otherProperties.length - 1) { ex.printStackTrace(); - Assert.fail("Cannot check " + (otherProperties.length - 1) + fail("Cannot check " + (otherProperties.length - 1) + " properties of the exception, it only has " + inserts.length + " inserts"); } for (int i = 1; i < otherProperties.length; i++) { if (!inserts[i - 1].equals(otherProperties[i])) { ex.printStackTrace(); - Assert.fail("Insert does not match, expected '" + otherProperties[i] + "' but insert value was '" + fail("Insert does not match, expected '" + otherProperties[i] + "' but insert value was '" + inserts[i - 1] + "'"); } } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionTestsUsingCoreConversionService.java b/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionTestsUsingCoreConversionService.java index 8071bc198f..f7c8e4ac06 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionTestsUsingCoreConversionService.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionTestsUsingCoreConversionService.java @@ -16,9 +16,9 @@ package org.springframework.expression.spel; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.Collection; diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/InProgressTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/InProgressTests.java index 3e6ae17ff4..6729476f18 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/InProgressTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/InProgressTests.java @@ -16,11 +16,11 @@ package org.springframework.expression.spel; +import static org.junit.Assert.assertEquals; + import java.util.ArrayList; import java.util.HashMap; -import junit.framework.Assert; - import org.junit.Test; import org.springframework.expression.spel.standard.SpelExpression; @@ -78,7 +78,7 @@ public class InProgressTests extends ExpressionTestCase { @Test public void testProjection06() throws Exception { SpelExpression expr = (SpelExpression) parser.parseExpression("'abc'.![true]"); - Assert.assertEquals("'abc'.![true]", expr.toStringAST()); + assertEquals("'abc'.![true]", expr.toStringAST()); } // SELECTION @@ -141,11 +141,11 @@ public class InProgressTests extends ExpressionTestCase { @Test public void testSelectionAST() throws Exception { SpelExpression expr = (SpelExpression) parser.parseExpression("'abc'.^[true]"); - Assert.assertEquals("'abc'.^[true]", expr.toStringAST()); + assertEquals("'abc'.^[true]", expr.toStringAST()); expr = (SpelExpression) parser.parseExpression("'abc'.?[true]"); - Assert.assertEquals("'abc'.?[true]", expr.toStringAST()); + assertEquals("'abc'.?[true]", expr.toStringAST()); expr = (SpelExpression) parser.parseExpression("'abc'.$[true]"); - Assert.assertEquals("'abc'.$[true]", expr.toStringAST()); + assertEquals("'abc'.$[true]", expr.toStringAST()); } // Constructor invocation diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/LiteralExpressionTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/LiteralExpressionTests.java index 352b486991..89961e2b06 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/LiteralExpressionTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/LiteralExpressionTests.java @@ -16,7 +16,9 @@ package org.springframework.expression.spel; -import junit.framework.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.fail; import org.junit.Test; import org.springframework.expression.EvaluationContext; @@ -41,10 +43,10 @@ public class LiteralExpressionTests { checkString("somevalue", lEx.getValue(new Rooty(), String.class)); checkString("somevalue", lEx.getValue(ctx, new Rooty())); checkString("somevalue", lEx.getValue(ctx, new Rooty(),String.class)); - Assert.assertEquals("somevalue", lEx.getExpressionString()); - Assert.assertFalse(lEx.isWritable(new StandardEvaluationContext())); - Assert.assertFalse(lEx.isWritable(new Rooty())); - Assert.assertFalse(lEx.isWritable(new StandardEvaluationContext(), new Rooty())); + assertEquals("somevalue", lEx.getExpressionString()); + assertFalse(lEx.isWritable(new StandardEvaluationContext())); + assertFalse(lEx.isWritable(new Rooty())); + assertFalse(lEx.isWritable(new StandardEvaluationContext(), new Rooty())); } static class Rooty {} @@ -54,51 +56,51 @@ public class LiteralExpressionTests { try { LiteralExpression lEx = new LiteralExpression("somevalue"); lEx.setValue(new StandardEvaluationContext(), "flibble"); - Assert.fail("Should have got an exception that the value cannot be set"); + fail("Should have got an exception that the value cannot be set"); } catch (EvaluationException ee) { // success, not allowed - whilst here, check the expression value in the exception - Assert.assertEquals(ee.getExpressionString(), "somevalue"); + assertEquals(ee.getExpressionString(), "somevalue"); } try { LiteralExpression lEx = new LiteralExpression("somevalue"); lEx.setValue(new Rooty(), "flibble"); - Assert.fail("Should have got an exception that the value cannot be set"); + fail("Should have got an exception that the value cannot be set"); } catch (EvaluationException ee) { // success, not allowed - whilst here, check the expression value in the exception - Assert.assertEquals(ee.getExpressionString(), "somevalue"); + assertEquals(ee.getExpressionString(), "somevalue"); } try { LiteralExpression lEx = new LiteralExpression("somevalue"); lEx.setValue(new StandardEvaluationContext(), new Rooty(), "flibble"); - Assert.fail("Should have got an exception that the value cannot be set"); + fail("Should have got an exception that the value cannot be set"); } catch (EvaluationException ee) { // success, not allowed - whilst here, check the expression value in the exception - Assert.assertEquals(ee.getExpressionString(), "somevalue"); + assertEquals(ee.getExpressionString(), "somevalue"); } } @Test public void testGetValueType() throws Exception { LiteralExpression lEx = new LiteralExpression("somevalue"); - Assert.assertEquals(String.class, lEx.getValueType()); - Assert.assertEquals(String.class, lEx.getValueType(new StandardEvaluationContext())); - Assert.assertEquals(String.class, lEx.getValueType(new Rooty())); - Assert.assertEquals(String.class, lEx.getValueType(new StandardEvaluationContext(), new Rooty())); - Assert.assertEquals(String.class, lEx.getValueTypeDescriptor().getType()); - Assert.assertEquals(String.class, lEx.getValueTypeDescriptor(new StandardEvaluationContext()).getType()); - Assert.assertEquals(String.class, lEx.getValueTypeDescriptor(new Rooty()).getType()); - Assert.assertEquals(String.class, lEx.getValueTypeDescriptor(new StandardEvaluationContext(), new Rooty()).getType()); + assertEquals(String.class, lEx.getValueType()); + assertEquals(String.class, lEx.getValueType(new StandardEvaluationContext())); + assertEquals(String.class, lEx.getValueType(new Rooty())); + assertEquals(String.class, lEx.getValueType(new StandardEvaluationContext(), new Rooty())); + assertEquals(String.class, lEx.getValueTypeDescriptor().getType()); + assertEquals(String.class, lEx.getValueTypeDescriptor(new StandardEvaluationContext()).getType()); + assertEquals(String.class, lEx.getValueTypeDescriptor(new Rooty()).getType()); + assertEquals(String.class, lEx.getValueTypeDescriptor(new StandardEvaluationContext(), new Rooty()).getType()); } private void checkString(String expectedString, Object value) { if (!(value instanceof String)) { - Assert.fail("Result was not a string, it was of type " + value.getClass() + " (value=" + value + ")"); + fail("Result was not a string, it was of type " + value.getClass() + " (value=" + value + ")"); } if (!((String) value).equals(expectedString)) { - Assert.fail("Did not get expected result. Should have been '" + expectedString + "' but was '" + value + "'"); + fail("Did not get expected result. Should have been '" + expectedString + "' but was '" + value + "'"); } } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/LiteralTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/LiteralTests.java index 6eda349325..a3097e03ca 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/LiteralTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/LiteralTests.java @@ -16,7 +16,8 @@ package org.springframework.expression.spel; -import junit.framework.Assert; +import static org.junit.Assert.assertFalse; + import org.junit.Test; import org.springframework.expression.spel.standard.SpelExpression; import org.springframework.expression.spel.support.StandardEvaluationContext; @@ -163,10 +164,10 @@ public class LiteralTests extends ExpressionTestCase { @Test public void testNotWritable() throws Exception { SpelExpression expr = (SpelExpression)parser.parseExpression("37"); - Assert.assertFalse(expr.isWritable(new StandardEvaluationContext())); + assertFalse(expr.isWritable(new StandardEvaluationContext())); expr = (SpelExpression)parser.parseExpression("37L"); - Assert.assertFalse(expr.isWritable(new StandardEvaluationContext())); + assertFalse(expr.isWritable(new StandardEvaluationContext())); expr = (SpelExpression)parser.parseExpression("true"); - Assert.assertFalse(expr.isWritable(new StandardEvaluationContext())); + assertFalse(expr.isWritable(new StandardEvaluationContext())); } } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java index 606d4c423f..3ea0f98e3d 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java @@ -16,10 +16,10 @@ package org.springframework.expression.spel; -import java.util.Map; -import java.util.HashMap; +import static org.junit.Assert.assertEquals; -import junit.framework.Assert; +import java.util.HashMap; +import java.util.Map; import org.junit.Test; import org.springframework.expression.AccessException; @@ -56,7 +56,7 @@ public class MapAccessTests extends ExpressionTestCase { Expression expr = parser.parseExpression("testMap.monday"); Object value = expr.getValue(ctx, String.class); - Assert.assertEquals("montag", value); + assertEquals("montag", value); } @Test @@ -67,7 +67,7 @@ public class MapAccessTests extends ExpressionTestCase { Expression expr = parser.parseExpression("testMap[#day]"); Object value = expr.getValue(ctx, String.class); - Assert.assertEquals("samstag", value); + assertEquals("samstag", value); } @Test diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/OperatorOverloaderTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/OperatorOverloaderTests.java index 703b1b7394..394ec38817 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/OperatorOverloaderTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/OperatorOverloaderTests.java @@ -16,7 +16,7 @@ package org.springframework.expression.spel; -import junit.framework.Assert; +import static org.junit.Assert.assertEquals; import org.junit.Test; import org.springframework.expression.EvaluationException; @@ -64,12 +64,12 @@ public class OperatorOverloaderTests extends ExpressionTestCase { eContext.setOperatorOverloader(new StringAndBooleanAddition()); SpelExpression expr = (SpelExpression)parser.parseExpression("'abc'+true"); - Assert.assertEquals("abctrue",expr.getValue(eContext)); + assertEquals("abctrue",expr.getValue(eContext)); expr = (SpelExpression)parser.parseExpression("'abc'-true"); - Assert.assertEquals("abc",expr.getValue(eContext)); + assertEquals("abc",expr.getValue(eContext)); expr = (SpelExpression)parser.parseExpression("'abc'+null"); - Assert.assertEquals("abcnull",expr.getValue(eContext)); + assertEquals("abcnull",expr.getValue(eContext)); } } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/OperatorTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/OperatorTests.java index 56f26cef12..2728626b4f 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/OperatorTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/OperatorTests.java @@ -16,7 +16,8 @@ package org.springframework.expression.spel; -import junit.framework.Assert; +import static org.junit.Assert.assertEquals; + import org.junit.Test; import org.springframework.expression.spel.ast.Operator; import org.springframework.expression.spel.standard.SpelExpression; @@ -208,9 +209,9 @@ public class OperatorTests extends ExpressionTestCase { // AST: SpelExpression expr = (SpelExpression)parser.parseExpression("+3"); - Assert.assertEquals("+3",expr.toStringAST()); + assertEquals("+3",expr.toStringAST()); expr = (SpelExpression)parser.parseExpression("2+3"); - Assert.assertEquals("(2 + 3)",expr.toStringAST()); + assertEquals("(2 + 3)",expr.toStringAST()); // use as a unary operator evaluate("+5d",5d,Double.class); @@ -232,9 +233,9 @@ public class OperatorTests extends ExpressionTestCase { evaluateAndCheckError("'ab' - 2", SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES); evaluateAndCheckError("2-'ab'",SpelMessage.OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES); SpelExpression expr = (SpelExpression)parser.parseExpression("-3"); - Assert.assertEquals("-3",expr.toStringAST()); + assertEquals("-3",expr.toStringAST()); expr = (SpelExpression)parser.parseExpression("2-3"); - Assert.assertEquals("(2 - 3)",expr.toStringAST()); + assertEquals("(2 - 3)",expr.toStringAST()); evaluate("-5d",-5d,Double.class); evaluate("-5L",-5L,Long.class); @@ -286,40 +287,40 @@ public class OperatorTests extends ExpressionTestCase { @Test public void testOperatorNames() throws Exception { Operator node = getOperatorNode((SpelExpression)parser.parseExpression("1==3")); - Assert.assertEquals("==",node.getOperatorName()); + assertEquals("==",node.getOperatorName()); node = getOperatorNode((SpelExpression)parser.parseExpression("1!=3")); - Assert.assertEquals("!=",node.getOperatorName()); + assertEquals("!=",node.getOperatorName()); node = getOperatorNode((SpelExpression)parser.parseExpression("3/3")); - Assert.assertEquals("/",node.getOperatorName()); + assertEquals("/",node.getOperatorName()); node = getOperatorNode((SpelExpression)parser.parseExpression("3+3")); - Assert.assertEquals("+",node.getOperatorName()); + assertEquals("+",node.getOperatorName()); node = getOperatorNode((SpelExpression)parser.parseExpression("3-3")); - Assert.assertEquals("-",node.getOperatorName()); + assertEquals("-",node.getOperatorName()); node = getOperatorNode((SpelExpression)parser.parseExpression("3<4")); - Assert.assertEquals("<",node.getOperatorName()); + assertEquals("<",node.getOperatorName()); node = getOperatorNode((SpelExpression)parser.parseExpression("3<=4")); - Assert.assertEquals("<=",node.getOperatorName()); + assertEquals("<=",node.getOperatorName()); node = getOperatorNode((SpelExpression)parser.parseExpression("3*4")); - Assert.assertEquals("*",node.getOperatorName()); + assertEquals("*",node.getOperatorName()); node = getOperatorNode((SpelExpression)parser.parseExpression("3%4")); - Assert.assertEquals("%",node.getOperatorName()); + assertEquals("%",node.getOperatorName()); node = getOperatorNode((SpelExpression)parser.parseExpression("3>=4")); - Assert.assertEquals(">=",node.getOperatorName()); + assertEquals(">=",node.getOperatorName()); node = getOperatorNode((SpelExpression)parser.parseExpression("3 between 4")); - Assert.assertEquals("between",node.getOperatorName()); + assertEquals("between",node.getOperatorName()); node = getOperatorNode((SpelExpression)parser.parseExpression("3 ^ 4")); - Assert.assertEquals("^",node.getOperatorName()); + assertEquals("^",node.getOperatorName()); } @Test diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/ParsingTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/ParsingTests.java index d2d6b954fe..ff92b50476 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/ParsingTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/ParsingTests.java @@ -16,7 +16,8 @@ package org.springframework.expression.spel; -import junit.framework.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; import org.junit.Test; import org.springframework.expression.ParseException; @@ -462,12 +463,12 @@ public class ParsingTests { SpelUtilities.printAbstractSyntaxTree(System.err, e); } if (e == null) { - Assert.fail("Parsed exception was null"); + fail("Parsed exception was null"); } - Assert.assertEquals("String form of AST does not match expected output", expectedStringFormOfAST, e.toStringAST()); + assertEquals("String form of AST does not match expected output", expectedStringFormOfAST, e.toStringAST()); } catch (ParseException ee) { ee.printStackTrace(); - Assert.fail("Unexpected Exception: " + ee.getMessage()); + fail("Unexpected Exception: " + ee.getMessage()); } } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/PerformanceTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/PerformanceTests.java index 029dd2440f..740f33d412 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/PerformanceTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/PerformanceTests.java @@ -16,11 +16,12 @@ package org.springframework.expression.spel; -import junit.framework.Assert; +import static org.junit.Assert.fail; + import org.junit.Test; -import org.springframework.build.junit.Assume; -import org.springframework.build.junit.TestGroup; +import org.springframework.tests.Assume; +import org.springframework.tests.TestGroup; import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; import org.springframework.expression.ExpressionParser; @@ -54,7 +55,7 @@ public class PerformanceTests { for (int i = 0; i < ITERATIONS; i++) { Expression expr = parser.parseExpression("placeOfBirth.city"); if (expr == null) { - Assert.fail("Parser returned null for expression"); + fail("Parser returned null for expression"); } expr.getValue(eContext); } @@ -63,7 +64,7 @@ public class PerformanceTests { for (int i = 0; i < ITERATIONS; i++) { Expression expr = parser.parseExpression("placeOfBirth.city"); if (expr == null) { - Assert.fail("Parser returned null for expression"); + fail("Parser returned null for expression"); } expr.getValue(eContext); } @@ -75,7 +76,7 @@ public class PerformanceTests { Expression expr = parser.parseExpression("placeOfBirth.city"); if (expr == null) { - Assert.fail("Parser returned null for expression"); + fail("Parser returned null for expression"); } starttime = System.currentTimeMillis(); for (int i = 0; i < ITERATIONS; i++) { @@ -89,7 +90,7 @@ public class PerformanceTests { if (reuseTime > freshParseTime) { System.out.println("Fresh parse every time, ITERATIONS iterations = " + freshParseTime + "ms"); System.out.println("Reuse SpelExpression, ITERATIONS iterations = " + reuseTime + "ms"); - Assert.fail("Should have been quicker to reuse!"); + fail("Should have been quicker to reuse!"); } } @@ -104,7 +105,7 @@ public class PerformanceTests { for (int i = 0; i < ITERATIONS; i++) { Expression expr = parser.parseExpression("getPlaceOfBirth().getCity()"); if (expr == null) { - Assert.fail("Parser returned null for expression"); + fail("Parser returned null for expression"); } expr.getValue(eContext); } @@ -113,7 +114,7 @@ public class PerformanceTests { for (int i = 0; i < ITERATIONS; i++) { Expression expr = parser.parseExpression("getPlaceOfBirth().getCity()"); if (expr == null) { - Assert.fail("Parser returned null for expression"); + fail("Parser returned null for expression"); } expr.getValue(eContext); } @@ -125,7 +126,7 @@ public class PerformanceTests { Expression expr = parser.parseExpression("getPlaceOfBirth().getCity()"); if (expr == null) { - Assert.fail("Parser returned null for expression"); + fail("Parser returned null for expression"); } starttime = System.currentTimeMillis(); for (int i = 0; i < ITERATIONS; i++) { @@ -140,7 +141,7 @@ public class PerformanceTests { if (reuseTime > freshParseTime) { System.out.println("Fresh parse every time, ITERATIONS iterations = " + freshParseTime + "ms"); System.out.println("Reuse SpelExpression, ITERATIONS iterations = " + reuseTime + "ms"); - Assert.fail("Should have been quicker to reuse!"); + fail("Should have been quicker to reuse!"); } } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/PropertyAccessTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/PropertyAccessTests.java index 104000d878..117d7b87f2 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/PropertyAccessTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/PropertyAccessTests.java @@ -16,13 +16,15 @@ package org.springframework.expression.spel; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.util.ArrayList; import java.util.List; -import junit.framework.Assert; - import org.junit.Test; import org.springframework.core.convert.TypeDescriptor; import org.springframework.expression.AccessException; @@ -78,14 +80,14 @@ public class PropertyAccessTests extends ExpressionTestCase { EvaluationContext context = new StandardEvaluationContext(null); try { expr.getValue(context); - Assert.fail("Should have failed - default property resolver cannot resolve on null"); + fail("Should have failed - default property resolver cannot resolve on null"); } catch (Exception e) { checkException(e,SpelMessage.PROPERTY_OR_FIELD_NOT_READABLE_ON_NULL); } - Assert.assertFalse(expr.isWritable(context)); + assertFalse(expr.isWritable(context)); try { expr.setValue(context,"abc"); - Assert.fail("Should have failed - default property resolver cannot resolve on null"); + fail("Should have failed - default property resolver cannot resolve on null"); } catch (Exception e) { checkException(e,SpelMessage.PROPERTY_OR_FIELD_NOT_WRITABLE_ON_NULL); } @@ -94,9 +96,9 @@ public class PropertyAccessTests extends ExpressionTestCase { private void checkException(Exception e, SpelMessage expectedMessage) { if (e instanceof SpelEvaluationException) { SpelMessage sm = ((SpelEvaluationException)e).getMessageCode(); - Assert.assertEquals("Expected exception type did not occur",expectedMessage,sm); + assertEquals("Expected exception type did not occur",expectedMessage,sm); } else { - Assert.fail("Should be a SpelException "+e); + fail("Should be a SpelException "+e); } } @@ -112,22 +114,22 @@ public class PropertyAccessTests extends ExpressionTestCase { ctx.addPropertyAccessor(new StringyPropertyAccessor()); Expression expr = parser.parseRaw("new String('hello').flibbles"); Integer i = expr.getValue(ctx, Integer.class); - Assert.assertEquals((int) i, 7); + assertEquals((int) i, 7); // The reflection one will be used for other properties... expr = parser.parseRaw("new String('hello').CASE_INSENSITIVE_ORDER"); Object o = expr.getValue(ctx); - Assert.assertNotNull(o); + assertNotNull(o); expr = parser.parseRaw("new String('hello').flibbles"); expr.setValue(ctx, 99); i = expr.getValue(ctx, Integer.class); - Assert.assertEquals((int) i, 99); + assertEquals((int) i, 99); // Cannot set it to a string value try { expr.setValue(ctx, "not allowed"); - Assert.fail("Should not have been allowed"); + fail("Should not have been allowed"); } catch (EvaluationException e) { // success - message will be: EL1063E:(pos 20): A problem occurred whilst attempting to set the property // 'flibbles': 'Cannot set flibbles to an object of type 'class java.lang.String'' @@ -141,20 +143,20 @@ public class PropertyAccessTests extends ExpressionTestCase { // reflective property accessor is the only one by default List propertyAccessors = ctx.getPropertyAccessors(); - Assert.assertEquals(1,propertyAccessors.size()); + assertEquals(1,propertyAccessors.size()); StringyPropertyAccessor spa = new StringyPropertyAccessor(); ctx.addPropertyAccessor(spa); - Assert.assertEquals(2,ctx.getPropertyAccessors().size()); + assertEquals(2,ctx.getPropertyAccessors().size()); List copy = new ArrayList(); copy.addAll(ctx.getPropertyAccessors()); - Assert.assertTrue(ctx.removePropertyAccessor(spa)); - Assert.assertFalse(ctx.removePropertyAccessor(spa)); - Assert.assertEquals(1,ctx.getPropertyAccessors().size()); + assertTrue(ctx.removePropertyAccessor(spa)); + assertFalse(ctx.removePropertyAccessor(spa)); + assertEquals(1,ctx.getPropertyAccessors().size()); ctx.setPropertyAccessors(copy); - Assert.assertEquals(2,ctx.getPropertyAccessors().size()); + assertEquals(2,ctx.getPropertyAccessors().size()); } @Test diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/ScenariosForSpringSecurity.java b/spring-expression/src/test/java/org/springframework/expression/spel/ScenariosForSpringSecurity.java index 568bdfad27..ca44e2e762 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/ScenariosForSpringSecurity.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/ScenariosForSpringSecurity.java @@ -16,11 +16,13 @@ package org.springframework.expression.spel; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.lang.reflect.Method; import java.util.List; -import junit.framework.Assert; - import org.junit.Test; import org.springframework.core.MethodParameter; import org.springframework.core.convert.TypeDescriptor; @@ -54,15 +56,15 @@ public class ScenariosForSpringSecurity extends ExpressionTestCase { ctx.setRootObject(new Person("Ben")); Boolean value = expr.getValue(ctx,Boolean.class); - Assert.assertFalse(value); + assertFalse(value); ctx.setRootObject(new Manager("Luke")); value = expr.getValue(ctx,Boolean.class); - Assert.assertTrue(value); + assertTrue(value); } catch (EvaluationException ee) { ee.printStackTrace(); - Assert.fail("Unexpected SpelException: " + ee.getMessage()); + fail("Unexpected SpelException: " + ee.getMessage()); } } @@ -79,11 +81,11 @@ public class ScenariosForSpringSecurity extends ExpressionTestCase { ctx.setRootObject(new Person("Andy")); Boolean value = expr.getValue(ctx,Boolean.class); - Assert.assertTrue(value); + assertTrue(value); ctx.setRootObject(new Person("Christian")); value = expr.getValue(ctx,Boolean.class); - Assert.assertFalse(value); + assertFalse(value); // (2) Or register an accessor that can understand 'p' and return the right person expr = parser.parseRaw("p.name == principal.name"); @@ -94,11 +96,11 @@ public class ScenariosForSpringSecurity extends ExpressionTestCase { pAccessor.setPerson(new Person("Andy")); value = expr.getValue(ctx,Boolean.class); - Assert.assertTrue(value); + assertTrue(value); pAccessor.setPerson(new Person("Christian")); value = expr.getValue(ctx,Boolean.class); - Assert.assertFalse(value); + assertFalse(value); } @Test @@ -115,12 +117,12 @@ public class ScenariosForSpringSecurity extends ExpressionTestCase { ctx.setVariable("a",1.0d); // referenced as #a in the expression ctx.setRootObject(new Supervisor("Ben")); // so non-qualified references 'hasRole()' 'hasIpAddress()' are invoked against it value = expr.getValue(ctx,Boolean.class); - Assert.assertTrue(value); + assertTrue(value); ctx.setRootObject(new Manager("Luke")); ctx.setVariable("a",1.043d); value = expr.getValue(ctx,Boolean.class); - Assert.assertFalse(value); + assertFalse(value); } // Here i'm going to change which hasRole() executes and make it one of my own Java methods @@ -141,7 +143,7 @@ public class ScenariosForSpringSecurity extends ExpressionTestCase { ctx.setVariable("a",1.0d); // referenced as #a in the expression value = expr.getValue(ctx,Boolean.class); - Assert.assertTrue(value); + assertTrue(value); // ctx.setRootObject(new Manager("Luke")); // ctx.setVariable("a",1.043d); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SetValueTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SetValueTests.java index 5c2a3de1f2..38ac64801b 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SetValueTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SetValueTests.java @@ -16,11 +16,15 @@ package org.springframework.expression.spel; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.util.Collection; import java.util.Set; -import junit.framework.Assert; - import org.junit.Test; import org.springframework.expression.EvaluationException; import org.springframework.expression.Expression; @@ -146,8 +150,8 @@ public class SetValueTests extends ExpressionTestCase { public void testAssign() throws Exception { StandardEvaluationContext eContext = TestScenarioCreator.getTestEvaluationContext(); Expression e = parse("publicName='Andy'"); - Assert.assertFalse(e.isWritable(eContext)); - Assert.assertEquals("Andy",e.getValue(eContext)); + assertFalse(e.isWritable(eContext)); + assertEquals("Andy",e.getValue(eContext)); } /* @@ -157,7 +161,7 @@ public class SetValueTests extends ExpressionTestCase { public void testSetGenericMapElementRequiresCoercion() throws Exception { StandardEvaluationContext eContext = TestScenarioCreator.getTestEvaluationContext(); Expression e = parse("mapOfStringToBoolean[42]"); - Assert.assertNull(e.getValue(eContext)); + assertNull(e.getValue(eContext)); // Key should be coerced to string representation of 42 e.setValue(eContext, "true"); @@ -165,18 +169,18 @@ public class SetValueTests extends ExpressionTestCase { // All keys should be strings Set ks = parse("mapOfStringToBoolean.keySet()").getValue(eContext,Set.class); for (Object o: ks) { - Assert.assertEquals(String.class,o.getClass()); + assertEquals(String.class,o.getClass()); } // All values should be booleans Collection vs = parse("mapOfStringToBoolean.values()").getValue(eContext,Collection.class); for (Object o: vs) { - Assert.assertEquals(Boolean.class,o.getClass()); + assertEquals(Boolean.class,o.getClass()); } // One final test check coercion on the key for a map lookup Object o = e.getValue(eContext); - Assert.assertEquals(Boolean.TRUE,o); + assertEquals(Boolean.TRUE,o); } @@ -191,17 +195,17 @@ public class SetValueTests extends ExpressionTestCase { try { Expression e = parser.parseExpression(expression); if (e == null) { - Assert.fail("Parser returned null for expression"); + fail("Parser returned null for expression"); } if (DEBUG) { SpelUtilities.printAbstractSyntaxTree(System.out, e); } StandardEvaluationContext lContext = TestScenarioCreator.getTestEvaluationContext(); e.setValue(lContext, value); - Assert.fail("expected an error"); + fail("expected an error"); } catch (ParseException pe) { pe.printStackTrace(); - Assert.fail("Unexpected Exception: " + pe.getMessage()); + fail("Unexpected Exception: " + pe.getMessage()); } catch (EvaluationException ee) { // success! } @@ -211,21 +215,21 @@ public class SetValueTests extends ExpressionTestCase { try { Expression e = parser.parseExpression(expression); if (e == null) { - Assert.fail("Parser returned null for expression"); + fail("Parser returned null for expression"); } if (DEBUG) { SpelUtilities.printAbstractSyntaxTree(System.out, e); } StandardEvaluationContext lContext = TestScenarioCreator.getTestEvaluationContext(); - Assert.assertTrue("Expression is not writeable but should be", e.isWritable(lContext)); + assertTrue("Expression is not writeable but should be", e.isWritable(lContext)); e.setValue(lContext, value); - Assert.assertEquals("Retrieved value was not equal to set value", value, e.getValue(lContext,value.getClass())); + assertEquals("Retrieved value was not equal to set value", value, e.getValue(lContext,value.getClass())); } catch (EvaluationException ee) { ee.printStackTrace(); - Assert.fail("Unexpected Exception: " + ee.getMessage()); + fail("Unexpected Exception: " + ee.getMessage()); } catch (ParseException pe) { pe.printStackTrace(); - Assert.fail("Unexpected Exception: " + pe.getMessage()); + fail("Unexpected Exception: " + pe.getMessage()); } } @@ -237,26 +241,26 @@ public class SetValueTests extends ExpressionTestCase { try { Expression e = parser.parseExpression(expression); if (e == null) { - Assert.fail("Parser returned null for expression"); + fail("Parser returned null for expression"); } if (DEBUG) { SpelUtilities.printAbstractSyntaxTree(System.out, e); } StandardEvaluationContext lContext = TestScenarioCreator.getTestEvaluationContext(); - Assert.assertTrue("Expression is not writeable but should be", e.isWritable(lContext)); + assertTrue("Expression is not writeable but should be", e.isWritable(lContext)); e.setValue(lContext, value); Object a = expectedValue; Object b = e.getValue(lContext); if (!a.equals(b)) { - Assert.fail("Not the same: ["+a+"] type="+a.getClass()+" ["+b+"] type="+b.getClass()); -// Assert.assertEquals("Retrieved value was not equal to set value", expectedValue, e.getValue(lContext)); + fail("Not the same: ["+a+"] type="+a.getClass()+" ["+b+"] type="+b.getClass()); +// assertEquals("Retrieved value was not equal to set value", expectedValue, e.getValue(lContext)); } } catch (EvaluationException ee) { ee.printStackTrace(); - Assert.fail("Unexpected Exception: " + ee.getMessage()); + fail("Unexpected Exception: " + ee.getMessage()); } catch (ParseException pe) { pe.printStackTrace(); - Assert.fail("Unexpected Exception: " + pe.getMessage()); + fail("Unexpected Exception: " + pe.getMessage()); } } } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java index d9b05524a7..9416ba87cf 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java @@ -16,6 +16,11 @@ package org.springframework.expression.spel; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + import java.util.ArrayList; import java.util.Arrays; import java.util.Date; @@ -24,8 +29,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import junit.framework.Assert; - import org.junit.Test; import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; @@ -122,7 +125,7 @@ public class SpelDocumentationTests extends ExpressionTestCase { context.setRootObject(tesla); String name = (String) exp.getValue(context); - Assert.assertEquals("Nikola Tesla",name); + assertEquals("Nikola Tesla",name); } @Test @@ -134,7 +137,7 @@ public class SpelDocumentationTests extends ExpressionTestCase { Expression exp = parser.parseExpression("name == 'Nikola Tesla'"); boolean isEqual = exp.getValue(context, Boolean.class); // evaluates to true - Assert.assertTrue(isEqual); + assertTrue(isEqual); } // Section 7.4.1 @@ -150,29 +153,29 @@ public class SpelDocumentationTests extends ExpressionTestCase { ExpressionParser parser = new SpelExpressionParser(); String helloWorld = (String) parser.parseExpression("'Hello World'").getValue(); // evals to "Hello World" - Assert.assertEquals("Hello World",helloWorld); + assertEquals("Hello World",helloWorld); double avogadrosNumber = (Double) parser.parseExpression("6.0221415E+23").getValue(); - Assert.assertEquals(6.0221415E+23,avogadrosNumber); + assertEquals(6.0221415E+23, avogadrosNumber, 0); int maxValue = (Integer) parser.parseExpression("0x7FFFFFFF").getValue(); // evals to 2147483647 - Assert.assertEquals(Integer.MAX_VALUE,maxValue); + assertEquals(Integer.MAX_VALUE,maxValue); boolean trueValue = (Boolean) parser.parseExpression("true").getValue(); - Assert.assertTrue(trueValue); + assertTrue(trueValue); Object nullValue = parser.parseExpression("null").getValue(); - Assert.assertNull(nullValue); + assertNull(nullValue); } @Test public void testPropertyAccess() throws Exception { EvaluationContext context = TestScenarioCreator.getTestEvaluationContext(); int year = (Integer) parser.parseExpression("Birthdate.Year + 1900").getValue(context); // 1856 - Assert.assertEquals(1856,year); + assertEquals(1856,year); String city = (String) parser.parseExpression("placeOfBirth.City").getValue(context); - Assert.assertEquals("SmilJan",city); + assertEquals("SmilJan",city); } @Test @@ -185,7 +188,7 @@ public class SpelDocumentationTests extends ExpressionTestCase { // evaluates to "Induction motor" String invention = parser.parseExpression("inventions[3]").getValue(teslaContext, String.class); - Assert.assertEquals("Induction motor",invention); + assertEquals("Induction motor",invention); // Members List StandardEvaluationContext societyContext = new StandardEvaluationContext(); @@ -195,12 +198,12 @@ public class SpelDocumentationTests extends ExpressionTestCase { // evaluates to "Nikola Tesla" String name = parser.parseExpression("Members[0].Name").getValue(societyContext, String.class); - Assert.assertEquals("Nikola Tesla",name); + assertEquals("Nikola Tesla",name); // List and Array navigation // evaluates to "Wireless communication" invention = parser.parseExpression("Members[0].Inventions[6]").getValue(societyContext, String.class); - Assert.assertEquals("Wireless communication",invention); + assertEquals("Wireless communication",invention); } @@ -216,12 +219,12 @@ public class SpelDocumentationTests extends ExpressionTestCase { // setting values Inventor i = parser.parseExpression("officers['advisors'][0]").getValue(societyContext,Inventor.class); - Assert.assertEquals("Nikola Tesla",i.getName()); + assertEquals("Nikola Tesla",i.getName()); parser.parseExpression("officers['advisors'][0].PlaceOfBirth.Country").setValue(societyContext, "Croatia"); Inventor i2 = parser.parseExpression("reverse[0]['advisors'][0]").getValue(societyContext,Inventor.class); - Assert.assertEquals("Nikola Tesla",i2.getName()); + assertEquals("Nikola Tesla",i2.getName()); } @@ -231,13 +234,13 @@ public class SpelDocumentationTests extends ExpressionTestCase { public void testMethodInvocation2() throws Exception { // string literal, evaluates to "bc" String c = parser.parseExpression("'abc'.substring(1, 3)").getValue(String.class); - Assert.assertEquals("bc",c); + assertEquals("bc",c); StandardEvaluationContext societyContext = new StandardEvaluationContext(); societyContext.setRootObject(new IEEE()); // evaluates to true boolean isMember = parser.parseExpression("isMember('Mihajlo Pupin')").getValue(societyContext, Boolean.class); - Assert.assertTrue(isMember); + assertTrue(isMember); } // 7.5.4.1 @@ -245,29 +248,29 @@ public class SpelDocumentationTests extends ExpressionTestCase { @Test public void testRelationalOperators() throws Exception { boolean result = parser.parseExpression("2 == 2").getValue(Boolean.class); - Assert.assertTrue(result); + assertTrue(result); // evaluates to false result = parser.parseExpression("2 < -5.0").getValue(Boolean.class); - Assert.assertFalse(result); + assertFalse(result); // evaluates to true result = parser.parseExpression("'black' < 'block'").getValue(Boolean.class); - Assert.assertTrue(result); + assertTrue(result); } @Test public void testOtherOperators() throws Exception { // evaluates to false boolean falseValue = parser.parseExpression("'xyz' instanceof T(int)").getValue(Boolean.class); - Assert.assertFalse(falseValue); + assertFalse(falseValue); // evaluates to true boolean trueValue = parser.parseExpression("'5.00' matches '^-?\\d+(\\.\\d{2})?$'").getValue(Boolean.class); - Assert.assertTrue(trueValue); + assertTrue(trueValue); //evaluates to false falseValue = parser.parseExpression("'5.0067' matches '^-?\\d+(\\.\\d{2})?$'").getValue(Boolean.class); - Assert.assertFalse(falseValue); + assertFalse(falseValue); } // 7.5.4.2 @@ -282,7 +285,7 @@ public class SpelDocumentationTests extends ExpressionTestCase { // evaluates to false boolean falseValue = parser.parseExpression("true and false").getValue(Boolean.class); - Assert.assertFalse(falseValue); + assertFalse(falseValue); // evaluates to true String expression = "isMember('Nikola Tesla') and isMember('Mihajlo Pupin')"; boolean trueValue = parser.parseExpression(expression).getValue(societyContext, Boolean.class); @@ -291,24 +294,24 @@ public class SpelDocumentationTests extends ExpressionTestCase { // evaluates to true trueValue = parser.parseExpression("true or false").getValue(Boolean.class); - Assert.assertTrue(trueValue); + assertTrue(trueValue); // evaluates to true expression = "isMember('Nikola Tesla') or isMember('Albert Einstien')"; trueValue = parser.parseExpression(expression).getValue(societyContext, Boolean.class); - Assert.assertTrue(trueValue); + assertTrue(trueValue); // -- NOT -- // evaluates to false falseValue = parser.parseExpression("!true").getValue(Boolean.class); - Assert.assertFalse(falseValue); + assertFalse(falseValue); // -- AND and NOT -- expression = "isMember('Nikola Tesla') and !isMember('Mihajlo Pupin')"; falseValue = parser.parseExpression(expression).getValue(societyContext, Boolean.class); - Assert.assertFalse(falseValue); + assertFalse(falseValue); } // 7.5.4.3 @@ -317,42 +320,42 @@ public class SpelDocumentationTests extends ExpressionTestCase { public void testNumericalOperators() throws Exception { // Addition int two = parser.parseExpression("1 + 1").getValue(Integer.class); // 2 - Assert.assertEquals(2,two); + assertEquals(2,two); String testString = parser.parseExpression("'test' + ' ' + 'string'").getValue(String.class); // 'test string' - Assert.assertEquals("test string",testString); + assertEquals("test string",testString); // Subtraction int four = parser.parseExpression("1 - -3").getValue(Integer.class); // 4 - Assert.assertEquals(4,four); + assertEquals(4,four); double d = parser.parseExpression("1000.00 - 1e4").getValue(Double.class); // -9000 - Assert.assertEquals(-9000.0d,d); + assertEquals(-9000.0d, d, 0); // Multiplication int six = parser.parseExpression("-2 * -3").getValue(Integer.class); // 6 - Assert.assertEquals(6,six); + assertEquals(6,six); double twentyFour = parser.parseExpression("2.0 * 3e0 * 4").getValue(Double.class); // 24.0 - Assert.assertEquals(24.0d,twentyFour); + assertEquals(24.0d, twentyFour, 0); // Division int minusTwo = parser.parseExpression("6 / -3").getValue(Integer.class); // -2 - Assert.assertEquals(-2,minusTwo); + assertEquals(-2,minusTwo); double one = parser.parseExpression("8.0 / 4e0 / 2").getValue(Double.class); // 1.0 - Assert.assertEquals(1.0d,one); + assertEquals(1.0d, one, 0); // Modulus int three = parser.parseExpression("7 % 4").getValue(Integer.class); // 3 - Assert.assertEquals(3,three); + assertEquals(3,three); int oneInt = parser.parseExpression("8 / 5 % 2").getValue(Integer.class); // 1 - Assert.assertEquals(1,oneInt); + assertEquals(1,oneInt); // Operator precedence int minusTwentyOne = parser.parseExpression("1+2-3*8").getValue(Integer.class); // -21 - Assert.assertEquals(-21,minusTwentyOne); + assertEquals(-21,minusTwentyOne); } // 7.5.5 @@ -365,12 +368,12 @@ public class SpelDocumentationTests extends ExpressionTestCase { parser.parseExpression("foo").setValue(inventorContext, "Alexander Seovic2"); - Assert.assertEquals("Alexander Seovic2",parser.parseExpression("foo").getValue(inventorContext,String.class)); + assertEquals("Alexander Seovic2",parser.parseExpression("foo").getValue(inventorContext,String.class)); // alternatively String aleks = parser.parseExpression("foo = 'Alexandar Seovic'").getValue(inventorContext, String.class); - Assert.assertEquals("Alexandar Seovic",parser.parseExpression("foo").getValue(inventorContext,String.class)); - Assert.assertEquals("Alexandar Seovic",aleks); + assertEquals("Alexandar Seovic",parser.parseExpression("foo").getValue(inventorContext,String.class)); + assertEquals("Alexandar Seovic",aleks); } // 7.5.6 @@ -378,9 +381,9 @@ public class SpelDocumentationTests extends ExpressionTestCase { @Test public void testTypes() throws Exception { Class dateClass = parser.parseExpression("T(java.util.Date)").getValue(Class.class); - Assert.assertEquals(Date.class,dateClass); + assertEquals(Date.class,dateClass); boolean trueValue = parser.parseExpression("T(java.math.RoundingMode).CEILING < T(java.math.RoundingMode).FLOOR").getValue(Boolean.class); - Assert.assertTrue(trueValue); + assertTrue(trueValue); } // 7.5.7 @@ -391,7 +394,7 @@ public class SpelDocumentationTests extends ExpressionTestCase { societyContext.setRootObject(new IEEE()); Inventor einstein = parser.parseExpression("new org.springframework.expression.spel.testresources.Inventor('Albert Einstein',new java.util.Date(), 'German')").getValue(Inventor.class); - Assert.assertEquals("Albert Einstein", einstein.getName()); + assertEquals("Albert Einstein", einstein.getName()); //create new inventor instance within add method of List parser.parseExpression("Members2.add(new org.springframework.expression.spel.testresources.Inventor('Albert Einstein', 'German'))").getValue(societyContext); } @@ -408,7 +411,7 @@ public class SpelDocumentationTests extends ExpressionTestCase { parser.parseExpression("foo = #newName").getValue(context); - Assert.assertEquals("Mike Tesla",tesla.getFoo()); + assertEquals("Mike Tesla",tesla.getFoo()); } @SuppressWarnings("unchecked") @@ -425,7 +428,7 @@ public class SpelDocumentationTests extends ExpressionTestCase { // all prime numbers > 10 from the list (using selection ?{...}) List primesGreaterThanTen = (List) parser.parseExpression("#primes.?[#this>10]").getValue(context); - Assert.assertEquals("[11, 13, 17]",primesGreaterThanTen.toString()); + assertEquals("[11, 13, 17]",primesGreaterThanTen.toString()); } // 7.5.9 @@ -439,7 +442,7 @@ public class SpelDocumentationTests extends ExpressionTestCase { "reverseString", new Class[] { String.class })); String helloWorldReversed = parser.parseExpression("#reverseString('hello world')").getValue(context, String.class); - Assert.assertEquals("dlrow olleh",helloWorldReversed); + assertEquals("dlrow olleh",helloWorldReversed); } // 7.5.10 @@ -447,7 +450,7 @@ public class SpelDocumentationTests extends ExpressionTestCase { @Test public void testTernary() throws Exception { String falseString = parser.parseExpression("false ? 'trueExp' : 'falseExp'").getValue(String.class); - Assert.assertEquals("falseExp",falseString); + assertEquals("falseExp",falseString); StandardEvaluationContext societyContext = new StandardEvaluationContext(); societyContext.setRootObject(new IEEE()); @@ -460,7 +463,7 @@ public class SpelDocumentationTests extends ExpressionTestCase { + "+ Name + ' Society' : #queryName + ' is not a member of the ' + Name + ' Society'"; String queryResultString = parser.parseExpression(expression).getValue(societyContext, String.class); - Assert.assertEquals("Nikola Tesla is a member of the IEEE Society",queryResultString); + assertEquals("Nikola Tesla is a member of the IEEE Society",queryResultString); // queryResultString = "Nikola Tesla is a member of the IEEE Society" } @@ -472,8 +475,8 @@ public class SpelDocumentationTests extends ExpressionTestCase { StandardEvaluationContext societyContext = new StandardEvaluationContext(); societyContext.setRootObject(new IEEE()); List list = (List) parser.parseExpression("Members2.?[nationality == 'Serbian']").getValue(societyContext); - Assert.assertEquals(1,list.size()); - Assert.assertEquals("Nikola Tesla",list.get(0).getName()); + assertEquals(1,list.size()); + assertEquals("Nikola Tesla",list.get(0).getName()); } // 7.5.12 @@ -482,7 +485,7 @@ public class SpelDocumentationTests extends ExpressionTestCase { public void testTemplating() throws Exception { String randomPhrase = parser.parseExpression("random number is ${T(java.lang.Math).random()}", new TemplatedParserContext()).getValue(String.class); - Assert.assertTrue(randomPhrase.startsWith("random number")); + assertTrue(randomPhrase.startsWith("random number")); } static class TemplatedParserContext implements ParserContext { diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/StandardTypeLocatorTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/StandardTypeLocatorTests.java index 545e313713..d2f1433ad3 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/StandardTypeLocatorTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/StandardTypeLocatorTests.java @@ -15,9 +15,12 @@ */ package org.springframework.expression.spel; -import java.util.List; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; -import junit.framework.Assert; +import java.util.List; import org.junit.Test; import org.springframework.expression.EvaluationException; @@ -33,28 +36,27 @@ public class StandardTypeLocatorTests { @Test public void testImports() throws EvaluationException { StandardTypeLocator locator = new StandardTypeLocator(); - Assert.assertEquals(Integer.class,locator.findType("java.lang.Integer")); - Assert.assertEquals(String.class,locator.findType("java.lang.String")); + assertEquals(Integer.class,locator.findType("java.lang.Integer")); + assertEquals(String.class,locator.findType("java.lang.String")); List prefixes = locator.getImportPrefixes(); - Assert.assertEquals(1,prefixes.size()); - Assert.assertTrue(prefixes.contains("java.lang")); - Assert.assertFalse(prefixes.contains("java.util")); + assertEquals(1,prefixes.size()); + assertTrue(prefixes.contains("java.lang")); + assertFalse(prefixes.contains("java.util")); - Assert.assertEquals(Boolean.class,locator.findType("Boolean")); + assertEquals(Boolean.class,locator.findType("Boolean")); // currently does not know about java.util by default // assertEquals(java.util.List.class,locator.findType("List")); try { locator.findType("URL"); - Assert.fail("Should have failed"); + fail("Should have failed"); } catch (EvaluationException ee) { SpelEvaluationException sEx = (SpelEvaluationException)ee; - Assert.assertEquals(SpelMessage.TYPE_NOT_FOUND,sEx.getMessageCode()); + assertEquals(SpelMessage.TYPE_NOT_FOUND,sEx.getMessageCode()); } locator.registerImport("java.net"); - Assert.assertEquals(java.net.URL.class,locator.findType("URL")); - + assertEquals(java.net.URL.class,locator.findType("URL")); } } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/TemplateExpressionParsingTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/TemplateExpressionParsingTests.java index 74fff9810e..a5216e9ca0 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/TemplateExpressionParsingTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/TemplateExpressionParsingTests.java @@ -16,7 +16,10 @@ package org.springframework.expression.spel; -import junit.framework.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import org.junit.Test; import org.springframework.expression.EvaluationContext; @@ -71,7 +74,7 @@ public class TemplateExpressionParsingTests extends ExpressionTestCase { SpelExpressionParser parser = new SpelExpressionParser(); Expression expr = parser.parseExpression("hello ${'world'}", DEFAULT_TEMPLATE_PARSER_CONTEXT); Object o = expr.getValue(); - Assert.assertEquals("hello world", o.toString()); + assertEquals("hello world", o.toString()); } @Test @@ -79,7 +82,7 @@ public class TemplateExpressionParsingTests extends ExpressionTestCase { SpelExpressionParser parser = new SpelExpressionParser(); Expression expr = parser.parseExpression("hello ${'to'} you", DEFAULT_TEMPLATE_PARSER_CONTEXT); Object o = expr.getValue(); - Assert.assertEquals("hello to you", o.toString()); + assertEquals("hello to you", o.toString()); } @Test @@ -88,7 +91,7 @@ public class TemplateExpressionParsingTests extends ExpressionTestCase { Expression expr = parser.parseExpression("The quick ${'brown'} fox jumped over the ${'lazy'} dog", DEFAULT_TEMPLATE_PARSER_CONTEXT); Object o = expr.getValue(); - Assert.assertEquals("The quick brown fox jumped over the lazy dog", o.toString()); + assertEquals("The quick brown fox jumped over the lazy dog", o.toString()); } @Test @@ -96,19 +99,19 @@ public class TemplateExpressionParsingTests extends ExpressionTestCase { SpelExpressionParser parser = new SpelExpressionParser(); Expression expr = parser.parseExpression("${'hello'} world", DEFAULT_TEMPLATE_PARSER_CONTEXT); Object o = expr.getValue(); - Assert.assertEquals("hello world", o.toString()); + assertEquals("hello world", o.toString()); expr = parser.parseExpression("", DEFAULT_TEMPLATE_PARSER_CONTEXT); o = expr.getValue(); - Assert.assertEquals("", o.toString()); + assertEquals("", o.toString()); expr = parser.parseExpression("abc", DEFAULT_TEMPLATE_PARSER_CONTEXT); o = expr.getValue(); - Assert.assertEquals("abc", o.toString()); + assertEquals("abc", o.toString()); expr = parser.parseExpression("abc", DEFAULT_TEMPLATE_PARSER_CONTEXT); o = expr.getValue((Object)null); - Assert.assertEquals("abc", o.toString()); + assertEquals("abc", o.toString()); } @Test @@ -128,35 +131,35 @@ public class TemplateExpressionParsingTests extends ExpressionTestCase { checkString("hello world", ex.getValue(ctx, new Rooty())); checkString("hello world", ex.getValue(ctx, new Rooty(), String.class)); checkString("hello world", ex.getValue(ctx, new Rooty(), String.class)); - Assert.assertEquals("hello ${'world'}", ex.getExpressionString()); - Assert.assertFalse(ex.isWritable(new StandardEvaluationContext())); - Assert.assertFalse(ex.isWritable(new Rooty())); - Assert.assertFalse(ex.isWritable(new StandardEvaluationContext(), new Rooty())); + assertEquals("hello ${'world'}", ex.getExpressionString()); + assertFalse(ex.isWritable(new StandardEvaluationContext())); + assertFalse(ex.isWritable(new Rooty())); + assertFalse(ex.isWritable(new StandardEvaluationContext(), new Rooty())); - Assert.assertEquals(String.class,ex.getValueType()); - Assert.assertEquals(String.class,ex.getValueType(ctx)); - Assert.assertEquals(String.class,ex.getValueTypeDescriptor().getType()); - Assert.assertEquals(String.class,ex.getValueTypeDescriptor(ctx).getType()); - Assert.assertEquals(String.class,ex.getValueType(new Rooty())); - Assert.assertEquals(String.class,ex.getValueType(ctx, new Rooty())); - Assert.assertEquals(String.class,ex.getValueTypeDescriptor(new Rooty()).getType()); - Assert.assertEquals(String.class,ex.getValueTypeDescriptor(ctx, new Rooty()).getType()); + assertEquals(String.class,ex.getValueType()); + assertEquals(String.class,ex.getValueType(ctx)); + assertEquals(String.class,ex.getValueTypeDescriptor().getType()); + assertEquals(String.class,ex.getValueTypeDescriptor(ctx).getType()); + assertEquals(String.class,ex.getValueType(new Rooty())); + assertEquals(String.class,ex.getValueType(ctx, new Rooty())); + assertEquals(String.class,ex.getValueTypeDescriptor(new Rooty()).getType()); + assertEquals(String.class,ex.getValueTypeDescriptor(ctx, new Rooty()).getType()); try { ex.setValue(ctx, null); - Assert.fail(); + fail(); } catch (EvaluationException ee) { // success } try { ex.setValue((Object)null, null); - Assert.fail(); + fail(); } catch (EvaluationException ee) { // success } try { ex.setValue(ctx, null, null); - Assert.fail(); + fail(); } catch (EvaluationException ee) { // success } @@ -170,34 +173,34 @@ public class TemplateExpressionParsingTests extends ExpressionTestCase { // treat the nested ${..} as a part of the expression Expression ex = parser.parseExpression("hello ${listOfNumbersUpToTen.$[#this<5]} world",DEFAULT_TEMPLATE_PARSER_CONTEXT); String s = ex.getValue(TestScenarioCreator.getTestEvaluationContext(),String.class); - Assert.assertEquals("hello 4 world",s); + assertEquals("hello 4 world",s); // not a useful expression but tests nested expression syntax that clashes with template prefix/suffix ex = parser.parseExpression("hello ${listOfNumbersUpToTen.$[#root.listOfNumbersUpToTen.$[#this%2==1]==3]} world",DEFAULT_TEMPLATE_PARSER_CONTEXT); - Assert.assertEquals(CompositeStringExpression.class,ex.getClass()); + assertEquals(CompositeStringExpression.class,ex.getClass()); CompositeStringExpression cse = (CompositeStringExpression)ex; Expression[] exprs = cse.getExpressions(); - Assert.assertEquals(3,exprs.length); - Assert.assertEquals("listOfNumbersUpToTen.$[#root.listOfNumbersUpToTen.$[#this%2==1]==3]",exprs[1].getExpressionString()); + assertEquals(3,exprs.length); + assertEquals("listOfNumbersUpToTen.$[#root.listOfNumbersUpToTen.$[#this%2==1]==3]",exprs[1].getExpressionString()); s = ex.getValue(TestScenarioCreator.getTestEvaluationContext(),String.class); - Assert.assertEquals("hello world",s); + assertEquals("hello world",s); ex = parser.parseExpression("hello ${listOfNumbersUpToTen.$[#this<5]} ${listOfNumbersUpToTen.$[#this>5]} world",DEFAULT_TEMPLATE_PARSER_CONTEXT); s = ex.getValue(TestScenarioCreator.getTestEvaluationContext(),String.class); - Assert.assertEquals("hello 4 10 world",s); + assertEquals("hello 4 10 world",s); try { ex = parser.parseExpression("hello ${listOfNumbersUpToTen.$[#this<5]} ${listOfNumbersUpToTen.$[#this>5] world",DEFAULT_TEMPLATE_PARSER_CONTEXT); - Assert.fail("Should have failed"); + fail("Should have failed"); } catch (ParseException pe) { - Assert.assertEquals("No ending suffix '}' for expression starting at character 41: ${listOfNumbersUpToTen.$[#this>5] world",pe.getMessage()); + assertEquals("No ending suffix '}' for expression starting at character 41: ${listOfNumbersUpToTen.$[#this>5] world",pe.getMessage()); } try { ex = parser.parseExpression("hello ${listOfNumbersUpToTen.$[#root.listOfNumbersUpToTen.$[#this%2==1==3]} world",DEFAULT_TEMPLATE_PARSER_CONTEXT); - Assert.fail("Should have failed"); + fail("Should have failed"); } catch (ParseException pe) { - Assert.assertEquals("Found closing '}' at position 74 but most recent opening is '[' at position 30",pe.getMessage()); + assertEquals("Found closing '}' at position 74 but most recent opening is '[' at position 30",pe.getMessage()); } } @@ -207,74 +210,74 @@ public class TemplateExpressionParsingTests extends ExpressionTestCase { // Just wanting to use the prefix or suffix within the template: Expression ex = parser.parseExpression("hello ${3+4} world",DEFAULT_TEMPLATE_PARSER_CONTEXT); String s = ex.getValue(TestScenarioCreator.getTestEvaluationContext(),String.class); - Assert.assertEquals("hello 7 world",s); + assertEquals("hello 7 world",s); ex = parser.parseExpression("hello ${3+4} wo${'${'}rld",DEFAULT_TEMPLATE_PARSER_CONTEXT); s = ex.getValue(TestScenarioCreator.getTestEvaluationContext(),String.class); - Assert.assertEquals("hello 7 wo${rld",s); + assertEquals("hello 7 wo${rld",s); ex = parser.parseExpression("hello ${3+4} wo}rld",DEFAULT_TEMPLATE_PARSER_CONTEXT); s = ex.getValue(TestScenarioCreator.getTestEvaluationContext(),String.class); - Assert.assertEquals("hello 7 wo}rld",s); + assertEquals("hello 7 wo}rld",s); } @Test public void testParsingNormalExpressionThroughTemplateParser() throws Exception { Expression expr = parser.parseExpression("1+2+3"); - Assert.assertEquals(6,expr.getValue()); + assertEquals(6,expr.getValue()); expr = parser.parseExpression("1+2+3",null); - Assert.assertEquals(6,expr.getValue()); + assertEquals(6,expr.getValue()); } @Test public void testErrorCases() throws Exception { try { parser.parseExpression("hello ${'world'", DEFAULT_TEMPLATE_PARSER_CONTEXT); - Assert.fail("Should have failed"); + fail("Should have failed"); } catch (ParseException pe) { - Assert.assertEquals("No ending suffix '}' for expression starting at character 6: ${'world'",pe.getMessage()); - Assert.assertEquals("hello ${'world'",pe.getExpressionString()); + assertEquals("No ending suffix '}' for expression starting at character 6: ${'world'",pe.getMessage()); + assertEquals("hello ${'world'",pe.getExpressionString()); } try { parser.parseExpression("hello ${'wibble'${'world'}", DEFAULT_TEMPLATE_PARSER_CONTEXT); - Assert.fail("Should have failed"); + fail("Should have failed"); } catch (ParseException pe) { - Assert.assertEquals("No ending suffix '}' for expression starting at character 6: ${'wibble'${'world'}",pe.getMessage()); + assertEquals("No ending suffix '}' for expression starting at character 6: ${'wibble'${'world'}",pe.getMessage()); } try { parser.parseExpression("hello ${} world", DEFAULT_TEMPLATE_PARSER_CONTEXT); - Assert.fail("Should have failed"); + fail("Should have failed"); } catch (ParseException pe) { - Assert.assertEquals("No expression defined within delimiter '${}' at character 6",pe.getMessage()); + assertEquals("No expression defined within delimiter '${}' at character 6",pe.getMessage()); } } @Test public void testTemplateParserContext() { TemplateParserContext tpc = new TemplateParserContext("abc","def"); - Assert.assertEquals("abc", tpc.getExpressionPrefix()); - Assert.assertEquals("def", tpc.getExpressionSuffix()); - Assert.assertTrue(tpc.isTemplate()); + assertEquals("abc", tpc.getExpressionPrefix()); + assertEquals("def", tpc.getExpressionSuffix()); + assertTrue(tpc.isTemplate()); tpc = new TemplateParserContext(); - Assert.assertEquals("#{", tpc.getExpressionPrefix()); - Assert.assertEquals("}", tpc.getExpressionSuffix()); - Assert.assertTrue(tpc.isTemplate()); + assertEquals("#{", tpc.getExpressionPrefix()); + assertEquals("}", tpc.getExpressionSuffix()); + assertTrue(tpc.isTemplate()); ParserContext pc = ParserContext.TEMPLATE_EXPRESSION; - Assert.assertEquals("#{", pc.getExpressionPrefix()); - Assert.assertEquals("}", pc.getExpressionSuffix()); - Assert.assertTrue(pc.isTemplate()); + assertEquals("#{", pc.getExpressionPrefix()); + assertEquals("}", pc.getExpressionSuffix()); + assertTrue(pc.isTemplate()); } // --- private void checkString(String expectedString, Object value) { if (!(value instanceof String)) { - Assert.fail("Result was not a string, it was of type " + value.getClass() + " (value=" + value + ")"); + fail("Result was not a string, it was of type " + value.getClass() + " (value=" + value + ")"); } if (!value.equals(expectedString)) { - Assert.fail("Did not get expected result. Should have been '" + expectedString + "' but was '" + value + "'"); + fail("Did not get expected result. Should have been '" + expectedString + "' but was '" + value + "'"); } } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/VariableAndFunctionTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/VariableAndFunctionTests.java index 59c61a73d1..78b3dfbede 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/VariableAndFunctionTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/VariableAndFunctionTests.java @@ -16,7 +16,7 @@ package org.springframework.expression.spel; -import junit.framework.Assert; +import static org.junit.Assert.fail; import org.junit.Test; import org.springframework.expression.spel.standard.SpelExpressionParser; @@ -77,11 +77,11 @@ public class VariableAndFunctionTests extends ExpressionTestCase { try { @SuppressWarnings("unused") Object v = parser.parseRaw("#notStatic()").getValue(ctx); - Assert.fail("Should have failed with exception - cannot call non static method that way"); + fail("Should have failed with exception - cannot call non static method that way"); } catch (SpelEvaluationException se) { if (se.getMessageCode() != SpelMessage.FUNCTION_MUST_BE_STATIC) { se.printStackTrace(); - Assert.fail("Should have failed a message about the function needing to be static, not: " + fail("Should have failed a message about the function needing to be static, not: " + se.getMessageCode()); } } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java index 85764aa7a2..c31a94a71b 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java @@ -16,15 +16,20 @@ package org.springframework.expression.spel.support; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; -import junit.framework.Assert; import org.junit.Test; - import org.springframework.core.convert.TypeDescriptor; import org.springframework.expression.EvaluationContext; import org.springframework.expression.ParseException; @@ -47,19 +52,19 @@ public class ReflectionHelperTests extends ExpressionTestCase { @Test public void testFormatHelperForClassName() { - Assert.assertEquals("java.lang.String",FormatHelper.formatClassNameForMessage(String.class)); - Assert.assertEquals("java.lang.String[]",FormatHelper.formatClassNameForMessage(new String[1].getClass())); - Assert.assertEquals("int[]",FormatHelper.formatClassNameForMessage(new int[1].getClass())); - Assert.assertEquals("int[][]",FormatHelper.formatClassNameForMessage(new int[1][2].getClass())); - Assert.assertEquals("null",FormatHelper.formatClassNameForMessage(null)); + assertEquals("java.lang.String",FormatHelper.formatClassNameForMessage(String.class)); + assertEquals("java.lang.String[]",FormatHelper.formatClassNameForMessage(new String[1].getClass())); + assertEquals("int[]",FormatHelper.formatClassNameForMessage(new int[1].getClass())); + assertEquals("int[][]",FormatHelper.formatClassNameForMessage(new int[1][2].getClass())); + assertEquals("null",FormatHelper.formatClassNameForMessage(null)); } /* @Test public void testFormatHelperForMethod() { - Assert.assertEquals("foo(java.lang.String)",FormatHelper.formatMethodForMessage("foo", String.class)); - Assert.assertEquals("goo(java.lang.String,int[])",FormatHelper.formatMethodForMessage("goo", String.class,new int[1].getClass())); - Assert.assertEquals("boo()",FormatHelper.formatMethodForMessage("boo")); + assertEquals("foo(java.lang.String)",FormatHelper.formatMethodForMessage("foo", String.class)); + assertEquals("goo(java.lang.String,int[])",FormatHelper.formatMethodForMessage("goo", String.class,new int[1].getClass())); + assertEquals("boo()",FormatHelper.formatMethodForMessage("boo")); } */ @@ -90,15 +95,15 @@ public class ReflectionHelperTests extends ExpressionTestCase { // CompoundExpression value:2 // IntLiteral value:2 // ===> Expression '3+4+5+6+7-2' - AST end - Assert.assertTrue(s.indexOf("===> Expression '3+4+5+6+7-2' - AST start")!=-1); - Assert.assertTrue(s.indexOf(" OpPlus value:((((3 + 4) + 5) + 6) + 7) #children:2")!=-1); + assertTrue(s.indexOf("===> Expression '3+4+5+6+7-2' - AST start")!=-1); + assertTrue(s.indexOf(" OpPlus value:((((3 + 4) + 5) + 6) + 7) #children:2")!=-1); } @Test public void testTypedValue() { TypedValue tValue = new TypedValue("hello"); - Assert.assertEquals(String.class,tValue.getTypeDescriptor().getType()); - Assert.assertEquals("TypedValue: 'hello' of [java.lang.String]",tValue.toString()); + assertEquals(String.class,tValue.getTypeDescriptor().getType()); + assertEquals("TypedValue: 'hello' of [java.lang.String]",tValue.toString()); } @Test @@ -256,10 +261,10 @@ public class ReflectionHelperTests extends ExpressionTestCase { args = new Object[]{3,false,3.0f}; try { ReflectionHelper.convertAllArguments(null, args, twoArg); - Assert.fail("Should have failed because no converter supplied"); + fail("Should have failed because no converter supplied"); } catch (SpelEvaluationException se) { - Assert.assertEquals(SpelMessage.TYPE_CONVERSION_ERROR,se.getMessageCode()); + assertEquals(SpelMessage.TYPE_CONVERSION_ERROR,se.getMessageCode()); } // null value @@ -272,14 +277,14 @@ public class ReflectionHelperTests extends ExpressionTestCase { public void testSetupArguments() { Object[] newArray = ReflectionHelper.setupArgumentsForVarargsInvocation(new Class[]{new String[0].getClass()},"a","b","c"); - Assert.assertEquals(1,newArray.length); + assertEquals(1,newArray.length); Object firstParam = newArray[0]; - Assert.assertEquals(String.class,firstParam.getClass().getComponentType()); + assertEquals(String.class,firstParam.getClass().getComponentType()); Object[] firstParamArray = (Object[])firstParam; - Assert.assertEquals(3,firstParamArray.length); - Assert.assertEquals("a",firstParamArray[0]); - Assert.assertEquals("b",firstParamArray[1]); - Assert.assertEquals("c",firstParamArray[2]); + assertEquals(3,firstParamArray.length); + assertEquals("a",firstParamArray[0]); + assertEquals("b",firstParamArray[1]); + assertEquals("c",firstParamArray[2]); } @Test @@ -288,19 +293,19 @@ public class ReflectionHelperTests extends ExpressionTestCase { Tester t = new Tester(); t.setProperty("hello"); EvaluationContext ctx = new StandardEvaluationContext(t); - Assert.assertTrue(rpr.canRead(ctx, t, "property")); - Assert.assertEquals("hello",rpr.read(ctx, t, "property").getValue()); - Assert.assertEquals("hello",rpr.read(ctx, t, "property").getValue()); // cached accessor used + assertTrue(rpr.canRead(ctx, t, "property")); + assertEquals("hello",rpr.read(ctx, t, "property").getValue()); + assertEquals("hello",rpr.read(ctx, t, "property").getValue()); // cached accessor used - Assert.assertTrue(rpr.canRead(ctx, t, "field")); - Assert.assertEquals(3,rpr.read(ctx, t, "field").getValue()); - Assert.assertEquals(3,rpr.read(ctx, t, "field").getValue()); // cached accessor used + assertTrue(rpr.canRead(ctx, t, "field")); + assertEquals(3,rpr.read(ctx, t, "field").getValue()); + assertEquals(3,rpr.read(ctx, t, "field").getValue()); // cached accessor used - Assert.assertTrue(rpr.canWrite(ctx, t, "property")); + assertTrue(rpr.canWrite(ctx, t, "property")); rpr.write(ctx, t, "property","goodbye"); rpr.write(ctx, t, "property","goodbye"); // cached accessor used - Assert.assertTrue(rpr.canWrite(ctx, t, "field")); + assertTrue(rpr.canWrite(ctx, t, "field")); rpr.write(ctx, t, "field",12); rpr.write(ctx, t, "field",12); @@ -308,27 +313,31 @@ public class ReflectionHelperTests extends ExpressionTestCase { // of populating type descriptor cache rpr.write(ctx,t,"field2",3); rpr.write(ctx, t, "property2","doodoo"); - Assert.assertEquals(3,rpr.read(ctx,t,"field2").getValue()); + assertEquals(3,rpr.read(ctx,t,"field2").getValue()); // Attempted read as first activity on this field and property (no canRead before them) - Assert.assertEquals(0,rpr.read(ctx,t,"field3").getValue()); - Assert.assertEquals("doodoo",rpr.read(ctx,t,"property3").getValue()); + assertEquals(0,rpr.read(ctx,t,"field3").getValue()); + assertEquals("doodoo",rpr.read(ctx,t,"property3").getValue()); // Access through is method -// Assert.assertEquals(0,rpr.read(ctx,t,"field3").getValue()); - Assert.assertEquals(false,rpr.read(ctx,t,"property4").getValue()); - Assert.assertTrue(rpr.canRead(ctx,t,"property4")); +// assertEquals(0,rpr.read(ctx,t,"field3").getValue()); + assertEquals(false,rpr.read(ctx,t,"property4").getValue()); + assertTrue(rpr.canRead(ctx,t,"property4")); // repro SPR-9123, ReflectivePropertyAccessor JavaBean property names compliance tests - Assert.assertEquals("iD",rpr.read(ctx,t,"iD").getValue()); - Assert.assertTrue(rpr.canRead(ctx,t,"iD")); - Assert.assertEquals("id",rpr.read(ctx,t,"id").getValue()); - Assert.assertTrue(rpr.canRead(ctx,t,"id")); - Assert.assertEquals("ID",rpr.read(ctx,t,"ID").getValue()); - Assert.assertTrue(rpr.canRead(ctx,t,"ID")); + assertEquals("iD",rpr.read(ctx,t,"iD").getValue()); + assertTrue(rpr.canRead(ctx,t,"iD")); + assertEquals("id",rpr.read(ctx,t,"id").getValue()); + assertTrue(rpr.canRead(ctx,t,"id")); + assertEquals("ID",rpr.read(ctx,t,"ID").getValue()); + assertTrue(rpr.canRead(ctx,t,"ID")); // note: "Id" is not a valid JavaBean name, nevertheless it is treated as "id" - Assert.assertEquals("id",rpr.read(ctx,t,"Id").getValue()); - Assert.assertTrue(rpr.canRead(ctx,t,"Id")); + assertEquals("id",rpr.read(ctx,t,"Id").getValue()); + assertTrue(rpr.canRead(ctx,t,"Id")); + + // SPR-10122, ReflectivePropertyAccessor JavaBean property names compliance tests - setters + rpr.write(ctx, t, "pEBS","Test String"); + assertEquals("Test String",rpr.read(ctx,t,"pEBS").getValue()); } @Test @@ -337,68 +346,68 @@ public class ReflectionHelperTests extends ExpressionTestCase { Tester t = new Tester(); t.setProperty("hello"); EvaluationContext ctx = new StandardEvaluationContext(t); -// Assert.assertTrue(rpr.canRead(ctx, t, "property")); -// Assert.assertEquals("hello",rpr.read(ctx, t, "property").getValue()); -// Assert.assertEquals("hello",rpr.read(ctx, t, "property").getValue()); // cached accessor used +// assertTrue(rpr.canRead(ctx, t, "property")); +// assertEquals("hello",rpr.read(ctx, t, "property").getValue()); +// assertEquals("hello",rpr.read(ctx, t, "property").getValue()); // cached accessor used PropertyAccessor optA = rpr.createOptimalAccessor(ctx, t, "property"); - Assert.assertTrue(optA.canRead(ctx, t, "property")); - Assert.assertFalse(optA.canRead(ctx, t, "property2")); + assertTrue(optA.canRead(ctx, t, "property")); + assertFalse(optA.canRead(ctx, t, "property2")); try { optA.canWrite(ctx, t, "property"); - Assert.fail(); + fail(); } catch (UnsupportedOperationException uoe) { // success } try { optA.canWrite(ctx, t, "property2"); - Assert.fail(); + fail(); } catch (UnsupportedOperationException uoe) { // success } - Assert.assertEquals("hello",optA.read(ctx, t, "property").getValue()); - Assert.assertEquals("hello",optA.read(ctx, t, "property").getValue()); // cached accessor used + assertEquals("hello",optA.read(ctx, t, "property").getValue()); + assertEquals("hello",optA.read(ctx, t, "property").getValue()); // cached accessor used try { optA.getSpecificTargetClasses(); - Assert.fail(); + fail(); } catch (UnsupportedOperationException uoe) { // success } try { optA.write(ctx,t,"property",null); - Assert.fail(); + fail(); } catch (UnsupportedOperationException uoe) { // success } optA = rpr.createOptimalAccessor(ctx, t, "field"); - Assert.assertTrue(optA.canRead(ctx, t, "field")); - Assert.assertFalse(optA.canRead(ctx, t, "field2")); + assertTrue(optA.canRead(ctx, t, "field")); + assertFalse(optA.canRead(ctx, t, "field2")); try { optA.canWrite(ctx, t, "field"); - Assert.fail(); + fail(); } catch (UnsupportedOperationException uoe) { // success } try { optA.canWrite(ctx, t, "field2"); - Assert.fail(); + fail(); } catch (UnsupportedOperationException uoe) { // success } - Assert.assertEquals(3,optA.read(ctx, t, "field").getValue()); - Assert.assertEquals(3,optA.read(ctx, t, "field").getValue()); // cached accessor used + assertEquals(3,optA.read(ctx, t, "field").getValue()); + assertEquals(3,optA.read(ctx, t, "field").getValue()); // cached accessor used try { optA.getSpecificTargetClasses(); - Assert.fail(); + fail(); } catch (UnsupportedOperationException uoe) { // success } try { optA.write(ctx,t,"field",null); - Assert.fail(); + fail(); } catch (UnsupportedOperationException uoe) { // success } @@ -419,6 +428,7 @@ public class ReflectionHelperTests extends ExpressionTestCase { String iD = "iD"; String id = "id"; String ID = "ID"; + String pEBS = "pEBS"; public String getProperty() { return property; } public void setProperty(String value) { property = value; } @@ -434,6 +444,14 @@ public class ReflectionHelperTests extends ExpressionTestCase { public String getId() { return id; } public String getID() { return ID; } + + public String getpEBS() { + return pEBS; + } + + public void setpEBS(String pEBS) { + this.pEBS = pEBS; + } } static class Super { @@ -452,25 +470,25 @@ public class ReflectionHelperTests extends ExpressionTestCase { private void checkMatch(Class[] inputTypes, Class[] expectedTypes, StandardTypeConverter typeConverter,ArgsMatchKind expectedMatchKind,int... argsForConversion) { ReflectionHelper.ArgumentsMatchInfo matchInfo = ReflectionHelper.compareArguments(getTypeDescriptors(expectedTypes), getTypeDescriptors(inputTypes), typeConverter); if (expectedMatchKind==null) { - Assert.assertNull("Did not expect them to match in any way", matchInfo); + assertNull("Did not expect them to match in any way", matchInfo); } else { - Assert.assertNotNull("Should not be a null match", matchInfo); + assertNotNull("Should not be a null match", matchInfo); } if (expectedMatchKind==ArgsMatchKind.EXACT) { - Assert.assertTrue(matchInfo.isExactMatch()); - Assert.assertNull(matchInfo.argsRequiringConversion); + assertTrue(matchInfo.isExactMatch()); + assertNull(matchInfo.argsRequiringConversion); } else if (expectedMatchKind==ArgsMatchKind.CLOSE) { - Assert.assertTrue(matchInfo.isCloseMatch()); - Assert.assertNull(matchInfo.argsRequiringConversion); + assertTrue(matchInfo.isCloseMatch()); + assertNull(matchInfo.argsRequiringConversion); } else if (expectedMatchKind==ArgsMatchKind.REQUIRES_CONVERSION) { - Assert.assertTrue("expected to be a match requiring conversion, but was "+matchInfo,matchInfo.isMatchRequiringConversion()); + assertTrue("expected to be a match requiring conversion, but was "+matchInfo,matchInfo.isMatchRequiringConversion()); if (argsForConversion==null) { - Assert.fail("there are arguments that need conversion"); + fail("there are arguments that need conversion"); } - Assert.assertEquals("The array of args that need conversion is different length to that expected",argsForConversion.length, matchInfo.argsRequiringConversion.length); + assertEquals("The array of args that need conversion is different length to that expected",argsForConversion.length, matchInfo.argsRequiringConversion.length); for (int a=0;a getTypeDescriptors(Class... types) { diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/config/JdbcNamespaceIntegrationTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/config/JdbcNamespaceIntegrationTests.java index 3419ccd417..0238a203bc 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/config/JdbcNamespaceIntegrationTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/config/JdbcNamespaceIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 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. @@ -16,16 +16,20 @@ package org.springframework.jdbc.config; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; + import javax.sql.DataSource; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; - import org.springframework.beans.PropertyValue; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.core.io.ClassPathResource; @@ -34,9 +38,6 @@ import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactoryBean; import org.springframework.jdbc.datasource.init.DataSourceInitializer; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; - /** * @author Dave Syer * @author Juergen Hoeller @@ -123,7 +124,8 @@ public class JdbcNamespaceIntegrationTests { @Test public void testMultipleDataSourcesHaveDifferentDatabaseNames() throws Exception { - DefaultListableBeanFactory factory = new XmlBeanFactory(new ClassPathResource( + DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(factory).loadBeanDefinitions(new ClassPathResource( "org/springframework/jdbc/config/jdbc-config-multiple-datasources.xml")); assertBeanPropertyValueOf("databaseName", "firstDataSource", factory); assertBeanPropertyValueOf("databaseName", "secondDataSource", factory); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/JdbcTemplateTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/JdbcTemplateTests.java index 6b9c9840ab..3c4e1bc73a 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/JdbcTemplateTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/JdbcTemplateTests.java @@ -18,7 +18,6 @@ package org.springframework.jdbc.core; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.Matchers.isA; import static org.hamcrest.Matchers.sameInstance; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -35,7 +34,7 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.springframework.build.test.hamcrest.Matchers.exceptionCause; +import static org.springframework.tests.Matchers.exceptionCause; import java.sql.CallableStatement; import java.sql.Connection; diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcCallTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcCallTests.java index f858444dbb..9779c29d65 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcCallTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcCallTests.java @@ -22,7 +22,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.springframework.build.test.hamcrest.Matchers.exceptionCause; +import static org.springframework.tests.Matchers.exceptionCause; import java.sql.CallableStatement; import java.sql.Connection; diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcTemplateTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcTemplateTests.java index 5b52d8ac46..05f289076b 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcTemplateTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/core/simple/SimpleJdbcTemplateTests.java @@ -54,6 +54,7 @@ import org.springframework.jdbc.core.namedparam.SqlParameterSource; * @author Juergen Hoeller * @author Thomas Risberg */ +@Deprecated public class SimpleJdbcTemplateTests { private static final String SQL = "sql"; diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/object/GenericSqlQueryTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/object/GenericSqlQueryTests.java index 8540edc8a9..6f17fc2044 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/object/GenericSqlQueryTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/object/GenericSqlQueryTests.java @@ -36,7 +36,9 @@ import javax.sql.DataSource; import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.BeanDefinitionRegistry; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.ClassPathResource; import org.springframework.jdbc.Customer; import org.springframework.jdbc.datasource.TestDataSourceWrapper; @@ -59,7 +61,8 @@ public class GenericSqlQueryTests { @Before public void setUp() throws Exception { - this.beanFactory = new XmlBeanFactory( + this.beanFactory = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader((BeanDefinitionRegistry) this.beanFactory).loadBeanDefinitions( new ClassPathResource("org/springframework/jdbc/object/GenericSqlQueryTests-context.xml")); DataSource dataSource = mock(DataSource.class); this.connection = mock(Connection.class); diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/object/GenericStoredProcedureTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/object/GenericStoredProcedureTests.java index 3280a2edad..4a5c787382 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/object/GenericStoredProcedureTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/object/GenericStoredProcedureTests.java @@ -31,8 +31,8 @@ import javax.sql.DataSource; import org.apache.commons.logging.LogFactory; import org.junit.Test; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.ClassPathResource; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.TestDataSourceWrapper; @@ -46,7 +46,8 @@ public class GenericStoredProcedureTests { @Test public void testAddInvoices() throws Exception { - BeanFactory bf = new XmlBeanFactory( + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions( new ClassPathResource("org/springframework/jdbc/object/GenericStoredProcedureTests-context.xml")); Connection connection = mock(Connection.class); DataSource dataSource = mock(DataSource.class); diff --git a/spring-orm/src/test/java/org/springframework/orm/hibernate3/LocalSessionFactoryBeanTests.java b/spring-orm/src/test/java/org/springframework/orm/hibernate3/LocalSessionFactoryBeanTests.java index c87a423c4a..2cec656f94 100644 --- a/spring-orm/src/test/java/org/springframework/orm/hibernate3/LocalSessionFactoryBeanTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/hibernate3/LocalSessionFactoryBeanTests.java @@ -28,9 +28,11 @@ import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; + import javax.transaction.TransactionManager; import junit.framework.TestCase; + import org.easymock.MockControl; import org.hibernate.HibernateException; import org.hibernate.Interceptor; @@ -49,8 +51,8 @@ import org.hibernate.engine.FilterDefinition; import org.hibernate.event.MergeEvent; import org.hibernate.event.MergeEventListener; import org.hibernate.mapping.TypeDef; - -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.Resource; @@ -612,7 +614,8 @@ public class LocalSessionFactoryBeanTests extends TestCase { */ public void testLocalSessionFactoryBeanWithTypeDefinitions() throws Exception { - XmlBeanFactory xbf = new XmlBeanFactory(new ClassPathResource("typeDefinitions.xml", getClass())); + DefaultListableBeanFactory xbf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(new ClassPathResource("typeDefinitions.xml", getClass())); TypeTestLocalSessionFactoryBean sf = (TypeTestLocalSessionFactoryBean) xbf.getBean("&sessionFactory"); // Requires re-compilation when switching to Hibernate 3.5/3.6 // since Mappings changed from a class to an interface diff --git a/spring-oxm/src/test/java/org/springframework/oxm/castor/CastorMarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/castor/CastorMarshallerTests.java index 8a7f1f82f1..1ffc536304 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/castor/CastorMarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/castor/CastorMarshallerTests.java @@ -16,10 +16,20 @@ package org.springframework.oxm.castor; +import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; +import static org.easymock.EasyMock.aryEq; +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.eq; +import static org.easymock.EasyMock.isA; +import static org.easymock.EasyMock.replay; +import static org.easymock.EasyMock.verify; +import static org.junit.Assert.assertEquals; + import java.io.StringWriter; import java.util.Arrays; import java.util.HashMap; import java.util.Map; + import javax.xml.transform.sax.SAXResult; import javax.xml.transform.stream.StreamResult; @@ -29,18 +39,14 @@ import org.custommonkey.xmlunit.XMLUnit; import org.custommonkey.xmlunit.XpathEngine; import org.junit.Assert; import org.junit.Test; +import org.springframework.core.io.ClassPathResource; +import org.springframework.oxm.AbstractMarshallerTests; +import org.springframework.oxm.Marshaller; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; -import org.springframework.core.io.ClassPathResource; -import org.springframework.oxm.AbstractMarshallerTests; -import org.springframework.oxm.Marshaller; - -import static org.custommonkey.xmlunit.XMLAssert.*; -import static org.easymock.EasyMock.*; - /** * Tests the {@link CastorMarshaller} class. * diff --git a/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java index 9255438766..3d7a497867 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java @@ -16,12 +16,26 @@ package org.springframework.oxm.jaxb; +import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.createStrictMock; +import static org.easymock.EasyMock.eq; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.expectLastCall; +import static org.easymock.EasyMock.isA; +import static org.easymock.EasyMock.replay; +import static org.easymock.EasyMock.verify; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.io.ByteArrayOutputStream; import java.io.StringWriter; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.util.Collections; + import javax.activation.DataHandler; import javax.activation.FileDataSource; import javax.xml.bind.JAXBElement; @@ -33,10 +47,6 @@ import javax.xml.transform.sax.SAXResult; import javax.xml.transform.stream.StreamResult; import org.junit.Test; -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.Locator; - import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.oxm.AbstractMarshallerTests; @@ -49,11 +59,9 @@ import org.springframework.oxm.jaxb.test.ObjectFactory; import org.springframework.oxm.mime.MimeContainer; import org.springframework.util.FileCopyUtils; import org.springframework.util.ReflectionUtils; - -import static org.custommonkey.xmlunit.XMLAssert.assertFalse; -import static org.custommonkey.xmlunit.XMLAssert.*; -import static org.easymock.EasyMock.*; -import static org.junit.Assert.assertTrue; +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.Locator; public class Jaxb2MarshallerTests extends AbstractMarshallerTests { diff --git a/spring-struts/src/test/java/org/springframework/web/servlet/view/tiles/TestComponentController.java b/spring-struts/src/test/java/org/springframework/web/servlet/view/tiles/TestComponentController.java index a0499247db..f554032e75 100644 --- a/spring-struts/src/test/java/org/springframework/web/servlet/view/tiles/TestComponentController.java +++ b/spring-struts/src/test/java/org/springframework/web/servlet/view/tiles/TestComponentController.java @@ -25,6 +25,7 @@ import org.apache.struts.tiles.ComponentContext; * @author Juergen Hoeller * @since 22.08.2003 */ +@Deprecated public class TestComponentController extends ComponentControllerSupport { @Override diff --git a/spring-struts/src/test/java/org/springframework/web/servlet/view/tiles/TilesViewTests.java b/spring-struts/src/test/java/org/springframework/web/servlet/view/tiles/TilesViewTests.java index 34a09a170f..71839c1837 100644 --- a/spring-struts/src/test/java/org/springframework/web/servlet/view/tiles/TilesViewTests.java +++ b/spring-struts/src/test/java/org/springframework/web/servlet/view/tiles/TilesViewTests.java @@ -42,6 +42,7 @@ import org.springframework.web.servlet.view.InternalResourceViewResolver; * @author Alef Arendsen * @author Juergen Hoeller */ +@Deprecated public class TilesViewTests { protected StaticWebApplicationContext prepareWebApplicationContext() throws Exception { diff --git a/spring-test/src/main/java/org/springframework/test/AssertThrows.java b/spring-test/src/main/java/org/springframework/test/AssertThrows.java index 8e56f2e9e6..2958fe0254 100644 --- a/spring-test/src/main/java/org/springframework/test/AssertThrows.java +++ b/spring-test/src/main/java/org/springframework/test/AssertThrows.java @@ -185,7 +185,7 @@ public abstract class AssertThrows { * Template method called when the test fails; i.e. the expected * {@link java.lang.Exception} is not thrown. *

The default implementation simply fails the test via a call to - * {@link junit.framework.Assert#fail(String)}. + * {@link org.junit.Assert#fail(String)}. *

If you want to customise the failure message, consider overriding * {@link #createMessageForNoExceptionThrown()}, and / or supplying an * extra, contextual failure message via the appropriate constructor overload. diff --git a/spring-tx/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java b/spring-tx/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java index ea1ad34afd..c7066b5cc7 100644 --- a/spring-tx/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java +++ b/spring-tx/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java @@ -19,6 +19,7 @@ package org.springframework.beans.factory.parsing; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -33,9 +34,9 @@ public class CollectingReaderEventListener implements ReaderEventListener { private final List defaults = new LinkedList(); - private final Map componentDefinitions = CollectionFactory.createLinkedMapIfPossible(8); + private final Map componentDefinitions = new LinkedHashMap<>(8); - private final Map aliasMap = CollectionFactory.createLinkedMapIfPossible(8); + private final Map aliasMap = new LinkedHashMap<>(8); private final List imports = new LinkedList(); @@ -87,4 +88,4 @@ public class CollectingReaderEventListener implements ReaderEventListener { return Collections.unmodifiableList(this.imports); } -} \ No newline at end of file +} diff --git a/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java b/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java index 593c4dd464..a34a228a45 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/interceptor/BeanFactoryTransactionTests.java @@ -21,10 +21,10 @@ import java.lang.reflect.Proxy; import java.util.Map; import junit.framework.TestCase; + import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; import org.easymock.MockControl; - import org.springframework.aop.support.AopUtils; import org.springframework.aop.support.StaticMethodMatcherPointcut; import org.springframework.aop.target.HotSwappableTargetSource; @@ -32,7 +32,8 @@ import org.springframework.beans.DerivedTestBean; import org.springframework.beans.FatalBeanException; import org.springframework.beans.ITestBean; import org.springframework.beans.TestBean; -import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.ClassPathResource; import org.springframework.transaction.CallCountingTransactionManager; import org.springframework.transaction.PlatformTransactionManager; @@ -48,11 +49,13 @@ import org.springframework.transaction.TransactionStatus; */ public class BeanFactoryTransactionTests extends TestCase { - private XmlBeanFactory factory; + private DefaultListableBeanFactory factory; @Override public void setUp() { - this.factory = new XmlBeanFactory(new ClassPathResource("transactionalBeanFactory.xml", getClass())); + this.factory = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(this.factory).loadBeanDefinitions( + new ClassPathResource("transactionalBeanFactory.xml", getClass())); } public void testGetsAreNotTransactionalWithProxyFactory1() throws NoSuchMethodException { @@ -167,7 +170,8 @@ public class BeanFactoryTransactionTests extends TestCase { */ public void testNoTransactionAttributeSource() { try { - XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("noTransactionAttributeSource.xml", getClass())); + DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); + new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("noTransactionAttributeSource.xml", getClass())); ITestBean testBean = (ITestBean) bf.getBean("noTransactionAttributeSource"); fail("Should require TransactionAttributeSource to be set"); } diff --git a/spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java b/spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java index ea8382ee01..67b7a4c024 100644 --- a/spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java +++ b/spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java @@ -397,6 +397,7 @@ public class UrlPathHelper { return source; } + @SuppressWarnings("deprecation") private String decodeInternal(HttpServletRequest request, String source) { String enc = determineEncoding(request); try { diff --git a/spring-web/src/test/java/org/springframework/http/client/CommonsHttpRequestFactoryTests.java b/spring-web/src/test/java/org/springframework/http/client/CommonsHttpRequestFactoryTests.java index 4fd3017ca2..c067159017 100644 --- a/spring-web/src/test/java/org/springframework/http/client/CommonsHttpRequestFactoryTests.java +++ b/spring-web/src/test/java/org/springframework/http/client/CommonsHttpRequestFactoryTests.java @@ -21,6 +21,7 @@ import java.net.URI; import org.junit.Test; import org.springframework.http.HttpMethod; +@Deprecated public class CommonsHttpRequestFactoryTests extends AbstractHttpRequestFactoryTestCase { @Override diff --git a/spring-web/src/test/java/org/springframework/http/converter/xml/SourceHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/xml/SourceHttpMessageConverterTests.java index afafe13a36..c34e202330 100644 --- a/spring-web/src/test/java/org/springframework/http/converter/xml/SourceHttpMessageConverterTests.java +++ b/spring-web/src/test/java/org/springframework/http/converter/xml/SourceHttpMessageConverterTests.java @@ -16,9 +16,14 @@ package org.springframework.http.converter.xml; +import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.io.InputStreamReader; import java.io.StringReader; import java.nio.charset.Charset; + import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; @@ -27,19 +32,17 @@ import javax.xml.transform.stream.StreamSource; import org.junit.Before; import org.junit.Test; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.xml.sax.InputSource; - import org.springframework.http.MediaType; import org.springframework.http.MockHttpInputMessage; import org.springframework.http.MockHttpOutputMessage; import org.springframework.util.FileCopyUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.xml.sax.InputSource; -import static org.custommonkey.xmlunit.XMLAssert.*; - -/** @author Arjen Poutsma */ -@SuppressWarnings("unchecked") +/** + * @author Arjen Poutsma + */ public class SourceHttpMessageConverterTests { private SourceHttpMessageConverter converter; diff --git a/spring-web/src/test/java/org/springframework/mock/web/test/MockExpressionEvaluator.java b/spring-web/src/test/java/org/springframework/mock/web/test/MockExpressionEvaluator.java index b399bafe62..95e5c5d436 100644 --- a/spring-web/src/test/java/org/springframework/mock/web/test/MockExpressionEvaluator.java +++ b/spring-web/src/test/java/org/springframework/mock/web/test/MockExpressionEvaluator.java @@ -40,6 +40,7 @@ import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; * @since 1.1.5 * @see org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager */ +@Deprecated public class MockExpressionEvaluator extends ExpressionEvaluator { private final PageContext pageContext; diff --git a/spring-web/src/test/java/org/springframework/mock/web/test/MockPageContext.java b/spring-web/src/test/java/org/springframework/mock/web/test/MockPageContext.java index 2c17aca78e..d4d5f2011e 100644 --- a/spring-web/src/test/java/org/springframework/mock/web/test/MockPageContext.java +++ b/spring-web/src/test/java/org/springframework/mock/web/test/MockPageContext.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.Enumeration; import java.util.LinkedHashMap; import java.util.Map; + import javax.el.ELContext; import javax.servlet.Servlet; import javax.servlet.ServletConfig; @@ -262,7 +263,6 @@ public class MockPageContext extends PageContext { } @Override - @SuppressWarnings("unchecked") public Enumeration getAttributeNamesInScope(int scope) { switch (scope) { case PAGE_SCOPE: @@ -288,6 +288,7 @@ public class MockPageContext extends PageContext { } @Override + @Deprecated public ExpressionEvaluator getExpressionEvaluator() { return new MockExpressionEvaluator(this); } @@ -298,6 +299,7 @@ public class MockPageContext extends PageContext { } @Override + @Deprecated public VariableResolver getVariableResolver() { return null; } 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 ac50ac8d2e..975d9537a3 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 @@ -45,6 +45,7 @@ import org.springframework.util.ObjectUtils; * @author Juergen Hoeller * @since 18.12.2003 */ +@Deprecated public class JaxRpcSupportTests extends TestCase { public void testLocalJaxRpcServiceFactoryBeanWithServiceNameAndNamespace() throws Exception { diff --git a/spring-web/src/test/java/org/springframework/web/bind/ServletRequestUtilsTests.java b/spring-web/src/test/java/org/springframework/web/bind/ServletRequestUtilsTests.java index cba2d487f2..ada52ec33c 100644 --- a/spring-web/src/test/java/org/springframework/web/bind/ServletRequestUtilsTests.java +++ b/spring-web/src/test/java/org/springframework/web/bind/ServletRequestUtilsTests.java @@ -19,9 +19,9 @@ package org.springframework.web.bind; import static org.junit.Assert.*; import org.junit.Test; -import org.springframework.build.junit.Assume; -import org.springframework.build.junit.TestGroup; import org.springframework.mock.web.test.MockHttpServletRequest; +import org.springframework.tests.Assume; +import org.springframework.tests.TestGroup; import org.springframework.util.StopWatch; /** diff --git a/spring-web/src/test/java/org/springframework/web/jsf/DelegatingVariableResolverTests.java b/spring-web/src/test/java/org/springframework/web/jsf/DelegatingVariableResolverTests.java index ad49f664d1..a2c27162a2 100644 --- a/spring-web/src/test/java/org/springframework/web/jsf/DelegatingVariableResolverTests.java +++ b/spring-web/src/test/java/org/springframework/web/jsf/DelegatingVariableResolverTests.java @@ -30,6 +30,7 @@ import org.springframework.web.context.support.StaticWebApplicationContext; * @author Juergen Hoeller * @since 02.08.2004 */ +@Deprecated public class DelegatingVariableResolverTests extends TestCase { public void testDelegatingVariableResolver() { diff --git a/spring-web/src/test/java/org/springframework/web/multipart/commons/CommonsMultipartResolverTests.java b/spring-web/src/test/java/org/springframework/web/multipart/commons/CommonsMultipartResolverTests.java index b3aa9beb68..29df40fbf3 100644 --- a/spring-web/src/test/java/org/springframework/web/multipart/commons/CommonsMultipartResolverTests.java +++ b/spring-web/src/test/java/org/springframework/web/multipart/commons/CommonsMultipartResolverTests.java @@ -16,6 +16,10 @@ package org.springframework.web.multipart.commons; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; @@ -30,6 +34,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; + import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.ServletRequest; @@ -41,9 +46,7 @@ import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.FileUpload; import org.apache.commons.fileupload.servlet.ServletFileUpload; -import static org.junit.Assert.*; import org.junit.Test; - import org.springframework.beans.MutablePropertyValues; import org.springframework.mock.web.test.MockFilterConfig; import org.springframework.mock.web.test.MockHttpServletRequest; @@ -220,7 +223,7 @@ public class CommonsMultipartResolverTests { MultipartHttpServletRequest request) throws UnsupportedEncodingException { MultipartTestBean1 mtb1 = new MultipartTestBean1(); - assertEquals(null, mtb1.getField1()); + assertArrayEquals(null, mtb1.getField1()); assertEquals(null, mtb1.getField2()); ServletRequestDataBinder binder = new ServletRequestDataBinder(mtb1, "mybean"); binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor()); @@ -234,7 +237,7 @@ public class CommonsMultipartResolverTests { assertEquals(new String(file2.getBytes()), new String(mtb1.getField2())); MultipartTestBean2 mtb2 = new MultipartTestBean2(); - assertEquals(null, mtb2.getField1()); + assertArrayEquals(null, mtb2.getField1()); assertEquals(null, mtb2.getField2()); binder = new ServletRequestDataBinder(mtb2, "mybean"); binder.registerCustomEditor(String.class, "field1", new StringMultipartFileEditor()); diff --git a/spring-web/src/test/java/org/springframework/web/util/ExpressionEvaluationUtilsTests.java b/spring-web/src/test/java/org/springframework/web/util/ExpressionEvaluationUtilsTests.java index 80bf92165b..8da5c1adb3 100644 --- a/spring-web/src/test/java/org/springframework/web/util/ExpressionEvaluationUtilsTests.java +++ b/spring-web/src/test/java/org/springframework/web/util/ExpressionEvaluationUtilsTests.java @@ -38,6 +38,7 @@ import static org.junit.Assert.*; * @author Juergen Hoeller * @since 16.09.2003 */ +@Deprecated public class ExpressionEvaluationUtilsTests { @Test diff --git a/spring-web/src/test/java/org/springframework/web/util/UriUtilsTests.java b/spring-web/src/test/java/org/springframework/web/util/UriUtilsTests.java index 29585bb05d..f3ffc519c1 100644 --- a/spring-web/src/test/java/org/springframework/web/util/UriUtilsTests.java +++ b/spring-web/src/test/java/org/springframework/web/util/UriUtilsTests.java @@ -106,6 +106,7 @@ public class UriUtilsTests { } @Test + @Deprecated public void encodeUri() throws UnsupportedEncodingException { assertEquals("Invalid encoded URI", "http://www.ietf.org/rfc/rfc3986.txt", UriUtils.encodeUri("http://www.ietf.org/rfc/rfc3986.txt", ENC)); @@ -134,6 +135,7 @@ public class UriUtilsTests { } @Test + @Deprecated public void encodeHttpUrl() throws UnsupportedEncodingException { assertEquals("Invalid encoded HTTP URL", "http://www.ietf.org/rfc/rfc3986.txt", UriUtils.encodeHttpUrl("http://www.ietf.org/rfc/rfc3986.txt", ENC)); @@ -156,6 +158,7 @@ public class UriUtilsTests { } @Test(expected = IllegalArgumentException.class) + @Deprecated public void encodeHttpUrlMail() throws UnsupportedEncodingException { UriUtils.encodeHttpUrl("mailto:java-net@java.sun.com", ENC); } diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java index b588561321..d6911ee72f 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractBeanFactoryTests.java @@ -20,7 +20,6 @@ import java.beans.PropertyEditorSupport; import java.util.StringTokenizer; import junit.framework.TestCase; -import junit.framework.Assert; import org.springframework.beans.BeansException; import org.springframework.beans.PropertyBatchUpdateException; @@ -79,7 +78,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase { */ public void testLifecycleCallbacks() { LifecycleBean lb = (LifecycleBean) getBeanFactory().getBean("lifecycle"); - Assert.assertEquals("lifecycle", lb.getBeanName()); + assertEquals("lifecycle", lb.getBeanName()); // The dummy business method will throw an exception if the // necessary callbacks weren't invoked in the right order. lb.businessMethod(); @@ -327,4 +326,4 @@ public abstract class AbstractBeanFactoryTests extends TestCase { } } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java index d683491a1f..855f23af39 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/beans/factory/AbstractListableBeanFactoryTests.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. @@ -16,8 +16,6 @@ package org.springframework.beans.factory; -import junit.framework.Assert; - import org.springframework.beans.TestBean; /** @@ -44,24 +42,24 @@ public abstract class AbstractListableBeanFactoryTests extends AbstractBeanFacto protected final void assertCount(int count) { String[] defnames = getListableBeanFactory().getBeanDefinitionNames(); - Assert.assertTrue("We should have " + count + " beans, not " + defnames.length, defnames.length == count); + assertTrue("We should have " + count + " beans, not " + defnames.length, defnames.length == count); } public void assertTestBeanCount(int count) { String[] defNames = getListableBeanFactory().getBeanNamesForType(TestBean.class, true, false); - Assert.assertTrue("We should have " + count + " beans for class org.springframework.beans.TestBean, not " + + assertTrue("We should have " + count + " beans for class org.springframework.beans.TestBean, not " + defNames.length, defNames.length == count); int countIncludingFactoryBeans = count + 2; String[] names = getListableBeanFactory().getBeanNamesForType(TestBean.class, true, true); - Assert.assertTrue("We should have " + countIncludingFactoryBeans + + assertTrue("We should have " + countIncludingFactoryBeans + " beans for class org.springframework.beans.TestBean, not " + names.length, names.length == countIncludingFactoryBeans); } public void testGetDefinitionsForNoSuchClass() { String[] defnames = getListableBeanFactory().getBeanNamesForType(String.class); - Assert.assertTrue("No string definitions", defnames.length == 0); + assertTrue("No string definitions", defnames.length == 0); } /** @@ -69,18 +67,18 @@ public abstract class AbstractListableBeanFactoryTests extends AbstractBeanFacto * what type factories may return, and it may even change over time.) */ public void testGetCountForFactoryClass() { - Assert.assertTrue("Should have 2 factories, not " + + assertTrue("Should have 2 factories, not " + getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length, getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length == 2); - Assert.assertTrue("Should have 2 factories, not " + + assertTrue("Should have 2 factories, not " + getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length, getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length == 2); } public void testContainsBeanDefinition() { - Assert.assertTrue(getListableBeanFactory().containsBeanDefinition("rod")); - Assert.assertTrue(getListableBeanFactory().containsBeanDefinition("roderick")); + assertTrue(getListableBeanFactory().containsBeanDefinition("rod")); + assertTrue(getListableBeanFactory().containsBeanDefinition("roderick")); } -} \ No newline at end of file +} diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestDataBinderTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestDataBinderTests.java index f4a1eeae4a..3f46ddd3a8 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestDataBinderTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestDataBinderTests.java @@ -20,6 +20,7 @@ import java.beans.PropertyEditorSupport; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.Set; import junit.framework.TestCase; @@ -28,7 +29,6 @@ import org.springframework.beans.ITestBean; import org.springframework.beans.TestBean; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.beans.propertyeditors.StringArrayPropertyEditor; -import org.springframework.core.CollectionFactory; import org.springframework.mock.web.portlet.MockPortletRequest; import org.springframework.validation.BindingResult; @@ -166,7 +166,7 @@ public class PortletRequestDataBinderTests extends TestCase { public void testBindingSet() { TestBean bean = new TestBean(); - Set set = CollectionFactory.createLinkedSetIfPossible(2); + Set set = new LinkedHashSet<>(2); set.add(new TestBean("test1")); set.add(new TestBean("test2")); bean.setSomeSet(set); diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestUtilsTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestUtilsTests.java index c903e01a66..8092d835b3 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestUtilsTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/bind/PortletRequestUtilsTests.java @@ -19,8 +19,8 @@ package org.springframework.web.portlet.bind; import junit.framework.TestCase; import org.junit.Test; -import org.springframework.build.junit.Assume; -import org.springframework.build.junit.TestGroup; +import org.springframework.tests.Assume; +import org.springframework.tests.TestGroup; import org.springframework.mock.web.portlet.MockPortletRequest; import org.springframework.util.StopWatch; diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/CommandControllerTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/CommandControllerTests.java index 96080dd6c9..bad1796241 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/CommandControllerTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/CommandControllerTests.java @@ -52,6 +52,7 @@ import org.springframework.web.portlet.handler.PortletSessionRequiredException; /** * @author Mark Fisher */ +@Deprecated public class CommandControllerTests extends TestCase { private static final String ERRORS_KEY = "errors"; diff --git a/spring-webmvc/src/test/java/org/springframework/web/context/AbstractBeanFactoryTests.java b/spring-webmvc/src/test/java/org/springframework/web/context/AbstractBeanFactoryTests.java index 161475869f..e51cb8d151 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/context/AbstractBeanFactoryTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/context/AbstractBeanFactoryTests.java @@ -19,7 +19,6 @@ package org.springframework.web.context; import java.beans.PropertyEditorSupport; import java.util.StringTokenizer; -import junit.framework.Assert; import junit.framework.TestCase; import org.springframework.beans.BeansException; @@ -87,7 +86,7 @@ public abstract class AbstractBeanFactoryTests extends TestCase { */ public void testLifecycleCallbacks() { LifecycleBean lb = (LifecycleBean) getBeanFactory().getBean("lifecycle"); - Assert.assertEquals("lifecycle", lb.getBeanName()); + assertEquals("lifecycle", lb.getBeanName()); // The dummy business method will throw an exception if the // necessary callbacks weren't invoked in the right order. lb.businessMethod(); diff --git a/spring-webmvc/src/test/java/org/springframework/web/context/AbstractListableBeanFactoryTests.java b/spring-webmvc/src/test/java/org/springframework/web/context/AbstractListableBeanFactoryTests.java index 6a2d204d68..2b089f8748 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/context/AbstractListableBeanFactoryTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/context/AbstractListableBeanFactoryTests.java @@ -1,7 +1,5 @@ package org.springframework.web.context; -import junit.framework.Assert; - import org.springframework.beans.TestBean; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.FactoryBean; @@ -31,24 +29,24 @@ public abstract class AbstractListableBeanFactoryTests extends AbstractBeanFacto protected final void assertCount(int count) { String[] defnames = getListableBeanFactory().getBeanDefinitionNames(); - Assert.assertTrue("We should have " + count + " beans, not " + defnames.length, defnames.length == count); + assertTrue("We should have " + count + " beans, not " + defnames.length, defnames.length == count); } public void assertTestBeanCount(int count) { String[] defNames = getListableBeanFactory().getBeanNamesForType(TestBean.class, true, false); - Assert.assertTrue("We should have " + count + " beans for class org.springframework.beans.TestBean, not " + + assertTrue("We should have " + count + " beans for class org.springframework.beans.TestBean, not " + defNames.length, defNames.length == count); int countIncludingFactoryBeans = count + 2; String[] names = getListableBeanFactory().getBeanNamesForType(TestBean.class, true, true); - Assert.assertTrue("We should have " + countIncludingFactoryBeans + + assertTrue("We should have " + countIncludingFactoryBeans + " beans for class org.springframework.beans.TestBean, not " + names.length, names.length == countIncludingFactoryBeans); } public void testGetDefinitionsForNoSuchClass() { String[] defnames = getListableBeanFactory().getBeanNamesForType(String.class); - Assert.assertTrue("No string definitions", defnames.length == 0); + assertTrue("No string definitions", defnames.length == 0); } /** @@ -56,18 +54,18 @@ public abstract class AbstractListableBeanFactoryTests extends AbstractBeanFacto * what type factories may return, and it may even change over time.) */ public void testGetCountForFactoryClass() { - Assert.assertTrue("Should have 2 factories, not " + + assertTrue("Should have 2 factories, not " + getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length, getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length == 2); - Assert.assertTrue("Should have 2 factories, not " + + assertTrue("Should have 2 factories, not " + getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length, getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length == 2); } public void testContainsBeanDefinition() { - Assert.assertTrue(getListableBeanFactory().containsBeanDefinition("rod")); - Assert.assertTrue(getListableBeanFactory().containsBeanDefinition("roderick")); + assertTrue(getListableBeanFactory().containsBeanDefinition("rod")); + assertTrue(getListableBeanFactory().containsBeanDefinition("roderick")); } } \ No newline at end of file diff --git a/spring-webmvc/src/test/java/org/springframework/web/context/support/ServletContextSupportTests.java b/spring-webmvc/src/test/java/org/springframework/web/context/support/ServletContextSupportTests.java index 2bf2ee7edb..9e0784f251 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/context/support/ServletContextSupportTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/context/support/ServletContextSupportTests.java @@ -16,7 +16,10 @@ package org.springframework.web.context.support; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.io.IOException; import java.util.Collections; @@ -38,6 +41,7 @@ import org.springframework.beans.factory.support.ManagedList; import org.springframework.beans.factory.support.ManagedMap; import org.springframework.beans.factory.support.ManagedSet; import org.springframework.beans.factory.support.RootBeanDefinition; +import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.io.Resource; import org.springframework.mock.web.test.MockServletContext; @@ -51,6 +55,7 @@ import org.springframework.mock.web.test.MockServletContext; public class ServletContextSupportTests { @Test + @Deprecated public void testServletContextFactoryBean() { MockServletContext sc = new MockServletContext(); @@ -155,6 +160,7 @@ public class ServletContextSupportTests { } @Test + @Deprecated public void testServletContextPropertyPlaceholderConfigurer() { MockServletContext sc = new MockServletContext(); sc.addInitParameter("key4", "mykey4"); @@ -168,7 +174,7 @@ public class ServletContextSupportTests { pvs.add("spouse", new RuntimeBeanReference("${ref}")); wac.registerSingleton("tb1", TestBean.class, pvs); - RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, null); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); wac.getDefaultListableBeanFactory().registerBeanDefinition("tb2", bd); pvs = new MutablePropertyValues(); @@ -185,6 +191,7 @@ public class ServletContextSupportTests { } @Test + @Deprecated public void testServletContextPropertyPlaceholderConfigurerWithLocalOverriding() { MockServletContext sc = new MockServletContext(); sc.addInitParameter("key4", "mykey4"); @@ -198,7 +205,7 @@ public class ServletContextSupportTests { pvs.add("spouse", new RuntimeBeanReference("${ref}")); wac.registerSingleton("tb1", TestBean.class, pvs); - RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, null); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); wac.getDefaultListableBeanFactory().registerBeanDefinition("tb2", bd); pvs = new MutablePropertyValues(); @@ -215,6 +222,7 @@ public class ServletContextSupportTests { } @Test + @Deprecated public void testServletContextPropertyPlaceholderConfigurerWithContextOverride() { MockServletContext sc = new MockServletContext(); sc.addInitParameter("key4", "mykey4"); @@ -228,7 +236,7 @@ public class ServletContextSupportTests { pvs.add("spouse", new RuntimeBeanReference("${ref}")); wac.registerSingleton("tb1", TestBean.class, pvs); - RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, null); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); wac.getDefaultListableBeanFactory().registerBeanDefinition("tb2", bd); pvs = new MutablePropertyValues(); @@ -246,6 +254,7 @@ public class ServletContextSupportTests { } @Test + @Deprecated public void testServletContextPropertyPlaceholderConfigurerWithContextOverrideAndAttributes() { MockServletContext sc = new MockServletContext(); sc.addInitParameter("key4", "mykey4"); @@ -260,7 +269,7 @@ public class ServletContextSupportTests { pvs.add("spouse", new RuntimeBeanReference("${ref}")); wac.registerSingleton("tb1", TestBean.class, pvs); - RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, null); + RootBeanDefinition bd = new RootBeanDefinition(TestBean.class); wac.getDefaultListableBeanFactory().registerBeanDefinition("tb2", bd); pvs = new MutablePropertyValues(); @@ -279,6 +288,7 @@ public class ServletContextSupportTests { } @Test + @Deprecated public void testServletContextPropertyPlaceholderConfigurerWithAttributes() { MockServletContext sc = new MockServletContext(); sc.addInitParameter("key4", "mykey4"); @@ -312,7 +322,9 @@ public class ServletContextSupportTests { someMap.put("key2", "${age}name"); MutablePropertyValues innerPvs = new MutablePropertyValues(); innerPvs.add("touchy", "${os.name}"); - someMap.put("key3", new RootBeanDefinition(TestBean.class, innerPvs)); + RootBeanDefinition innerBd = new RootBeanDefinition(TestBean.class); + innerBd.setPropertyValues(innerPvs); + someMap.put("key3", innerBd); MutablePropertyValues innerPvs2 = new MutablePropertyValues(innerPvs); someMap.put("${key4}", new BeanDefinitionHolder(new ChildBeanDefinition("tb1", innerPvs2), "child")); pvs.add("someMap", someMap); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/DispatcherServletTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/DispatcherServletTests.java index 635b8e0ba8..287ea086eb 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/DispatcherServletTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/DispatcherServletTests.java @@ -32,7 +32,6 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import junit.framework.Assert; import junit.framework.TestCase; import org.springframework.beans.MutablePropertyValues; @@ -144,7 +143,7 @@ public class DispatcherServletTests extends TestCase { ComplexWebApplicationContext.TestApplicationListener listener = (ComplexWebApplicationContext.TestApplicationListener) complexDispatcherServlet .getWebApplicationContext().getBean("testListener"); - Assert.assertEquals(1, listener.counter); + assertEquals(1, listener.counter); } public void testPublishEventsOff() throws Exception { @@ -155,7 +154,7 @@ public class DispatcherServletTests extends TestCase { ComplexWebApplicationContext.TestApplicationListener listener = (ComplexWebApplicationContext.TestApplicationListener) complexDispatcherServlet .getWebApplicationContext().getBean("testListener"); - Assert.assertEquals(0, listener.counter); + assertEquals(0, listener.counter); } public void testFormRequest() throws Exception { diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/FormControllerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/FormControllerTests.java index 26b84eff65..d62174ab26 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/FormControllerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/FormControllerTests.java @@ -46,6 +46,7 @@ import org.springframework.web.servlet.ModelAndView; * @author Rod Johnson * @author Juergen Hoeller */ +@Deprecated public class FormControllerTests extends TestCase { public void testReferenceDataOnForm() throws Exception { diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/WizardFormControllerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/WizardFormControllerTests.java index 5249a82cdd..705ac4ea81 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/WizardFormControllerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/WizardFormControllerTests.java @@ -40,6 +40,7 @@ import org.springframework.web.servlet.ModelAndView; * @author Juergen Hoeller * @since 29.04.2003 */ +@Deprecated public class WizardFormControllerTests extends TestCase { public void testNoDirtyPageChange() throws Exception { diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolverTests.java index 2384b320c0..62ac0171a6 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolverTests.java @@ -43,6 +43,7 @@ import org.springframework.web.servlet.ModelAndView; * @author Arjen Poutsma * @author Juergen Hoeller */ +@Deprecated public class AnnotationMethodHandlerExceptionResolverTests { private AnnotationMethodHandlerExceptionResolver exceptionResolver; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/RequestSpecificMappingInfoComparatorTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/RequestSpecificMappingInfoComparatorTests.java index e85d4aafa5..1b941da624 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/RequestSpecificMappingInfoComparatorTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/RequestSpecificMappingInfoComparatorTests.java @@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestMethod; /** * @author Arjen Poutsma */ +@Deprecated public class RequestSpecificMappingInfoComparatorTests { private AnnotationMethodHandlerAdapter.RequestSpecificMappingInfoComparator comparator; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationControllerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationControllerTests.java index 07d68187be..05e0f3c2a5 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationControllerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationControllerTests.java @@ -30,9 +30,11 @@ import java.security.Principal; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; +import java.util.Calendar; import java.util.Collection; import java.util.Collections; import java.util.Date; +import java.util.GregorianCalendar; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; @@ -1517,7 +1519,7 @@ public class ServletAnnotationControllerTests { request.setCookies(new Cookie("date", "2008-11-18")); MockHttpServletResponse response = new MockHttpServletResponse(); servlet.service(request, response); - assertEquals("test-108", response.getContentAsString()); + assertEquals("test-2008", response.getContentAsString()); } @Test @@ -3052,8 +3054,10 @@ public class ServletAnnotationControllerTests { @RequestMapping(method = RequestMethod.GET) public void handle(@CookieValue("date") Date date, Writer writer) throws IOException { - assertEquals("Invalid path variable value", new Date(108, 10, 18), date); - writer.write("test-" + date.getYear()); + assertEquals("Invalid path variable value", new GregorianCalendar(2008, 10, 18).getTime(), date); + Calendar c = new GregorianCalendar(); + c.setTime(date); + writer.write("test-" + c.get(Calendar.YEAR)); } } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationMappingUtilsTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationMappingUtilsTests.java index 9bff022421..c0c7fce758 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationMappingUtilsTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/ServletAnnotationMappingUtilsTests.java @@ -22,7 +22,10 @@ import org.junit.Test; import org.springframework.mock.web.test.MockHttpServletRequest; import org.springframework.web.bind.annotation.RequestMethod; -/** @author Arjen Poutsma */ +/** + * @author Arjen Poutsma + */ +@Deprecated public class ServletAnnotationMappingUtilsTests { @Test diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/Spr7766Tests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/Spr7766Tests.java index bd2ac2fccf..b48a146501 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/Spr7766Tests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/Spr7766Tests.java @@ -29,6 +29,7 @@ import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; public class Spr7766Tests { @Test + @Deprecated public void test() throws Exception { AnnotationMethodHandlerAdapter adapter = new AnnotationMethodHandlerAdapter(); ConfigurableWebBindingInitializer binder = new ConfigurableWebBindingInitializer(); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/Spr7839Tests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/Spr7839Tests.java index 555dbd89b6..c963438df2 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/Spr7839Tests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/Spr7839Tests.java @@ -33,6 +33,7 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; +@Deprecated public class Spr7839Tests { AnnotationMethodHandlerAdapter adapter = new AnnotationMethodHandlerAdapter(); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/UriTemplateServletAnnotationControllerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/UriTemplateServletAnnotationControllerTests.java index d13a82607b..dcd2e6ec3d 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/UriTemplateServletAnnotationControllerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/annotation/UriTemplateServletAnnotationControllerTests.java @@ -20,6 +20,8 @@ import java.io.IOException; import java.io.Writer; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.GregorianCalendar; + import javax.servlet.ServletException; import javax.servlet.http.HttpServletResponse; @@ -486,7 +488,7 @@ public class UriTemplateServletAnnotationControllerTests { public void handle(@PathVariable("hotel") String hotel, @PathVariable Date date, Writer writer) throws IOException { assertEquals("Invalid path variable value", "42", hotel); - assertEquals("Invalid path variable value", new Date(108, 10, 18), date); + assertEquals("Invalid path variable value", new GregorianCalendar(2008, 10, 18).getTime(), date); writer.write("test-" + hotel); } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/mapping/BuyForm.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/mapping/BuyForm.java index 3f42bdd83a..00f6ea145c 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/mapping/BuyForm.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/mapping/BuyForm.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 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. @@ -21,6 +21,7 @@ import org.springframework.web.servlet.mvc.SimpleFormController; /** * @author Rob Harrop */ +@Deprecated public class BuyForm extends SimpleFormController { } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/AbstractServletHandlerMethodTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/AbstractServletHandlerMethodTests.java index b97f1c034a..228ead8c9b 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/AbstractServletHandlerMethodTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/AbstractServletHandlerMethodTests.java @@ -16,7 +16,7 @@ package org.springframework.web.servlet.mvc.method.annotation; -import static junit.framework.Assert.assertNotNull; +import static org.junit.Assert.assertNotNull; import javax.servlet.ServletException; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/velocity/VelocityRenderTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/velocity/VelocityRenderTests.java index 43f3d5d5cc..ff477a97f4 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/velocity/VelocityRenderTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/velocity/VelocityRenderTests.java @@ -27,11 +27,11 @@ import org.apache.velocity.Template; import org.apache.velocity.app.VelocityEngine; import org.apache.velocity.exception.MethodInvocationException; import org.hamcrest.Description; +import org.hamcrest.TypeSafeMatcher; import org.junit.Before; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; -import org.junit.internal.matchers.TypeSafeMatcher; import org.junit.rules.ExpectedException; import org.springframework.beans.TestBean; import org.springframework.mock.web.test.MockHttpServletRequest; diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/xslt/TestXsltViewTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/xslt/TestXsltViewTests.java index 43cbba5a77..c760d74441 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/xslt/TestXsltViewTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/xslt/TestXsltViewTests.java @@ -52,6 +52,7 @@ import org.springframework.web.servlet.ModelAndView; * @author Juergen Hoeller * @since 11.03.2005 */ +@Deprecated public class TestXsltViewTests extends TestCase { private TestXsltView view; diff --git a/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java b/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java index b2fbd959d2..fae32ac8f5 100644 --- a/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java +++ b/src/test/java/org/springframework/scheduling/annotation/ScheduledAndTransactionalAnnotationIntegrationTests.java @@ -23,14 +23,14 @@ import org.junit.Test; import org.springframework.aop.support.AopUtils; import org.springframework.beans.factory.BeanCreationException; -import org.springframework.build.junit.Assume; -import org.springframework.build.junit.TestGroup; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; import org.springframework.dao.support.PersistenceExceptionTranslator; import org.springframework.stereotype.Repository; +import org.springframework.tests.Assume; +import org.springframework.tests.TestGroup; import org.springframework.transaction.CallCountingTransactionManager; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement;