I have two packages com.myapp.foo and com.myapp.bar and I want to know the most elegant way to explicitly check if those two packages (and only those, as there are some more com.myapp.XX) do not depend on each other.
This is what I have right now (working splendid):
SliceAssignment packagesFooAndBar = new SliceAssignment() {
@Override
public String getDescription() {
return "foo and bar";
}
@Override
public SliceIdentifier getIdentifierOf(JavaClass javaClass) {
if (javaClass.getPackageName().startsWith("com.myapp.foo")) {
return SliceIdentifier.of("foo");
}
if (javaClass.getPackageName().startsWith("com.myapp.bar")) {
return SliceIdentifier.of("bar");
}
return SliceIdentifier.ignore();
}
};
@ArchTest
final ArchRule packagesFooAndBarNotDependOnEachOther = SlicesRuleDefinition
.slices()
.assignedFrom(packagesFooAndBar)
.should()
.notDependOnEachOther();
Is there a more elegant way, maybe without using the SliceAssignment? Thanks!
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)