Test for constructor with unresolvable parameter name

Issue: SPR-13987
This commit is contained in:
Juergen Hoeller 2016-02-29 11:18:23 +01:00
parent 1815a6a7eb
commit 8e5e384de7
2 changed files with 16 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 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.
@ -25,8 +25,10 @@ import java.lang.reflect.Method;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.logging.LogFactory;
import org.junit.Ignore;
import org.junit.Test;
import org.xml.sax.InputSource;
@ -78,7 +80,7 @@ import static org.junit.Assert.*;
* @author Chris Beams
* @author Sam Brannen
*/
public final class XmlBeanFactoryTests {
public class XmlBeanFactoryTests {
private static final Class<?> CLASS = XmlBeanFactoryTests.class;
private static final String CLASSNAME = CLASS.getSimpleName();
@ -1610,6 +1612,14 @@ public final class XmlBeanFactoryTests {
assertEquals(0, ((String[]) bean.array).length);
}
@Test @Ignore // TODO: SPR-13987
public void testConstructorWithUnresolvableParameterName() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
AtomicInteger bean = (AtomicInteger) xbf.getBean("constructorUnresolvableName");
assertEquals(1, bean.get());
}
@Test
public void testWithDuplicateName() throws Exception {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();

View File

@ -227,4 +227,8 @@
</constructor-arg>
</bean>
<bean id="constructorUnresolvableName" class="java.util.concurrent.atomic.AtomicInteger" scope="prototype">
<constructor-arg name="initialValue" value="1"/>
</bean>
</beans>