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 JUnit4TestAdapterCache
private final Class<?>
private final Runner
-
Constructor Summary
ConstructorsConstructorDescriptionJUnit4TestAdapter
(Class<?> newTestClass) JUnit4TestAdapter
(Class<?> newTestClass, JUnit4TestAdapterCache cache) -
Method Summary
Modifier and TypeMethodDescriptionint
Counts the number of test cases that will be run by this test.void
Remove tests that don't pass the parameterfilter
.Class<?>
getTests()
private boolean
isIgnored
(Description description) void
Orders the tests usingorderer
private Description
removeIgnored
(Description description) void
run
(TestResult result) Runs a test and collects its result in a TestResult instance.void
Sorts the tests usingsorter
toString()
-
Field Details
-
fNewTestClass
-
fRunner
-
fCache
-
-
Constructor Details
-
JUnit4TestAdapter
-
JUnit4TestAdapter
-
-
Method Details
-
countTestCases
public int countTestCases()Description copied from interface:Test
Counts the number of test cases that will be run by this test.- Specified by:
countTestCases
in interfaceTest
-
run
Description copied from interface:Test
Runs a test and collects its result in a TestResult instance. -
getTests
-
getTestClass
-
getDescription
- Specified by:
getDescription
in interfaceDescribable
- Returns:
- a
Description
showing the tests to be run by the receiver
-
removeIgnored
-
isIgnored
-
toString
-
filter
Description copied from interface:Filterable
Remove tests that don't pass the parameterfilter
.- Specified by:
filter
in interfaceFilterable
- Parameters:
filter
- theFilter
to apply- Throws:
NoTestsRemainException
- if all tests are filtered out
-
sort
Description copied from interface:Sortable
Sorts the tests usingsorter
-
order
Orders the tests usingorderer
- Specified by:
order
in interfaceOrderable
- Throws:
InvalidOrderingException
- if orderer does something invalid (like remove or add children)- Since:
- 4.13
-