Class VerificationResult


  • public final class VerificationResult
    extends Object
    Immutable outcome of a verification run: validity plus the collected errors and warnings.
    • Method Detail

      • isValid

        public boolean isValid()
        Returns:
        whether valid
      • getClassName

        public String getClassName()
        Returns:
        the class name
      • getMethodName

        public String getMethodName()
        Returns:
        the method name
      • success

        public static VerificationResult success()
        Creates an unlocated passing result.
        Returns:
        a valid result with no findings
      • success

        public static VerificationResult success​(String className)
        Creates a passing result for a class.
        Parameters:
        className - the verified class name
        Returns:
        a valid result with no findings
      • success

        public static VerificationResult success​(String className,
                                                 String methodName)
        Creates a passing result for a method.
        Parameters:
        className - the verified class name
        methodName - the verified method name
        Returns:
        a valid result with no findings
      • failure

        public static VerificationResult failure​(List<VerificationError> errors)
        Creates an unlocated result from mixed findings; it is still valid if none are ERROR severity.
        Parameters:
        errors - the findings, errors and warnings mixed
        Returns:
        the result
      • failure

        public static VerificationResult failure​(List<VerificationError> errors,
                                                 String className)
        Creates a result for a class from mixed findings; it is still valid if none are ERROR severity.
        Parameters:
        errors - the findings, errors and warnings mixed
        className - the verified class name
        Returns:
        the result
      • failure

        public static VerificationResult failure​(List<VerificationError> errors,
                                                 String className,
                                                 String methodName)
        Creates a result for a method from mixed findings; it is still valid if none are ERROR severity.
        Parameters:
        errors - the findings, errors and warnings mixed
        className - the verified class name
        methodName - the verified method name
        Returns:
        the result
      • getAllIssues

        public List<VerificationError> getAllIssues()
        Returns:
        errors followed by warnings in one list
      • getErrorCount

        public int getErrorCount()
        Returns:
        the number of errors
      • getWarningCount

        public int getWarningCount()
        Returns:
        the number of warnings
      • getTotalIssueCount

        public int getTotalIssueCount()
        Returns:
        the number of errors plus warnings
      • hasWarnings

        public boolean hasWarnings()
        Returns:
        true if at least one warning was recorded
      • hasErrors

        public boolean hasErrors()
        Returns:
        true if at least one error was recorded
      • merge

        public VerificationResult merge​(VerificationResult other)
        Combines this result with another, keeping this result's location and unioning the findings.
        Parameters:
        other - the result to merge in
        Returns:
        a new result valid only if both inputs were valid
      • formatReport

        public String formatReport()
        Formats a multi-line pass/fail report listing every error and warning.
        Returns:
        the formatted report