JUnitVersionHelper (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.taskdefs.optional.junit, class: JUnitVersionHelper

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

# Class JUnitVersionHelper

java.lang.Object
org.apache.tools.ant.taskdefs.optional.junit.JUnitVersionHelper

public class JUnitVersionHelper extends Object
Work around for some changes to the public JUnit API between different JUnit releases.

Since:
  Ant 1.7

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `JUNIT_FRAMEWORK_JUNIT4_TEST_CASE_FACADE`
  Name of the JUnit4 class we look for.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JUnitVersionHelper()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static String`
  `getIgnoreMessage(junit.framework.Test test)`
  `static String`
  `getTestCaseClassName(junit.framework.Test test)`
  Tries to find the name of the class which a test represents across JUnit 3 and 4.
  `static String`
  `getTestCaseName(junit.framework.Test t)`
  JUnit 3.7 introduces TestCase.getName() and subsequent versions of JUnit remove the old name() method.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### JUNIT_FRAMEWORK_JUNIT4_TEST_CASE_FACADE

    public static final String JUNIT_FRAMEWORK_JUNIT4_TEST_CASE_FACADE
    Name of the JUnit4 class we look for. "junit.framework.JUnit4TestCaseFacade"
    Since:
      Ant 1.7.1
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### JUnitVersionHelper

    public JUnitVersionHelper()

- ## Method Details

  - ### getTestCaseName

    public static String getTestCaseName(junit.framework.Test t)
    JUnit 3.7 introduces TestCase.getName() and subsequent versions of JUnit remove the old name() method. This method provides access to the name of a TestCase via reflection that is supposed to work with version before and after JUnit 3.7.

    since Ant 1.5.1 this method will invoke "`public String getName()`" on any implementation of Test if it exists.

    Since Ant 1.7 also checks for JUnit4TestCaseFacade explicitly. This is used by junit.framework.JUnit4TestAdapter.

    Parameters:
      `t` - the test.
    Returns:
      the name of the test.

  - ### getTestCaseClassName

    public static String getTestCaseClassName(junit.framework.Test test)
    Tries to find the name of the class which a test represents across JUnit 3 and 4. For JUnit4 it parses the toString() value of the test, and extracts it from there.
    Parameters:
      `test` - test case to look at
    Returns:
      the extracted class name.
    Since:
      Ant 1.7.1 (it was private until then)

  - ### getIgnoreMessage

    public static String getIgnoreMessage(junit.framework.Test test)