Package com.tngtech.archunit.lang
Class EvaluationResult
java.lang.Object
com.tngtech.archunit.lang.EvaluationResult
public final class EvaluationResult
extends java.lang.Object
Represents the result of evaluating an
ArchRule
against some JavaClasses
.
To react to failures during evaluation of the rule, one can use handleViolations(ViolationHandler)
:
result.handleViolations(new ViolationHandler<JavaAccess<?>>() {
@Override
public void handle(Collection<JavaAccess<?>> violatingObjects, String message) {
// do some reporting or react in any way to violation
}
});
-
Constructor Summary
Constructors Constructor Description EvaluationResult(HasDescription rule, ConditionEvents events, Priority priority)
EvaluationResult(HasDescription rule, Priority priority)
-
Method Summary
Modifier and Type Method Description void
add(EvaluationResult part)
EvaluationResult
filterDescriptionsMatching(Predicate<java.lang.String> linePredicate)
Filters all recordedConditionEvents
by their textual description.FailureReport
getFailureReport()
Priority
getPriority()
void
handleViolations(ViolationHandler<?> violationHandler)
boolean
hasViolation()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
EvaluationResult
-
EvaluationResult
@PublicAPI(usage=ACCESS) public EvaluationResult(HasDescription rule, ConditionEvents events, Priority priority)
-
-
Method Details
-
getFailureReport
-
add
-
handleViolations
@PublicAPI(usage=ACCESS, state=EXPERIMENTAL) public void handleViolations(ViolationHandler<?> violationHandler) -
hasViolation
-
getPriority
-
filterDescriptionsMatching
@PublicAPI(usage=ACCESS) public EvaluationResult filterDescriptionsMatching(Predicate<java.lang.String> linePredicate)Filters all recordedConditionEvents
by their textual description. I.e. the lines of the description of an event are passed to the supplied predicate to decide if the event is relevant.- Parameters:
linePredicate
- A predicate to determine which lines of events match. Predicate.apply(..) == true will imply the violation will be preserved.- Returns:
- A new
EvaluationResult
containing only matching events
-