Your code has two problems:
You have to use the same type for your array, otherwise you will
get IllegalArgumentException: argument type mismatch
Your test data creates only one parameter input by creating only one Integer[][] array.
Here is some code that should work for you
@RunWith(Parameterized.class)
public class PTest {
private Integer[] myArray;
public PTest(Integer[] array) {
myArray = array;
}
@Parameters
public static Collection testCases() {
return Arrays.asList(new Integer[][] { { 1, 1, 1 } }, new Integer[][] { { 2, 2, 2 } });
}
@Test
public void doTest() {
System.out.println(Arrays.toString(myArray));
}
}
Result looks like
[1, 1, 1]
[2, 2, 2]
Instead of using a constructor you could use the @Parameter annotation for your data member, which must be public then
@RunWith(Parameterized.class)
public class PTest {
@Parameter
public Integer[] myArray;
@Parameters
public static Collection testCases() {
return Arrays.asList(new Integer[][] { { 1, 1, 1 } }, new Integer[][] { { 2, 2, 2 } });
}
@Test
public void doTest() {
System.out.println(Arrays.toString(myArray));
}
}