Say I have a JUnit test case as:
@RunWith(Parameterized.class)
public class TestMyClass {
@Parameter
private int expected;
@Parameter
private int actual;
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
{ 0,1 }, { 1,2 }, { 2,3 }, { 3,4 }, { 4,5 }, { 5,6 },{ 6,7 }
});
}
@Test
public void test1 { //test }
@Test
public void test2 { //test }
}
I want to run test1 only with {0,1}, {1,2} and {2,3} and run test2 only with {3,4}, {4,5} {5,6}
How can I achieve this?
Edit: Parameters are read at Runtime from a file.