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

How to fail tests if no classes are imported? #1325

Closed
bbadjari opened this issue Jun 26, 2024 · 2 comments
Closed

How to fail tests if no classes are imported? #1325

bbadjari opened this issue Jun 26, 2024 · 2 comments

Comments

@bbadjari
Copy link

Is there a convenient way to fail tests when no classes are imported via ClassFileImporter? I found some old tests that continued to pass even though they were doing nothing useful because ClassFileImporter was attempting to import classes from a package (via the importPackages() method) that no longer existed.

@hankem
Copy link
Member

hankem commented Jun 26, 2024

Since #774 (released with ArchUnit 0.23.0), ArchUnit can Fail Rules on Empty Should, i.e. when the should-part of rules is evaluated against an empty set of classes, which should catch your case.

You're not accidentially using an archunit.properties file with archRule.failOnEmptyShould=false (or even a very old version of ArchUnit), are you?

@codecholeric
Copy link
Collaborator

Gonna close this for now, feel free to reopen if you want to pick this up gain!

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

No branches or pull requests

3 participants