I just found a TestNG test case that uses Spring to provide its data source. As a result the code is quite clean and concise.
However, I need to expand the test cases so they can take a variable list of inputs.
Am I stuck using bean references for the list of lists as I've attempted below? Is there a way to do that and still be pretty (i.e. not breaking up the logical flow of input followed by output)? Is there a better way?
<?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.0.xsd">
<bean id="stringPatternRegexMap" class="java.util.HashMap">
<constructor-arg>
<map>
<entry key="some input #1" value="expected output #1"/>
<entry key="some input #2" value="expected output #2"/>
<entry key="some input #3" value="expected output #3"/>
<entry key-ref="multi-list-1" value="expected output #3"/>
<entry key-ref="null-reference" value="null-reference"/>
</map>
</constructor-arg>
</bean>
<bean id="multi-list-1">
<list>
<value>apple</value>
<value>banana</value>
<value>orange</value>
</list>
</bean>
<bean id="null-reference">
<value>
<null/>
</value>
</bean>
</beans>
Note that the original code appears to be using a map instead of a list because it seems an easier way to provide a list of String[2].