Skip to content

Commit 8e5e384

Browse files
committed
Test for constructor with unresolvable parameter name
Issue: SPR-13987
1 parent 1815a6a commit 8e5e384

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,8 +25,10 @@
2525
import java.net.URISyntaxException;
2626
import java.net.URL;
2727
import java.util.Map;
28+
import java.util.concurrent.atomic.AtomicInteger;
2829

2930
import org.apache.commons.logging.LogFactory;
31+
import org.junit.Ignore;
3032
import org.junit.Test;
3133
import org.xml.sax.InputSource;
3234

@@ -78,7 +80,7 @@
7880
* @author Chris Beams
7981
* @author Sam Brannen
8082
*/
81-
public final class XmlBeanFactoryTests {
83+
public class XmlBeanFactoryTests {
8284

8385
private static final Class<?> CLASS = XmlBeanFactoryTests.class;
8486
private static final String CLASSNAME = CLASS.getSimpleName();
@@ -1610,6 +1612,14 @@ public void testStringConstructorArrayNoTypeNonLenient() {
16101612
assertEquals(0, ((String[]) bean.array).length);
16111613
}
16121614

1615+
@Test @Ignore // TODO: SPR-13987
1616+
public void testConstructorWithUnresolvableParameterName() {
1617+
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
1618+
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
1619+
AtomicInteger bean = (AtomicInteger) xbf.getBean("constructorUnresolvableName");
1620+
assertEquals(1, bean.get());
1621+
}
1622+
16131623
@Test
16141624
public void testWithDuplicateName() throws Exception {
16151625
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();

spring-context/src/test/resources/org/springframework/beans/factory/xml/XmlBeanFactoryTests-constructorArg.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,4 +227,8 @@
227227
</constructor-arg>
228228
</bean>
229229

230+
<bean id="constructorUnresolvableName" class="java.util.concurrent.atomic.AtomicInteger" scope="prototype">
231+
<constructor-arg name="initialValue" value="1"/>
232+
</bean>
233+
230234
</beans>

0 commit comments

Comments
 (0)