I am trying to run some parameterized test in Junit. My test has only one parameter so I can do something like that :
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList( new Object [][] {
{new TestCase("AD", "sikuli", l)}});
}
In this way I can run the same test with different TestCase
objects.The problem is that I want to receive an ArrayList
of TestCase
from another class, I don't want to create the TestCase objects here. Is there any way I could do that?
In the example below, substitute getTestCaseList()
with a call to your other class that returns the TestCase
objects:
@Parameters
public static Collection<Object[]> data() {
Collection<Object[]> result = new ArrayList<>();
for (TestCase testCase : getTestCaseList()) {
result.add(new Object[] {testCase});
}
return result;
}