public class WrappingParameterizedRunner
extends org.junit.runner.Runner
Parameterized.
Example usage:
@RunWith(WrappingParameterizedRunner.class)
@WrappedRunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(...) // used by SpringJUnit4ClassRunner
public class MyTest {
@ParameterizedSuite
public static void suite(ParameterizedSuiteBuilder builder) {
builder.add().withConstructor("foo").withDescription("try foo");
builder.add().withConstructor("bar").withDescription("try bar");
}
private String str;
public MyTest(String str) {
this.str = str;
}
@Test
public void testSomething( ) {
...
}
@Test
public void testSomethingElse() {
...
}
}
The withConstructor() calls validates constructor parameters in-place so you
get immediate feedback if you supply the wrong parameters.
The withDescription() calls provides a description of the test set, seen in the test tree:
| Constructor and Description |
|---|
WrappingParameterizedRunner(Class<?> testClass) |
| Modifier and Type | Method and Description |
|---|---|
org.junit.runner.Description |
getDescription() |
void |
run(org.junit.runner.notification.RunNotifier notifier) |
public WrappingParameterizedRunner(Class<?> testClass) throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException
public org.junit.runner.Description getDescription()
getDescription in interface org.junit.runner.DescribablegetDescription in class org.junit.runner.Runnerpublic void run(org.junit.runner.notification.RunNotifier notifier)
run in class org.junit.runner.RunnerCopyright © 2014. All rights reserved.