Class OrderedRunNotifier


  • public class OrderedRunNotifier
    extends org.junit.runner.notification.RunNotifier
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private class  OrderedRunNotifier.SafeNotifier
      Notify listeners in the requested order
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.LinkedList<org.junit.runner.notification.RunListener> listeners
      A linked list is more convenient for descending iterators.
      private boolean stopRequested  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addFirstListener​(org.junit.runner.notification.RunListener listener)
      Adds a listener at the head of the listener list.
      void addListener​(org.junit.runner.notification.RunListener listener)
      Add a listener at the end of the listener list.
      void fireTestAssumptionFailed​(org.junit.runner.notification.Failure failure)
      Invoke to tell listeners that an atomic test flagged that it assumed something false.
      void fireTestFailure​(org.junit.runner.notification.Failure failure)
      Invoke to tell listeners that an atomic test failed.
      void fireTestFinished​(org.junit.runner.Description description)
      Invoke to tell listeners that an atomic test finished.
      void fireTestIgnored​(org.junit.runner.Description description)
      Invoke to tell listeners that an atomic test was ignored.
      void fireTestRunFinished​(org.junit.runner.Result result)
      Do not invoke.
      void fireTestRunStarted​(org.junit.runner.Description description)
      Do not invoke.
      void fireTestStarted​(org.junit.runner.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​(org.junit.runner.notification.RunListener listener)
      Remove a listener from the listener list.
      • Methods inherited from class org.junit.runner.notification.RunNotifier

        fireTestSuiteFinished, fireTestSuiteStarted
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • listeners

        private final java.util.LinkedList<org.junit.runner.notification.RunListener> listeners
        A linked list is more convenient for descending iterators.
      • stopRequested

        private volatile boolean stopRequested
    • Constructor Detail

      • OrderedRunNotifier

        public OrderedRunNotifier()
    • Method Detail

      • addListener

        public void addListener​(org.junit.runner.notification.RunListener listener)
        Add a listener at the end of the listener list.
        Overrides:
        addListener in class org.junit.runner.notification.RunNotifier
      • addFirstListener

        public void addFirstListener​(org.junit.runner.notification.RunListener listener)
        Adds a listener at the head of the listener list.
        Overrides:
        addFirstListener in class org.junit.runner.notification.RunNotifier
      • removeListener

        public void removeListener​(org.junit.runner.notification.RunListener listener)
        Remove a listener from the listener list.
        Overrides:
        removeListener in class org.junit.runner.notification.RunNotifier
      • fireTestRunStarted

        public void fireTestRunStarted​(org.junit.runner.Description description)
        Do not invoke.
        Overrides:
        fireTestRunStarted in class org.junit.runner.notification.RunNotifier
      • fireTestRunFinished

        public void fireTestRunFinished​(org.junit.runner.Result result)
        Do not invoke.
        Overrides:
        fireTestRunFinished in class org.junit.runner.notification.RunNotifier
      • fireTestStarted

        public void fireTestStarted​(org.junit.runner.Description description)
                             throws org.junit.runner.notification.StoppedByUserException
        Invoke to tell listeners that an atomic test is about to start.
        Overrides:
        fireTestStarted in class org.junit.runner.notification.RunNotifier
        Parameters:
        description - the description of the atomic test (generally a class and method name)
        Throws:
        org.junit.runner.notification.StoppedByUserException - thrown if a user has requested that the test run stop
      • fireTestFailure

        public void fireTestFailure​(org.junit.runner.notification.Failure failure)
        Invoke to tell listeners that an atomic test failed.
        Overrides:
        fireTestFailure in class org.junit.runner.notification.RunNotifier
        Parameters:
        failure - the description of the test that failed and the exception thrown
      • fireTestAssumptionFailed

        public void fireTestAssumptionFailed​(org.junit.runner.notification.Failure failure)
        Invoke to tell listeners that an atomic test flagged that it assumed something false.
        Overrides:
        fireTestAssumptionFailed in class org.junit.runner.notification.RunNotifier
        Parameters:
        failure - the description of the test that failed and the AssumptionViolatedException thrown
      • fireTestIgnored

        public void fireTestIgnored​(org.junit.runner.Description description)
        Invoke to tell listeners that an atomic test was ignored.
        Overrides:
        fireTestIgnored in class org.junit.runner.notification.RunNotifier
        Parameters:
        description - the description of the ignored test
      • fireTestFinished

        public void fireTestFinished​(org.junit.runner.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.
        Overrides:
        fireTestFinished in class org.junit.runner.notification.RunNotifier
        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.
        Overrides:
        pleaseStop in class org.junit.runner.notification.RunNotifier