@RunWith(Parameterized.class)- class should
be annotated like this
@Parameters -parameter method should be
annotated and the method signature- public
static Collection<Object[]>
getFiles(){}
@Test- should be given for methods
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import
org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class TestY {
@Parametererized.Parameters
public static Collection<Object[]> getFiles() {
Collection<Object[]> params = new
ArrayList<Object[]>();
for (File f : new
File(".").listFiles()) {
Object[] arr = new Object[] {
f };
params.add(arr); }
return params;
}
private File file;
public TestY(File file) {
this.file = file;
}
@Test
public void testY() {
fail(file.toString());
}
Can u explain in detail why u need to annotate in terms of core concepts
ReplyDelete