Class TestValidator
- Direct Known Subclasses:
CheckstyleTestValidator
,CompileTestValidator
,HumanTestValidator
,JunitTestValidator
,PmdTestValidator
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)
andcheckNullifySubRef(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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
protected static class
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
TestValidator
(String testId, Task task, File zipcontentdir, Path tmpDir) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
checkNullifySubRef
(String subRef) protected abstract void
checkSubRef
(String subRef) getResources
(int min, int max, TestValidator.ExternalResourceResolver resolver) protected Task
getTask()
protected Test
getTest()
protected Path
protected abstract void
protected abstract void
preCheck()
-
Field Details
-
zipcontentdir
-
-
Constructor Details
-
TestValidator
-
-
Method Details
-
getTest
-
getTask
-
getTmpDir
-
preCheck
- Throws:
IllegalStateException
-
checkSubRef
- Throws:
IllegalStateException
-
checkNullifySubRef
- Throws:
IllegalStateException
-
postCheck
- Throws:
IllegalStateException
-
getResources
protected Map<ResourceCaster.ProformaTaskResourceref,TestValidator.ResolvedFile> getResources(int min, int max, TestValidator.ExternalResourceResolver resolver)
-