TestDataProvider now can be named
This commit is contained in:
parent
68da555932
commit
46ca33dc04
|
|
@ -132,15 +132,21 @@ public abstract class BaseTest {
|
||||||
*/
|
*/
|
||||||
public static class TestDataProvider {
|
public static class TestDataProvider {
|
||||||
private static final Map<Class, List<Object>> tests = new HashMap<Class, List<Object>>();
|
private static final Map<Class, List<Object>> tests = new HashMap<Class, List<Object>>();
|
||||||
|
private final String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new TestDataProvider instance bound to the class variable C
|
* Create a new TestDataProvider instance bound to the class variable C
|
||||||
* @param c
|
* @param c
|
||||||
*/
|
*/
|
||||||
public TestDataProvider(Class c) {
|
public TestDataProvider(Class c, String name) {
|
||||||
if ( ! tests.containsKey(c) )
|
if ( ! tests.containsKey(c) )
|
||||||
tests.put(c, new ArrayList<Object>());
|
tests.put(c, new ArrayList<Object>());
|
||||||
tests.get(c).add(this);
|
tests.get(c).add(this);
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TestDataProvider(Class c) {
|
||||||
|
this(c, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -153,6 +159,11 @@ public abstract class BaseTest {
|
||||||
for ( Object x : tests.get(c) ) params2.add(new Object[]{x});
|
for ( Object x : tests.get(c) ) params2.add(new Object[]{x});
|
||||||
return params2.toArray(new Object[][]{});
|
return params2.toArray(new Object[][]{});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "TestDataProvider("+name+")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue