-
Notifications
You must be signed in to change notification settings - Fork 306
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
Unable to use Mixin pattern because interface instances cannot be created #223
Comments
Honestly, the way ArchUnit implements composability at the moment is not via traits, but via
Even though I think composing the rules as fields would make this even easier, to just pick individual rules in individual contexts i.e.
But only if you even need that, for me it seems like you always want to test I think this might be related to #104 though? I just didn't get around to implement this, because it isn't high priority for me (since I consider composition as layed out here good enough). I'm open for a PR though 😉 |
Thanks for your reply. I ended up having a facade
As a maintainer of an open-source project (speedment), I fully understand that features need to be prioritized and I agree that this issue might be of less importance relative to others. |
This is how it looks like in a module doing the actual tests (doing all the available tests):
|
Sometimes it is useful to be able to compose ArchUnit tests from interfaces with default implementations. This is a pattern that works for JUnit for example.
So I have an "trait" interface like this:
Then I can just elect to implement this rule in applicable module tests. I also have a default set like this:
And then module tests can
implement
this and get all checks or just pick individual depending on the situation.However, ArchUnit cannot create interfaces:
The text was updated successfully, but these errors were encountered: