Skip to content
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

Make failOnEmptyShould overridable per rule #808

Closed
famod opened this issue Feb 21, 2022 · 1 comment · Fixed by #816
Closed

Make failOnEmptyShould overridable per rule #808

famod opened this issue Feb 21, 2022 · 1 comment · Fixed by #816

Comments

@famod
Copy link
Contributor

famod commented Feb 21, 2022

failOnEmptyShould is a nice new feature, thanks for that.

Unfortunately we have to switch it off because we have a Maven test-jar that contains multiple AU tests that are run in each module of out multi-module Maven project and in some modules not all tests catch respective classes (because there none with such criteria).

It would be nice if there was e.g. *Should.failOnEmpty(boolean), to be able to override this case by case.

@codecholeric
Copy link
Collaborator

Thanks for raising the issue 👍 I agree that we need some way to make this configurable on a per rule basis (compare #806). The question is just where to put it exactly 🤔

I guess it could go in the beginning ArchRuleDefinition.failOnEmptyShould(false).classes().that()... or in the end classes()...should()...allowEmptyShould(false). In any case this probably means we have to add it individually to various places 😞 Would be nice if this could easily be done in a generic way in one central place (i.e. add a new rule API and it will automatically support it), but I don't see a way for that. Maybe for the standard rules APIs (e.g. classes(), methods(), ...) we can introduce a common parent interface, because in the end containNumberOfElements(..) also is a rules method that makes sense no matter what type of element it is. We could introduce a parent ClassesShould extend ObjectsShould that different Should types could extend to inherit the parts that make sense for all rule APIs. One question is, if we also need to add this to the layeredArchitecture()/onionArchitecture() and slices() APIs 🤔

What do you think @oberprah? Do you want to tackle this as a follow-up? 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants