Offhand, I'd say you have the two classic OO options - inheritance and inclusion.
With inheritance, you just put the data()
method in some base class:
public class MyTestCaseBase {
@Parameters
public static Collection<Object[]> data() {
return ...
}
}
public class MyTest extends MyTestCaseBase {
// tests
}
With inclusion you leave yourself the option to extend different classes, but need to do some more "plumbing" yourself:
public class MyTestParameters {
public static Collection<Object[]> data() {
return ...
}
}
public class MyTest {
@Parameters
public static Collection<Object[]> data() {
return MyTestParameters.data();
}
// tests...
}