Class TestValidator

java.lang.Object
org.proforma.util.TestValidator
Direct Known Subclasses:
CheckstyleTestValidator, CompileTestValidator, HumanTestValidator, JunitTestValidator, PmdTestValidator

public abstract class TestValidator extends Object

An instance of this class validates a ProFormA test element. A grader can implement one subclass for each test-type, that can check the task and unzipped files with respect to the specific test.

E. g. a JUnit test driver is passed as part of a file element of the task. In the grading-hints section usually there are references to the test driver and its test methods. A subclass of the TestValidator class is used to check consistency between the grading-hints and the test driver source.

In order to use a subclass with the TestsValidationHelper a client programm will have to register this class via TestsValidationHelper.register(String, Class, int). Then when calling TestsValidationHelper.validate(Task, File, Path) for each test the following calls will happen:

  • preCheck() once per test element instance of the represented test-type.
  • Then for each citation within the grading-hints section the method checkSubRef(String) and checkNullifySubRef(String) will be called once. This way a subclass may accumulate all sub-ref references in a private field.
  • Finally, postCheck() is called once per test element instance of the represented test-type.