@DataPoints public static final Integer[] input1={1,2};
@Theory
@Test
public void test1(int input1){
}
@DataPoints public static final Integer[] input2={3,4};
@Theory
In reference to Gábor Lipták's answer, named datapoints can be defined as a static fields (reference) which give us more concise code:
@RunWith(Theories.class)
public class TheoriesAndDataPointsTest {
@DataPoints("a values")
public static int[] aValues = {1, 2};
@DataPoints("b values")
public static int[] bValues = {3, 4};
@Theory
public void theoryForA(@FromDataPoints("a values") int a) {
System.out.printf("TheoryForA called with a = %d\n", a);
}
@Theory
public void theoryForB(@FromDataPoints("b values") int a) {
System.out.printf("TheoryForB called with b = %d\n", a);
}
}