RunNotifier (JUnit API)
Keywords: org.junit.runner.notification.RunNotifier class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.junit.runner.notification
Class RunNotifier

    java.lang.Object
      org.junit.runner.notification.RunNotifier

    public class RunNotifier

extends Object

If you write custom runners, you may need to notify JUnit of your progress running tests. Do this by invoking the `RunNotifier` passed to your implementation of `Runner.run(RunNotifier)`. Future evolution of this class is likely to move `fireTestRunStarted(Description)` and `fireTestRunFinished(Result)` to a separate class since they should only be called once per run.

Constructor Summary
`RunNotifier()`

Method Summary
`void` | `addFirstListener(RunListener listener)` Internal use only.
`void` | `addListener(RunListener listener)` Internal use only
`void` | `fireTestAssumptionFailed(Failure failure)` Invoke to tell listeners that an atomic test flagged that it assumed something false.
`void` | `fireTestFailure(Failure failure)` Invoke to tell listeners that an atomic test failed.
`void` | `fireTestFinished(Description description)` Invoke to tell listeners that an atomic test finished.
`void` | `fireTestIgnored(Description description)` Invoke to tell listeners that an atomic test was ignored.
`void` | `fireTestRunFinished(Result result)` Do not invoke.
`void` | `fireTestRunStarted(Description description)` Do not invoke.
`void` | `fireTestStarted(Description description)` Invoke to tell listeners that an atomic test is about to start.
`void` | `pleaseStop()` Ask that the tests run stop before starting the next test.
`void` | `removeListener(RunListener listener)` Internal use only

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RunNotifier

    public RunNotifier()

Method Detail

### addListener

    public void addListener(RunListener listener)

  Internal use only

### removeListener

    public void removeListener(RunListener listener)

  Internal use only

### fireTestRunStarted

    public void fireTestRunStarted(Description description)

  Do not invoke.

### fireTestRunFinished

    public void fireTestRunFinished(Result result)

  Do not invoke.

### fireTestStarted

    public void fireTestStarted(Description description)
                         throws StoppedByUserException

  Invoke to tell listeners that an atomic test is about to start.

  Parameters:
    `description` - the description of the atomic test (generally a class and method name)
  Throws:
    `StoppedByUserException` - thrown if a user has requested that the test run stop

### fireTestFailure

    public void fireTestFailure(Failure failure)

  Invoke to tell listeners that an atomic test failed.

  Parameters:
    `failure` - the description of the test that failed and the exception thrown

### fireTestAssumptionFailed

    public void fireTestAssumptionFailed(Failure failure)

  Invoke to tell listeners that an atomic test flagged that it assumed something false.

  Parameters:
    `failure` - the description of the test that failed and the `AssumptionViolatedException` thrown

### fireTestIgnored

    public void fireTestIgnored(Description description)

  Invoke to tell listeners that an atomic test was ignored.

  Parameters:
    `description` - the description of the ignored test

### fireTestFinished

    public void fireTestFinished(Description description)

  Invoke to tell listeners that an atomic test finished. Always invoke `fireTestFinished(Description)` if you invoke `fireTestStarted(Description)` as listeners are likely to expect them to come in pairs.

  Parameters:
    `description` - the description of the test that finished

### pleaseStop

    public void pleaseStop()

  Ask that the tests run stop before starting the next test. Phrased politely because the test currently running will not be interrupted. It seems a little odd to put this functionality here, but the `RunNotifier` is the only object guaranteed to be shared amongst the many runners involved.

### addFirstListener

    public void addFirstListener(RunListener listener)

  Internal use only. The Result's listener must be first.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD