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

failOnEmptyShould conflicts with optionalLayer #809

Closed
bjpe opened this issue Feb 24, 2022 · 1 comment · Fixed by #816
Closed

failOnEmptyShould conflicts with optionalLayer #809

bjpe opened this issue Feb 24, 2022 · 1 comment · Fixed by #816

Comments

@bjpe
Copy link

bjpe commented Feb 24, 2022

Hi, I have an ArchUnit test for a layered architecture, which has some mandatory layers and some optional layers, which are currently empts (i.e., there are no classes in the referred package).

This works fine with ArchUnit 0.22.0, but after an update to ArchUnit 0.23.0 I got

java.lang.AssertionError: Rule failed to check any classes. This means either that no classes have been passed to the rule at all, or that no classes passed to the rule matched the `that()` clause. To allow rules being evaluated without checking any classes you can set the ArchUnit property archRule.failOnEmptyShould = false

Removing the access restriction for the optional, empty layer fixes the test, as well as setting

archRule.failOnEmptyShould=false

but without this property the optional layers seem not so optional anymore.

@codecholeric
Copy link
Collaborator

Thanks for raising this, it seems to go into the same direction as #803, #806 and #808 👍 But I also see that there is an additional component, because layered architecture is composed from multiple sub-rules we need to watch out to in any case set each optional layer sub-rule to allow empty should, no matter what the configuration says.
/cc @oberprah

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