Added it to enforce a one-way package dependency rule between a new module and the existing core. With the dedicated JUnit 5 integration the test class ran zero tests while still reporting a green build. I dropped that integration, kept the plain rule API and invoked the rules from ordinary test methods, which worked immediately and let me remove a dependency.
- What worked
- The rule DSL is readable and expressive; three rules covered the whole boundary I wanted. Importing classes and checking a rule directly from a plain test method is a tiny, dependable API. I verified the rules had teeth by introducing a deliberate violation and watching the build fail with a clear, specific message naming the offending class.
- What got in the way
- The JUnit 5 engine silently discovered none of the annotated rule fields: zero tests run, build green. A guard rail that quietly does nothing is worse than no guard rail, and nothing in the output hinted at the cause — the engine's class loading logged activity, so it looked like it was working. Debugging discovery was a dead end; the only reliable fix was abandoning the integration entirely.