Class JunitListener


  • public class JunitListener
    extends org.junit.runner.notification.RunListener
    A custom built Junit listener to work with the autograder. It allows for testing whether a method fails or passes.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.junit.runner.notification.RunListener

        org.junit.runner.notification.RunListener.ThreadSafe
    • Constructor Summary

      Constructors 
      Constructor Description
      JunitListener​(double max, int unit, java.lang.String program, java.lang.String visible)
      The constructor of the listener.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<jh61b.grader.TestResult> allResults()
      Method to reutn the test created by the junits.
      void testAssumptionFailure​(org.junit.runner.notification.Failure failure)  
      void testFailure​(org.junit.runner.notification.Failure failure)  
      void testFinished​(org.junit.runner.Description description)  
      void testStarted​(org.junit.runner.Description description)  
      int unitNum()
      Method to get the current unit test number.
      • Methods inherited from class org.junit.runner.notification.RunListener

        testIgnored, testRunFinished, testRunStarted, testSuiteFinished, testSuiteStarted
      • Methods inherited from class java.lang.Object

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

      • JunitListener

        public JunitListener​(double max,
                             int unit,
                             java.lang.String program,
                             java.lang.String visible)
        The constructor of the listener.
        Parameters:
        max - the score possible for the tests
        unit - the current test number the program is on
        program - the name of the java class
        visible - the visibility of the tests
    • Method Detail

      • testFinished

        public void testFinished​(org.junit.runner.Description description)
        Overrides:
        testFinished in class org.junit.runner.notification.RunListener
      • testStarted

        public void testStarted​(org.junit.runner.Description description)
        Overrides:
        testStarted in class org.junit.runner.notification.RunListener
      • testFailure

        public void testFailure​(org.junit.runner.notification.Failure failure)
        Overrides:
        testFailure in class org.junit.runner.notification.RunListener
      • testAssumptionFailure

        public void testAssumptionFailure​(org.junit.runner.notification.Failure failure)
        Overrides:
        testAssumptionFailure in class org.junit.runner.notification.RunListener
      • allResults

        public java.util.List<jh61b.grader.TestResult> allResults()
        Method to reutn the test created by the junits. This is used to add these tests to the autograder list.
        Returns:
        the list of tests listened to.
      • unitNum

        public int unitNum()
        Method to get the current unit test number.
        Returns:
        the current unit test number (starts at Autograder.diffNum not 0)