ArchUnit
ArchUnit copied to clipboard
How to fail tests if no classes are imported?
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.
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?
Gonna close this for now, feel free to reopen if you want to pick this up gain!