Suppose, I have a junit test class:
class MyComponentTest {
private void test(File file) {...}
@Test public void test1() {test("test1.txt")}
@Test public void test2() {test("test2.txt")}
@Test public void test3() {test("test3.txt")}
}
The test method reads the input data from the file and test the component with the input data.
What if I am changing the MyComponentTest ?
class MyComponentTest {
private void test(File file) {...}
@Test public void testAll() {
for (String name: dir.list())
test(new File(name))
}
}
Now I have only one test (testAll) instead of three tests (test1, test2, and test3) as it was before. The Runner for example will not recognize three separate tests as it did in the previous version of the class.
My question is: how to make each test method invocation a separate test from the junit point of view ?