Commit 630fab9
report what a rule cannot verify instead of passing
Removes the remaining ways a rule stayed quiet.
allowEmptyShould(true) is gone everywhere. A rule that selects nothing reported
success, indistinguishable from a rule that is satisfied, which is what let a
dead rule survive. EmptySelectionTest pins this for all eight rules that narrow
their input. Consequence to be aware of: CommonArchRuleCollection now fails in a
project with no controllers or no @Store classes, so implement it only where
those exist.
The @nested name rule skipped a nested class silently whenever the production
class was missing and the nested class was not inside a group - so the case with
nothing to compare against was the one case never reported. It now reports, and
in exchange honours @ArchIgnoreNoProductionCounterpart: a test class that
declares it has no production counterpart has no production methods either.
The security-test rule accepted any @nested class *starting with* the method
name, so getAll() counted as covered by GetAllArchived. It now requires the name
to match exactly or to continue with "$", which keeps grouped @nested classes
working.
The SortMappings rule swallowed every failure to read a field into a log.warn -
and the build has no SLF4J provider, so the warning was discarded outright. A
non-static field, an unreadable field, an unresolvable enum type and a value
that is not a Map are all violations now. Non-static in particular is reported
as such, since it can never be validated.
Finally, @ArchIgnoreNoProductionCounterpart and @ArchIgnoreGroupName no longer
meta-annotate ArchUnit's @ArchIgnore. The ArchUnit JUnit engine resolves
meta-annotations, so annotating a test class skipped *every* @archtest on it and
still reported BUILD SUCCESS - verified: putting it on this project's own
ArchitectureTest turned 11 rules into 11 skips. Both annotations are read by
their own type, so the meta-annotation bought nothing. ArchitectureTest now
carries it in place of the name that was hardcoded into the counterpart rule,
which also keeps the annotation exercised.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 0aef3db commit 630fab9
11 files changed
Lines changed: 303 additions & 167 deletions
File tree
- src
- main/java/it/aboutbits/archunit/toolbox
- rule
- base
- common
- support
- test/java/it/aboutbits/archunit/toolbox
- support
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
Lines changed: 16 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | | - | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
| 24 | + | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
30 | 35 | | |
31 | | - | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
| |||
113 | 117 | | |
114 | 118 | | |
115 | 119 | | |
116 | | - | |
117 | | - | |
| 120 | + | |
118 | 121 | | |
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
122 | 125 | | |
123 | 126 | | |
124 | 127 | | |
125 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
126 | 134 | | |
127 | 135 | | |
128 | 136 | | |
129 | 137 | | |
130 | 138 | | |
131 | 139 | | |
132 | 140 | | |
133 | | - | |
134 | | - | |
135 | | - | |
| 141 | + | |
136 | 142 | | |
137 | 143 | | |
138 | 144 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
Lines changed: 16 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
83 | 88 | | |
84 | 89 | | |
85 | 90 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 91 | + | |
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| |||
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
109 | 120 | | |
110 | 121 | | |
0 commit comments