Package com.tngtech.archunit.lang
Class EvaluationResult
java.lang.Object
com.tngtech.archunit.lang.EvaluationResult
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
ConstructorDescriptionEvaluationResult
(HasDescription rule, ConditionEvents events, Priority priority) EvaluationResult
(HasDescription rule, Priority priority) -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(EvaluationResult part) filterDescriptionsMatching
(Predicate<String> linePredicate) Filters all recordedConditionEvents
by their textual description.void
handleViolations
(ViolationHandler<?> violationHandler) boolean
-
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<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
-