You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
document the current API and the opt-out annotations
The usage section still described the 1.1.0 API (extends ArchitectureTestBase,
a BLACKLISTED_CLASSES static block), which no longer exists. Replaces it with the
rule collections, records why no rule allows an empty selection, and documents
both opt-out annotations - neither of which any consumer appears to use yet.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The same applies to `ArchRuleConfig.TEST_CLASS_SUFFIXES` when a project introduces a new test type.
49
+
50
+
### Every rule must be able to fail
51
+
52
+
No rule uses `allowEmptyShould(true)`. A rule that selects nothing would otherwise report success,
53
+
which is indistinguishable from a rule that is satisfied - and that is how a broken rule survives
54
+
unnoticed. So a rule whose selection comes up empty fails, and the fix is either to remove the rule
55
+
collection you do not need or to add the code it is meant to check.
56
+
57
+
### Opting out
58
+
59
+
Two annotations exempt a class from a specific rule. Neither is meta-annotated with ArchUnit's
60
+
`@ArchIgnore`: the ArchUnit JUnit engine resolves meta-annotations, so that would skip *every*
61
+
`@ArchTest` on the annotated class and report success rather than exempting it from one rule.
62
+
63
+
| annotation | put it on | exempts from |
64
+
|---|---|---|
65
+
|`@ArchIgnoreNoProductionCounterpart`| a test class | needing a production class of the same name in the same package, and having its `@Nested` classes matched against production methods |
66
+
|`@ArchIgnoreGroupName`| a `@Nested` test class | needing a production method of the same name, for a class that only groups tests |
67
+
68
+
Use `@ArchIgnoreNoProductionCounterpart` for a test named after the behaviour it describes rather than
69
+
after a production class, and on your own `ArchitectureTest`.
70
+
47
71
## Local Development
48
72
49
73
To use this library as a local development dependency, you can simply refer to the version `BUILD-SNAPSHOT`.
0 commit comments