Replies: 1 comment
-
|
I have managed to get it working with the following rule: noClasses()
.that().resideInAnyPackage("a..")
.should().dependOnClassesThat().resideInAPackage("b..")
.andShould(not(dependOnClassesThat(JavaClass.Predicates.resideInAnyPackage("b.c.."))))It is clear that one could extend the Lang to cover this. However, the double negation |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
ArchUnit is great and helps us a lot!
However, I have one problem. I feel that there should be a solution, only I haven't understood how to formulate the rule.
What I want to express is that no class from package "a" should depend on any class in "b", unless it is in "b.c".
The difficulty is the
butNot(), which doesn't exist.I have tried the inverse, which looks like this:
...but that is a test of the classes in c, not of the classes in a. If the classes that I have loaded only contain the classes from a, then this won't help me. Or will it?
Of course, I could use the
freezefunctionality for this, but I would prefer to usefreezefor real exceptions that I would like to get rid of, not for actual intentional cases.Beta Was this translation helpful? Give feedback.
All reactions