Class ValidationHandler

java.lang.Object
no.sikt.graphitron.validation.ValidationHandler

public class ValidationHandler extends Object
  • Constructor Details

    • ValidationHandler

      public ValidationHandler()
  • Method Details

    • addErrorMessage

      public static void addErrorMessage(String formatedErrorMessage, Object... args)
      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

      public static void addWarningMessage(String formatedWarningMessage, Object... args)
      Adds a warning message that will be logged.
      Parameters:
      formatedWarningMessage - - A formated description of the warning
      args - - Arguments for the formatedWarningMessage
    • addErrorMessageAndThrow

      public static void addErrorMessageAndThrow(String formatedErrorMessage, Object... args)
      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

      public static InvalidSchemaException 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

      public static void isTrue(boolean expr, String message, Object... values)
      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 error
      values - - Values for the parameterized string.