Test for constructor with unresolvable parameter name

Issue: SPR-13987
master
Juergen Hoeller 9 years ago
parent 1815a6a7eb
commit 8e5e384de7
  1. 14
      spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java
  2. 4
      spring-context/src/test/resources/org/springframework/beans/factory/xml/XmlBeanFactoryTests-constructorArg.xml

@ -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();

@ -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>

Loading…
Cancel
Save