Class JunitListener
- java.lang.Object
-
- org.junit.runner.notification.RunListener
-
- JunitListener
-
public class JunitListener extends org.junit.runner.notification.RunListenerA custom built Junit listener to work with the autograder. It allows for testing whether a method fails or passes.
-
-
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.voidtestAssumptionFailure(org.junit.runner.notification.Failure failure)voidtestFailure(org.junit.runner.notification.Failure failure)voidtestFinished(org.junit.runner.Description description)voidtestStarted(org.junit.runner.Description description)intunitNum()Method to get the current unit test number.
-
-
-
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 testsunit- the current test number the program is onprogram- the name of the java classvisible- the visibility of the tests
-
-
Method Detail
-
testFinished
public void testFinished(org.junit.runner.Description description)
- Overrides:
testFinishedin classorg.junit.runner.notification.RunListener
-
testStarted
public void testStarted(org.junit.runner.Description description)
- Overrides:
testStartedin classorg.junit.runner.notification.RunListener
-
testFailure
public void testFailure(org.junit.runner.notification.Failure failure)
- Overrides:
testFailurein classorg.junit.runner.notification.RunListener
-
testAssumptionFailure
public void testAssumptionFailure(org.junit.runner.notification.Failure failure)
- Overrides:
testAssumptionFailurein classorg.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)
-
-