Package junit.framework
Class JUnit4TestAdapter
java.lang.Object
junit.framework.JUnit4TestAdapter
- All Implemented Interfaces:
Test,Describable,Filterable,Orderable,Sortable
The JUnit4TestAdapter enables running JUnit-4-style tests using a JUnit-3-style test runner.
To use it, add the following to a test class:
public static Test suite() {
return new JUnit4TestAdapter(YourJUnit4TestClass.class);
}
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final JUnit4TestAdapterCacheprivate final Class<?> private final Runner -
Constructor Summary
ConstructorsConstructorDescriptionJUnit4TestAdapter(Class<?> newTestClass) JUnit4TestAdapter(Class<?> newTestClass, JUnit4TestAdapterCache cache) -
Method Summary
Modifier and TypeMethodDescriptionintCounts the number of test cases that will be run by this test.voidRemove tests that don't pass the parameterfilter.Class<?> getTests()private booleanisIgnored(Description description) voidOrders the tests usingordererprivate DescriptionremoveIgnored(Description description) voidrun(TestResult result) Runs a test and collects its result in a TestResult instance.voidSorts the tests usingsortertoString()
-
Field Details
-
fNewTestClass
-
fRunner
-
fCache
-
-
Constructor Details
-
JUnit4TestAdapter
-
JUnit4TestAdapter
-
-
Method Details
-
countTestCases
public int countTestCases()Description copied from interface:TestCounts the number of test cases that will be run by this test.- Specified by:
countTestCasesin interfaceTest
-
run
Description copied from interface:TestRuns a test and collects its result in a TestResult instance. -
getTests
-
getTestClass
-
getDescription
- Specified by:
getDescriptionin interfaceDescribable- Returns:
- a
Descriptionshowing the tests to be run by the receiver
-
removeIgnored
-
isIgnored
-
toString
-
filter
Description copied from interface:FilterableRemove tests that don't pass the parameterfilter.- Specified by:
filterin interfaceFilterable- Parameters:
filter- theFilterto apply- Throws:
NoTestsRemainException- if all tests are filtered out
-
sort
Description copied from interface:SortableSorts the tests usingsorter -
order
Orders the tests usingorderer- Specified by:
orderin interfaceOrderable- Throws:
InvalidOrderingException- if orderer does something invalid (like remove or add children)- Since:
- 4.13
-