-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interfaces syntax #36
Conversation
Cool, thanks a lot 😃
doesn't work, because even if we have source 1.7, we sometimes want to compile it with JDK 8, and then the test fails, even though it's not possible to use the language features. So maybe adding a TODO plus a guard in
would work (or do you have a better idea?)
and you'll see, that your String value is actually contained within the class file, thus on bytecode level, there is no access. You can fix this though, by making it an |
38b9c59
to
4370db4
Compare
Indeed, when changing the example to access an Object field, the tests work. So no need for a Java 8 guard here. I'll have a look at adding an integration test. |
Glad to hear, that it works without any shady workaround 😃 |
-should().onlyBeAccessed().byClassesThat().are*Interfaces() does not make sense in Java 1.7, the tests for this are currently @ignored.
… (examples use @Slow)
4370db4
to
e04a9e1
Compare
I've added examples + integration tests, hope they aren't too artificial ;) There was a problem with the build in archunit-examples, a dependency was missing, running ../gradlew clean build -P example in archunit-examples failed with a ClassNotFoundException. How about running the examples as a smoke test in the CI? |
Ah, that dependency I've just removed a little while ago Anyway, the PR looks good, thank you so much 😃 I'll merge that now... |
I've added the excludeCategories only where necessary, so I could remove the dependency again... |
Adds syntax for interface predicates and conditions, e.g. classes().that().areInterfaces().should().beInterfaces() Resolves #28
This adds are(Not)Interfaces and (not)beInterfaces.
The should().onlyBeAccessed().byClassesThat().are*Interfaces() doesn't make sense in Java 7, only with Java 8 with default methods. I added the relevant tests and tried them with Java 8, however currently they are ignored. See TODOs in ShouldOnlyBeAccessedByClassesThatTest.
Accessing a constant from an interface does not count as an access - is this as intended? Also see ShouldOnlyBeAccessedByClassesThatTest.java.
I hereby agree to the terms of the ArchUnit Contributor License Agreement.
Resolves #28