JUnit4TestMethodAdapter (Apache Ant API)
Date: 2018-09-12

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

## 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.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, test skipped). 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 `TestResult` object using its old (JUnit 3.8.x style) API.
  Author:
    Marian Petras

- - ### Constructor Summary

    Constructors
    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 Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `countTestCases()` |
    `org.junit.runner.Description` | `getDescription()` |
    `java.lang.Class<?>` | `getTestClass()` |
    `java.util.List<junit.framework.Test>` | `getTests()` |
    `void` | `run​(junit.framework.TestResult result)` |
    `java.lang.String` | `toString()` |

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

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

- - ### Constructor Detail

    - #### JUnit4TestMethodAdapter

          public 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 `null` or if any of the given method names is `null` or empty

  - ### Method Detail

    - #### countTestCases

          public int countTestCases()

      Specified by:
        `countTestCases` in interface `junit.framework.Test`

    - #### getDescription

          public org.junit.runner.Description getDescription()

    - #### getTests

          public java.util.List<junit.framework.Test> getTests()

    - #### getTestClass

          public java.lang.Class<?> getTestClass()

    - #### run

          public void run​(junit.framework.TestResult result)

      Specified by:
        `run` in interface `junit.framework.Test`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`