org.apache.tools.ant.taskdefs.optional.junit

Class JUnit4TestMethodAdapter

public class JUnit4TestMethodAdapter extends Object implements Test

Adapter 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). The constructor is passed a JUnit 4 test class and a list of name of methods in it that should be executed. Method run(TestResult) executes the given JUnit-4-style test methods and notifies the given {@code TestResult} object using its old (JUnit 3.8.x style) API.

Author: Marian Petras

Constructor Summary
JUnit4TestMethodAdapter(Class testClass, String[] methodNames)
Creates a new adapter for the given class and a method within the class.
Method Summary
intcountTestCases()
DescriptiongetDescription()
ClassgetTestClass()
ListgetTests()
voidrun(TestResult result)
StringtoString()

Constructor Detail

JUnit4TestMethodAdapter

public JUnit4TestMethodAdapter(Class testClass, 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 {@code null} or if any of the given method names is {@code null} or empty

Method Detail

countTestCases

public int countTestCases()

getDescription

public Description getDescription()

getTestClass

public Class getTestClass()

getTests

public List getTests()

run

public void run(TestResult result)

toString

public String toString()