Can you tell me why the test is not working? I got :
java.lang.IllegalStateException: While trying to create object of class class [Ljava.lang.Integer; could not find constructor with arguments matching (type-wise) the ones given in parameters.
And I cant find an example where JUnitParamsRunner was working with arrays as params.
@RunWith(JUnitParamsRunner.class)
public class StatisticsUtilsParameterizedTest {
private Object[] getValues() {
Object[] objects = new Object[2];
objects[0] = new Integer[]{1, 2, 3};
objects[1] = 2;
return objects;
}
@Test
@Parameters(method = "getValues")
public void shouldCalcAverageOK(Integer[] arg, int expected) {
int average = StatisticsUtils.getAverage(arg);//requires an array
assertEquals(expected, average);
}
}
There is a way to make it work with JUnitParams?