moving unit tests from .testsuite -> .beans
fixed broken unit tests getting ClassNotFoundExceptions
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.beans.factory;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Bean exposing a map. Used for bean factory tests.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @since 05.06.2003
|
||||
*/
|
||||
public class HasMap {
|
||||
|
||||
private Map map;
|
||||
|
||||
private Set set;
|
||||
|
||||
private Properties props;
|
||||
|
||||
private Object[] objectArray;
|
||||
|
||||
private Class[] classArray;
|
||||
|
||||
private Integer[] intArray;
|
||||
|
||||
private HasMap() {
|
||||
}
|
||||
|
||||
public Map getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
public void setMap(Map map) {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
public Set getSet() {
|
||||
return set;
|
||||
}
|
||||
|
||||
public void setSet(Set set) {
|
||||
this.set = set;
|
||||
}
|
||||
|
||||
public Properties getProps() {
|
||||
return props;
|
||||
}
|
||||
|
||||
public void setProps(Properties props) {
|
||||
this.props = props;
|
||||
}
|
||||
|
||||
public Object[] getObjectArray() {
|
||||
return objectArray;
|
||||
}
|
||||
|
||||
public void setObjectArray(Object[] objectArray) {
|
||||
this.objectArray = objectArray;
|
||||
}
|
||||
|
||||
public Class[] getClassArray() {
|
||||
return classArray;
|
||||
}
|
||||
|
||||
public void setClassArray(Class[] classArray) {
|
||||
this.classArray = classArray;
|
||||
}
|
||||
|
||||
public Integer[] getIntegerArray() {
|
||||
return intArray;
|
||||
}
|
||||
|
||||
public void setIntegerArray(Integer[] is) {
|
||||
intArray = is;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2008 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.beans.factory.annotation;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinitionHolder;
|
||||
import org.springframework.beans.factory.config.DependencyDescriptor;
|
||||
import org.springframework.beans.factory.support.AutowireCandidateResolver;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionReader;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class CustomAutowireConfigurerTests extends TestCase {
|
||||
|
||||
private static final String CONFIG_LOCATION =
|
||||
"classpath:org/springframework/beans/factory/annotation/customAutowireConfigurer.xml";
|
||||
|
||||
|
||||
public void testCustomResolver() {
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
BeanDefinitionReader reader = new XmlBeanDefinitionReader(bf);
|
||||
reader.loadBeanDefinitions(CONFIG_LOCATION);
|
||||
CustomAutowireConfigurer cac = new CustomAutowireConfigurer();
|
||||
CustomResolver customResolver = new CustomResolver();
|
||||
bf.setAutowireCandidateResolver(customResolver);
|
||||
cac.postProcessBeanFactory(bf);
|
||||
TestBean testBean = (TestBean) bf.getBean("testBean");
|
||||
assertEquals("#1!", testBean.getName());
|
||||
}
|
||||
|
||||
|
||||
public static class TestBean {
|
||||
|
||||
private String name;
|
||||
|
||||
public TestBean(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class CustomResolver implements AutowireCandidateResolver {
|
||||
|
||||
public boolean isAutowireCandidate(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor) {
|
||||
if (!bdHolder.getBeanDefinition().isAutowireCandidate()) {
|
||||
return false;
|
||||
}
|
||||
if (!bdHolder.getBeanName().matches("[a-z-]+")) {
|
||||
return false;
|
||||
}
|
||||
if (bdHolder.getBeanDefinition().getAttribute("priority").equals("1")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Object getSuggestedValue(DependencyDescriptor descriptor) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
* @author Chris Beams
|
||||
* @since 2.0
|
||||
*/
|
||||
public class RequiredAnnotationBeanPostProcessorTests extends TestCase {
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
|
||||
|
||||
<bean id="resolver" class="org.springframework.beans.factory.annotation.CustomAutowireConfigurerTests$CustomResolver"/>
|
||||
|
||||
<bean id="number-one" class="java.lang.String">
|
||||
<meta key="priority" value="1"/>
|
||||
<constructor-arg value="#1!"/>
|
||||
</bean>
|
||||
|
||||
<bean id="one" class="java.lang.String" autowire-candidate="false">
|
||||
<meta key="priority" value="1"/>
|
||||
<constructor-arg value="#1"/>
|
||||
</bean>
|
||||
|
||||
<bean id="number1" class="java.lang.String">
|
||||
<meta key="priority" value="1"/>
|
||||
<constructor-arg value="#1"/>
|
||||
</bean>
|
||||
|
||||
<bean id="number-two" class="java.lang.String">
|
||||
<meta key="priority" value="2"/>
|
||||
<constructor-arg value="#2"/>
|
||||
</bean>
|
||||
|
||||
<bean id="testBean"
|
||||
class="org.springframework.beans.factory.annotation.CustomAutowireConfigurerTests$TestBean"
|
||||
autowire="constructor"/>
|
||||
|
||||
</beans>
|
||||
@@ -16,10 +16,7 @@
|
||||
|
||||
package org.springframework.beans.factory.config;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.List;
|
||||
@@ -37,7 +34,6 @@ import org.springframework.beans.TestBean;
|
||||
import org.springframework.beans.factory.BeanDefinitionStoreException;
|
||||
import org.springframework.beans.factory.BeanInitializationException;
|
||||
import org.springframework.beans.factory.support.ChildBeanDefinition;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.ManagedList;
|
||||
import org.springframework.beans.factory.support.ManagedMap;
|
||||
import org.springframework.beans.factory.support.ManagedSet;
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
|
||||
package org.springframework.beans.factory.config;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.easymock.MockControl;
|
||||
import static org.easymock.EasyMock.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.FatalBeanException;
|
||||
import org.springframework.beans.MutablePropertyValues;
|
||||
import org.springframework.beans.PropertyValue;
|
||||
@@ -32,9 +33,11 @@ import org.springframework.test.AssertThrows;
|
||||
/**
|
||||
* @author Colin Sampaleanu
|
||||
* @author Rick Evans
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public class ServiceLocatorFactoryBeanTests extends TestCase {
|
||||
public class ServiceLocatorFactoryBeanTests {
|
||||
|
||||
@Test
|
||||
public void testNoArgGetter() {
|
||||
StaticApplicationContext ctx = new StaticApplicationContext();
|
||||
ctx.registerSingleton("testService", TestService.class, new MutablePropertyValues());
|
||||
@@ -48,6 +51,7 @@ public class ServiceLocatorFactoryBeanTests extends TestCase {
|
||||
assertNotNull(testService);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testErrorOnTooManyOrTooFew() throws Exception {
|
||||
StaticApplicationContext ctx = new StaticApplicationContext();
|
||||
ctx.registerSingleton("testService", TestService.class, new MutablePropertyValues());
|
||||
@@ -84,6 +88,7 @@ public class ServiceLocatorFactoryBeanTests extends TestCase {
|
||||
}.runTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testErrorOnTooManyOrTooFewWithCustomServiceLocatorException() {
|
||||
StaticApplicationContext ctx = new StaticApplicationContext();
|
||||
ctx.registerSingleton("testService", TestService.class, new MutablePropertyValues());
|
||||
@@ -126,6 +131,7 @@ public class ServiceLocatorFactoryBeanTests extends TestCase {
|
||||
}.runTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStringArgGetter() throws Exception {
|
||||
StaticApplicationContext ctx = new StaticApplicationContext();
|
||||
ctx.registerSingleton("testService", TestService.class, new MutablePropertyValues());
|
||||
@@ -136,6 +142,7 @@ public class ServiceLocatorFactoryBeanTests extends TestCase {
|
||||
|
||||
// test string-arg getter with null id
|
||||
final TestServiceLocator2 factory = (TestServiceLocator2) ctx.getBean("factory");
|
||||
@SuppressWarnings("unused")
|
||||
TestService testBean = factory.getTestService(null);
|
||||
// now test with explicit id
|
||||
testBean = factory.getTestService("testService");
|
||||
@@ -147,6 +154,7 @@ public class ServiceLocatorFactoryBeanTests extends TestCase {
|
||||
}.runTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCombinedLocatorInterface() {
|
||||
StaticApplicationContext ctx = new StaticApplicationContext();
|
||||
ctx.registerPrototype("testService", TestService.class, new MutablePropertyValues());
|
||||
@@ -171,6 +179,7 @@ public class ServiceLocatorFactoryBeanTests extends TestCase {
|
||||
assertTrue(factory.toString().indexOf("TestServiceLocator3") != -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testServiceMappings() {
|
||||
StaticApplicationContext ctx = new StaticApplicationContext();
|
||||
ctx.registerPrototype("testService1", TestService.class, new MutablePropertyValues());
|
||||
@@ -198,6 +207,7 @@ public class ServiceLocatorFactoryBeanTests extends TestCase {
|
||||
assertTrue(testBean4 instanceof ExtendedTestService);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoServiceLocatorInterfaceSupplied() throws Exception {
|
||||
new AssertThrows(IllegalArgumentException.class, "No serviceLocator interface supplied") {
|
||||
public void test() throws Exception {
|
||||
@@ -206,6 +216,7 @@ public class ServiceLocatorFactoryBeanTests extends TestCase {
|
||||
}.runTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWhenServiceLocatorInterfaceIsNotAnInterfaceType() throws Exception {
|
||||
new AssertThrows(IllegalArgumentException.class, "Bad (non-interface-type) serviceLocator interface supplied") {
|
||||
public void test() throws Exception {
|
||||
@@ -216,6 +227,7 @@ public class ServiceLocatorFactoryBeanTests extends TestCase {
|
||||
}.runTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWhenServiceLocatorExceptionClassToExceptionTypeWithOnlyNoArgCtor() throws Exception {
|
||||
new AssertThrows(IllegalArgumentException.class, "Bad (invalid-Exception-type) serviceLocatorException class supplied") {
|
||||
public void test() throws Exception {
|
||||
@@ -225,6 +237,7 @@ public class ServiceLocatorFactoryBeanTests extends TestCase {
|
||||
}.runTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWhenServiceLocatorExceptionClassIsNotAnExceptionSubclass() throws Exception {
|
||||
new AssertThrows(IllegalArgumentException.class, "Bad (non-Exception-type) serviceLocatorException class supplied") {
|
||||
public void test() throws Exception {
|
||||
@@ -234,6 +247,7 @@ public class ServiceLocatorFactoryBeanTests extends TestCase {
|
||||
}.runTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWhenServiceLocatorMethodCalledWithTooManyParameters() throws Exception {
|
||||
ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean();
|
||||
factory.setServiceLocatorInterface(ServiceLocatorInterfaceWithExtraNonCompliantMethod.class);
|
||||
@@ -246,19 +260,19 @@ public class ServiceLocatorFactoryBeanTests extends TestCase {
|
||||
}.runTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequiresListableBeanFactoryAndChokesOnAnythingElse() throws Exception {
|
||||
MockControl mockBeanFactory = MockControl.createControl(BeanFactory.class);
|
||||
final BeanFactory beanFactory = (BeanFactory) mockBeanFactory.getMock();
|
||||
mockBeanFactory.replay();
|
||||
final BeanFactory beanFactory = createMock(BeanFactory.class);
|
||||
replay(beanFactory);
|
||||
|
||||
new AssertThrows(FatalBeanException.class) {
|
||||
public void test() throws Exception {
|
||||
ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean();
|
||||
factory.setBeanFactory(beanFactory);
|
||||
}
|
||||
}.runTest();
|
||||
try {
|
||||
ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean();
|
||||
factory.setBeanFactory(beanFactory);
|
||||
} catch (FatalBeanException ex) {
|
||||
// expected
|
||||
}
|
||||
|
||||
mockBeanFactory.verify();
|
||||
verify(beanFactory);
|
||||
}
|
||||
|
||||
|
||||
@@ -315,6 +329,7 @@ public class ServiceLocatorFactoryBeanTests extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class CustomServiceLocatorException1 extends NestedRuntimeException {
|
||||
|
||||
public CustomServiceLocatorException1(String message, Throwable cause) {
|
||||
@@ -323,6 +338,7 @@ public class ServiceLocatorFactoryBeanTests extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class CustomServiceLocatorException2 extends NestedCheckedException {
|
||||
|
||||
public CustomServiceLocatorException2(Throwable cause) {
|
||||
@@ -331,6 +347,7 @@ public class ServiceLocatorFactoryBeanTests extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class CustomServiceLocatorException3 extends NestedCheckedException {
|
||||
|
||||
public CustomServiceLocatorException3(String message) {
|
||||
@@ -339,6 +356,7 @@ public class ServiceLocatorFactoryBeanTests extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class ExceptionClassWithOnlyZeroArgCtor extends Exception {
|
||||
|
||||
}
|
||||
|
||||
@@ -16,8 +16,10 @@
|
||||
|
||||
package org.springframework.beans.factory.xml;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.aop.interceptor.DebugInterceptor;
|
||||
import org.springframework.beans.ITestBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@@ -28,16 +30,19 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public class LookupMethodWrappedByCglibProxyTests extends TestCase {
|
||||
public class LookupMethodWrappedByCglibProxyTests {
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
protected void setUp() {
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.applicationContext = new ClassPathXmlApplicationContext("overloadOverrides.xml", getClass());
|
||||
resetInterceptor();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAutoProxiedLookup() {
|
||||
OverloadLookup olup = (OverloadLookup) applicationContext.getBean("autoProxiedOverload");
|
||||
ITestBean jenny = olup.newTestBean();
|
||||
@@ -46,6 +51,7 @@ public class LookupMethodWrappedByCglibProxyTests extends TestCase {
|
||||
assertInterceptorCount(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegularlyProxiedLookup() {
|
||||
OverloadLookup olup = (OverloadLookup) applicationContext.getBean("regularlyProxiedOverload");
|
||||
ITestBean jenny = olup.newTestBean();
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2002-2006 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.beans.factory.xml;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public class MapAndSet {
|
||||
|
||||
private Object obj;
|
||||
|
||||
public MapAndSet(Map map) {
|
||||
this.obj = map;
|
||||
}
|
||||
|
||||
public MapAndSet(Set set) {
|
||||
this.obj = set;
|
||||
}
|
||||
|
||||
public Object getObject() {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2002-2006 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.beans.factory.xml;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Bean that exposes a simple property that can be set
|
||||
* to a mix of references and individual values.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @since 27.05.2003
|
||||
*/
|
||||
public class MixedCollectionBean {
|
||||
|
||||
private Collection jumble;
|
||||
|
||||
|
||||
public void setJumble(Collection jumble) {
|
||||
this.jumble = jumble;
|
||||
}
|
||||
|
||||
public Collection getJumble() {
|
||||
return jumble;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,13 +16,14 @@
|
||||
|
||||
package org.springframework.beans.factory.xml;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@@ -33,13 +34,15 @@ import org.springframework.context.support.StaticApplicationContext;
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public class QualifierAnnotationTests extends TestCase {
|
||||
public class QualifierAnnotationTests {
|
||||
|
||||
private static final String CONFIG_LOCATION =
|
||||
"classpath:org/springframework/beans/factory/xml/qualifierAnnotationTests.xml";
|
||||
|
||||
|
||||
@Test
|
||||
public void testNonQualifiedFieldFails() {
|
||||
StaticApplicationContext context = new StaticApplicationContext();
|
||||
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
|
||||
@@ -54,6 +57,7 @@ public class QualifierAnnotationTests extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQualifiedByValue() {
|
||||
StaticApplicationContext context = new StaticApplicationContext();
|
||||
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
|
||||
@@ -65,6 +69,7 @@ public class QualifierAnnotationTests extends TestCase {
|
||||
assertEquals("Larry", person.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQualifiedByBeanName() {
|
||||
StaticApplicationContext context = new StaticApplicationContext();
|
||||
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
|
||||
@@ -76,6 +81,7 @@ public class QualifierAnnotationTests extends TestCase {
|
||||
assertEquals("LarryBean", person.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQualifiedByAlias() {
|
||||
StaticApplicationContext context = new StaticApplicationContext();
|
||||
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
|
||||
@@ -87,6 +93,7 @@ public class QualifierAnnotationTests extends TestCase {
|
||||
assertEquals("LarryBean", person.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQualifiedByAnnotation() {
|
||||
StaticApplicationContext context = new StaticApplicationContext();
|
||||
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
|
||||
@@ -98,6 +105,7 @@ public class QualifierAnnotationTests extends TestCase {
|
||||
assertEquals("LarrySpecial", person.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQualifiedByCustomValue() {
|
||||
StaticApplicationContext context = new StaticApplicationContext();
|
||||
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
|
||||
@@ -109,6 +117,7 @@ public class QualifierAnnotationTests extends TestCase {
|
||||
assertEquals("Curly", person.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQualifiedByAnnotationValue() {
|
||||
StaticApplicationContext context = new StaticApplicationContext();
|
||||
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
|
||||
@@ -120,6 +129,7 @@ public class QualifierAnnotationTests extends TestCase {
|
||||
assertEquals("LarrySpecial", person.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQualifiedByAttributesFailsWithoutCustomQualifierRegistered() {
|
||||
StaticApplicationContext context = new StaticApplicationContext();
|
||||
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
|
||||
@@ -134,6 +144,7 @@ public class QualifierAnnotationTests extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQualifiedByAttributesWithCustomQualifierRegistered() {
|
||||
StaticApplicationContext context = new StaticApplicationContext();
|
||||
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
|
||||
|
||||
@@ -352,7 +352,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="setAndMap" class="org.springframework.beans.factory.xml.XmlBeanCollectionTests$MapAndSet">
|
||||
<bean id="setAndMap" class="org.springframework.beans.factory.xml.MapAndSet">
|
||||
<constructor-arg>
|
||||
<map>
|
||||
<description>My Map</description>
|
||||
|
||||
Reference in New Issue
Block a user