Package no.sikt.graphitron.validation
Class ValidationHandler
java.lang.Object
no.sikt.graphitron.validation.ValidationHandler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddErrorMessage(String formatedErrorMessage, Object... args) Adds an error message that will be thrown at a later timestatic voidaddErrorMessageAndThrow(String formatedErrorMessage, Object... args) Adds an error message and immediately throws an InvalidSchemaException for all added error messages.static voidaddWarningMessage(String formatedWarningMessage, Object... args) Adds a warning message that will be logged.static InvalidSchemaExceptionstatic voidformat Asserts that an expression is true and throws a InvalidSchemaException if the expression is false.static voidLogs all reported warnings.static voidUsed to clear the errorMessages between tests.static voidUsed to clear warningMessages between tests.static voidThrows an exception if any error has previously been reported.
-
Constructor Details
-
ValidationHandler
public ValidationHandler()
-
-
Method Details
-
addErrorMessage
Adds an error message that will be thrown at a later time- Parameters:
formatedErrorMessage- - A formated description of the error.args- - The arguments for the formatedErrorMessage
-
addWarningMessage
Adds a warning message that will be logged.- Parameters:
formatedWarningMessage- - A formated description of the warningargs- - Arguments for the formatedWarningMessage
-
addErrorMessageAndThrow
Adds an error message and immediately throws an InvalidSchemaException for all added error messages.- Parameters:
formatedErrorMessage- - A description of the error as a formated string.args- - The arguments referenced in the formatedErrorMessage
-
getException
-
logWarnings
public static void logWarnings()Logs all reported warnings. -
throwIfErrors
public static void throwIfErrors()Throws an exception if any error has previously been reported. -
resetErrorMessages
public static void resetErrorMessages()Used to clear the errorMessages between tests. -
resetWarningMessages
public static void resetWarningMessages()Used to clear warningMessages between tests. -
isTrue
format Asserts that an expression is true and throws a InvalidSchemaException if the expression is false.- Parameters:
expr- - The expression to be checked.message- - A parameterized string describing the errorvalues- - Values for the parameterized string.
-