次のような JUnit テスト ケースがあるとします。
@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 }
}
{0,1}、{1,2}、および {2,3} でのみ test1 を実行し、{3,4}、{4,5} {5,6} でのみ test2 を実行したい
どうすればこれを達成できますか?
編集: パラメータは実行時にファイルから読み取られます。