Package com.tonic.analysis.verifier
Class VerificationResult
- java.lang.Object
-
- com.tonic.analysis.verifier.VerificationResult
-
public final class VerificationResult extends Object
Immutable outcome of a verification run: validity plus the collected errors and warnings.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static VerificationResultfailure(List<VerificationError> errors)Creates an unlocated result from mixed findings; it is still valid if none are ERROR severity.static VerificationResultfailure(List<VerificationError> errors, String className)Creates a result for a class from mixed findings; it is still valid if none are ERROR severity.static VerificationResultfailure(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.StringformatReport()Formats a multi-line pass/fail report listing every error and warning.List<VerificationError>getAllIssues()StringgetClassName()intgetErrorCount()List<VerificationError>getErrors()StringgetMethodName()intgetTotalIssueCount()intgetWarningCount()List<VerificationError>getWarnings()booleanhasErrors()booleanhasWarnings()booleanisValid()VerificationResultmerge(VerificationResult other)Combines this result with another, keeping this result's location and unioning the findings.static VerificationResultsuccess()Creates an unlocated passing result.static VerificationResultsuccess(String className)Creates a passing result for a class.static VerificationResultsuccess(String className, String methodName)Creates a passing result for a method.StringtoString()
-
-
-
Method Detail
-
isValid
public boolean isValid()
- Returns:
- whether valid
-
getErrors
public List<VerificationError> getErrors()
- Returns:
- the errors
-
getWarnings
public List<VerificationError> getWarnings()
- Returns:
- the warnings
-
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 namemethodName- 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 mixedclassName- 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 mixedclassName- the verified class namemethodName- 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
-
-