Class JUnit4TestMethodAdapter
- java.lang.Object
- 
- org.apache.tools.ant.taskdefs.optional.junit.JUnit4TestMethodAdapter
 
- 
- All Implemented Interfaces:
- junit.framework.Test
 
 public class JUnit4TestMethodAdapter extends java.lang.Object implements junit.framework.TestAdapter between JUnit 3.8.x API and JUnit 4.x API for execution of tests and listening of events (test start, test finish, test failure, test skipped). The constructor is passed a JUnit 4 test class and a list of name of methods in it that should be executed. Methodrun(TestResult)executes the given JUnit-4-style test methods and notifies the givenTestResultobject using its old (JUnit 3.8.x style) API.- Author:
- Marian Petras
 
- 
- 
Constructor SummaryConstructors Constructor Description JUnit4TestMethodAdapter(java.lang.Class<?> testClass, java.lang.String[] methodNames)Creates a new adapter for the given class and a method within the class.
 - 
Method SummaryModifier and Type Method Description intcountTestCases()org.junit.runner.DescriptiongetDescription()java.lang.Class<?>getTestClass()java.util.List<junit.framework.Test>getTests()voidrun(junit.framework.TestResult result)java.lang.StringtoString()
 
- 
- 
- 
Constructor Detail- 
JUnit4TestMethodAdapterpublic JUnit4TestMethodAdapter(java.lang.Class<?> testClass, java.lang.String[] methodNames)Creates a new adapter for the given class and a method within the class.- Parameters:
- testClass- test class containing the method to be executed
- methodNames- names of the test methods that are to be executed
- Throws:
- java.lang.IllegalArgumentException- if any of the arguments is- nullor if any of the given method names is- nullor empty
 
 
- 
 - 
Method Detail- 
countTestCasespublic int countTestCases() - Specified by:
- countTestCasesin interface- junit.framework.Test
 
 - 
getDescriptionpublic org.junit.runner.Description getDescription() 
 - 
getTestspublic java.util.List<junit.framework.Test> getTests() 
 - 
getTestClasspublic java.lang.Class<?> getTestClass() 
 - 
runpublic void run(junit.framework.TestResult result) - Specified by:
- runin interface- junit.framework.Test
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-