use of com.tngtech.archunit.exampletest.extension.EvaluatedRuleEvent in project ArchUnit by TNG.
the class ExtensionIntegrationTest method evaluation_results_are_dispatched_to_extensions.
@Test
void evaluation_results_are_dispatched_to_extensions() {
ArchConfiguration.get().configureExtension(ExampleExtension.UNIQUE_IDENTIFIER).setProperty("enabled", true);
ArchRule rule = noClasses().should().haveFullyQualifiedName(ClassViolatingCodingRules.class.getName());
checkRuleAndIgnoreFailure(classes, rule);
assertThat(ExampleExtension.getConfigurationEvents()).hasSize(1);
assertThat(ExampleExtension.getConfigurationEvents()).extracting("properties").are(containingEntry("example-prop", "exampleValue"));
EvaluatedRuleEvent event = getOnlyElement(ExampleExtension.getEvaluatedRuleEvents());
assertThat(event.contains(rule)).as("Rule was passed").isTrue();
assertThat(event.contains(classes)).as("Classes were passed").isTrue();
assertThat(event.hasViolationFor(ClassViolatingCodingRules.class)).as("Has violation for " + ClassViolatingCodingRules.class.getSimpleName()).isTrue();
}
Aggregations