public class JUnit4TestAdapter extends java.lang.Object implements Test, Filterable, Orderable, Describable
To use it, add the following to a test class:
public static Test suite() { return new JUnit4TestAdapter(YourJUnit4TestClass.class); }
Modifier and Type | Field and Description |
---|---|
private JUnit4TestAdapterCache |
fCache |
private java.lang.Class<?> |
fNewTestClass |
private Runner |
fRunner |
Constructor and Description |
---|
JUnit4TestAdapter(java.lang.Class<?> newTestClass) |
JUnit4TestAdapter(java.lang.Class<?> newTestClass,
JUnit4TestAdapterCache cache) |
Modifier and Type | Method and Description |
---|---|
int |
countTestCases()
Counts the number of test cases that will be run by this test.
|
void |
filter(Filter filter)
Remove tests that don't pass the parameter
filter . |
Description |
getDescription() |
java.lang.Class<?> |
getTestClass() |
java.util.List<Test> |
getTests() |
private boolean |
isIgnored(Description description) |
void |
order(Orderer orderer)
Orders the tests using
orderer |
private Description |
removeIgnored(Description description) |
void |
run(TestResult result)
Runs a test and collects its result in a TestResult instance.
|
void |
sort(Sorter sorter)
Sorts the tests using
sorter |
java.lang.String |
toString() |
private final java.lang.Class<?> fNewTestClass
private final Runner fRunner
private final JUnit4TestAdapterCache fCache
public JUnit4TestAdapter(java.lang.Class<?> newTestClass)
public JUnit4TestAdapter(java.lang.Class<?> newTestClass, JUnit4TestAdapterCache cache)
public int countTestCases()
Test
countTestCases
in interface Test
public void run(TestResult result)
Test
public java.util.List<Test> getTests()
public java.lang.Class<?> getTestClass()
public Description getDescription()
getDescription
in interface Describable
Description
showing the tests to be run by the receiverprivate Description removeIgnored(Description description)
private boolean isIgnored(Description description)
public java.lang.String toString()
toString
in class java.lang.Object
public void filter(Filter filter) throws NoTestsRemainException
Filterable
filter
.filter
in interface Filterable
filter
- the Filter
to applyNoTestsRemainException
- if all tests are filtered outpublic void sort(Sorter sorter)
Sortable
sorter
public void order(Orderer orderer) throws InvalidOrderingException
orderer
order
in interface Orderable
InvalidOrderingException
- if orderer does something invalid (like remove or add
children)