Class TestReportValidator
- java.lang.Object
-
- org.apache.batik.test.AbstractTest
-
- org.apache.batik.test.TestReportValidator
-
- All Implemented Interfaces:
Test
- Direct Known Subclasses:
SVGRenderingAccuracyTestValidator.AccurateRendering,SVGRenderingAccuracyTestValidator.AccurateRenderingWithVariation,SVGRenderingAccuracyTestValidator.DifferentSizes,SVGRenderingAccuracyTestValidator.InexistingReferenceImage,SVGRenderingAccuracyTestValidator.InvalidReferenceImageURL,SVGRenderingAccuracyTestValidator.InvalidSVGContent,SVGRenderingAccuracyTestValidator.InvalidSVGURL,SVGRenderingAccuracyTestValidator.SameSizeDifferentContent
public class TestReportValidator extends AbstractTest
ThisTestimplementation can be used to validate the operation of a specific test. A typical use is to create known error conditions and check that the inputTestreports these errors properly.This test checks that a given test status (passed or not) and a given error code is returned by a
Test. ATestReportValidatoris built with theTestto run, the expected status (passed or failed) and the expected error code. TheTestReportValidatorwill pass if the expected values are produced by theTestReportcreated by the associatedTest. Otherwise, it will fail with one of two error codes:
+ if the status is not the one expected, then the ERROR_UNEXPECTED_TEST_STATUS code is used.. The report description will have two entries: ENTRY_KEY_EXPECTED_STATUS and ENTRY_KEY_RECEIVED_STATUS, both of which are Strings. + if the status is the one expected, but if the error code differs from the expected one, then the ERROR_UNEXPECTED_ERROR_CODE code is used. The report description will have two entries: ENTRY_KEY_EXPECTED_ERROR_CODE and ENTRY_KEY_RECEIVED_ERROR_CODE.- Version:
- $Id: TestReportValidator.java 1805408 2017-08-18 12:21:52Z ssteiner $
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringENTRY_KEY_EXPECTED_ERROR_CODEThe error description entry when the test failsstatic java.lang.StringENTRY_KEY_EXPECTED_STATUSThe entry describing the expected status when the test status is unexpected.static java.lang.StringENTRY_KEY_RECEIVED_ERROR_CODEEntry describing the received error code which is different from the expected one.static java.lang.StringENTRY_KEY_RECEIVED_STATUSEntry describing the received status which is different from the expected one.(package private) static java.lang.StringERROR_UNEXPECTED_ERROR_CODEError code used when the test error code is different from the expected error code.(package private) static java.lang.StringERROR_UNEXPECTED_TEST_STATUSError code used when the test status is is different from the expected status.private java.lang.StringexpectedErrorCodeError code expected from theTestReportprivate booleanexpectedStatusStatus expected from theTestReportprivate TesttestTest that this validator checks-
Fields inherited from class org.apache.batik.test.AbstractTest
id, name, parent
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTestReportValidator()Protected constructor, for use by derived classesTestReportValidator(Test test, boolean expectedStatus, java.lang.String expectedErrorCode)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TestReportrunImpl()Subclasses should implement this method with the content of the test case.protected voidsetConfig(Test test, boolean expectedStatus, java.lang.String expectedErrorCode)Lets derived classes set the configuration parameters for this test.-
Methods inherited from class org.apache.batik.test.AbstractTest
assertEquals, assertEquals, assertNull, assertTrue, error, getId, getName, getParent, getQualifiedId, reportError, reportException, reportSuccess, run, runImplBasic, setId, setName, setParent
-
-
-
-
Field Detail
-
test
private Test test
Test that this validator checks
-
expectedStatus
private boolean expectedStatus
Status expected from theTestReport
-
expectedErrorCode
private java.lang.String expectedErrorCode
Error code expected from theTestReport
-
ERROR_UNEXPECTED_TEST_STATUS
static final java.lang.String ERROR_UNEXPECTED_TEST_STATUS
Error code used when the test status is is different from the expected status.- See Also:
- Constant Field Values
-
ERROR_UNEXPECTED_ERROR_CODE
static final java.lang.String ERROR_UNEXPECTED_ERROR_CODE
Error code used when the test error code is different from the expected error code.- See Also:
- Constant Field Values
-
ENTRY_KEY_EXPECTED_ERROR_CODE
public static final java.lang.String ENTRY_KEY_EXPECTED_ERROR_CODE
The error description entry when the test fails- See Also:
- Constant Field Values
-
ENTRY_KEY_RECEIVED_ERROR_CODE
public static final java.lang.String ENTRY_KEY_RECEIVED_ERROR_CODE
Entry describing the received error code which is different from the expected one.- See Also:
- Constant Field Values
-
ENTRY_KEY_EXPECTED_STATUS
public static final java.lang.String ENTRY_KEY_EXPECTED_STATUS
The entry describing the expected status when the test status is unexpected.- See Also:
- Constant Field Values
-
ENTRY_KEY_RECEIVED_STATUS
public static final java.lang.String ENTRY_KEY_RECEIVED_STATUS
Entry describing the received status which is different from the expected one.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TestReportValidator
public TestReportValidator(Test test, boolean expectedStatus, java.lang.String expectedErrorCode)
Constructor
-
TestReportValidator
protected TestReportValidator()
Protected constructor, for use by derived classes
-
-
Method Detail
-
setConfig
protected void setConfig(Test test, boolean expectedStatus, java.lang.String expectedErrorCode)
Lets derived classes set the configuration parameters for this test.
-
runImpl
public TestReport runImpl() throws java.lang.Exception
Description copied from class:AbstractTestSubclasses should implement this method with the content of the test case. Typically, implementations will choose to catch and process all exceptions and error conditions they are looking for in the code they exercise but will let exceptions due to their own processing propagate.- Overrides:
runImplin classAbstractTest- Throws:
java.lang.Exception
-
-