use of com.tngtech.archunit.lang.FailureReport in project ArchUnit by TNG.
the class ClassesShouldConjunctionTest method orShould_ORs_conditions_that.
@Test
@UseDataProvider("ORed_conditions_that")
public void orShould_ORs_conditions_that(ArchRule rule) {
EvaluationResult result = rule.evaluate(importClasses(RightOne.class, RightTwo.class, Wrong.class, OtherWrong.class));
FailureReport report = result.getFailureReport();
assertThat(report.toString()).contains(String.format("no classes should access classes that have fully qualified name '%s' or should have fully qualified name '%s'", Wrong.class.getName(), Wrong.class.getName()));
assertThat(report.getDetails()).usingElementComparator(matchesRegex()).contains(classHasFullNameRegex(Wrong.class), otherWrongCallsWrongRegex());
}
use of com.tngtech.archunit.lang.FailureReport in project ArchUnit by TNG.
the class ClassesShouldConjunctionTest method orShould_ORs_conditions.
@Test
@UseDataProvider("ORed_conditions")
public void orShould_ORs_conditions(ArchRule rule) {
EvaluationResult result = rule.evaluate(importClasses(RightOne.class, RightTwo.class, Wrong.class));
FailureReport report = result.getFailureReport();
assertThat(report.toString()).contains(String.format("classes should have fully qualified name '%s' or should have fully qualified name '%s'", RightOne.class.getName(), RightTwo.class.getName()));
assertThat(report.getDetails()).containsOnly(String.format("%s and %s", doesntHaveFqnMessage(Wrong.class, RightOne.class), doesntHaveFqnMessage(Wrong.class, RightTwo.class)));
}
Aggregations