use of com.tngtech.archunit.library.dependencies.syntax.GivenSlices in project ArchUnit by TNG.
the class GivenSlicesTest method restricting_slices_that_should_not_depend_on_each_other.
@Test
public void restricting_slices_that_should_not_depend_on_each_other() {
archConfigurationRule.setFailOnEmptyShould(false);
GivenSlices givenSlices = slices().matching("..testclasses.(*)..");
JavaClasses classes = new ClassFileImporter().importPackages("com.tngtech.archunit.library.testclasses");
EvaluationResult result = givenSlices.that(DescribedPredicate.<Slice>alwaysFalse()).and(DescribedPredicate.<Slice>alwaysTrue()).should().notDependOnEachOther().evaluate(classes);
assertThat(result.hasViolation()).as("Result has violation").isFalse();
result = givenSlices.that(DescribedPredicate.<Slice>alwaysTrue()).or(DescribedPredicate.<Slice>alwaysFalse()).should().notDependOnEachOther().evaluate(classes);
assertThat(result.hasViolation()).as("Result has violation").isTrue();
}
Aggregations