Commit 9d090ea
committed
style(testng): stop spelling out imports the compiler can resolve
SuiteResult compared two possibly-absent <test> names by writing out both
java.util.Objects.compare and java.util.Comparator.nullsFirst on one line, where
neither name clashes with anything the file imports. The comparator is now a
named constant that says what the order is -- an unnamed <test> sorts first --
and the call site is one short expression.
ClassImpl and TestResult keep java.util.Objects out of their bodies with a static
import of requireNonNull. Both files import org.testng.collections.Objects for
toStringHelper, which is what forced the qualified form; the repo already static
imports JDK members this way (StandardCharsets.UTF_8) and its own helpers
(Utils.isStringNotEmpty, ListenerComparator.sort).
MethodInstance keeps the one qualified java.util.Objects.equals it has:
org.testng.collections.Objects offers no equals, and a bare static-imported
equals(a, b) inside a class reads like this.equals.
testng-core's dependency block also loses the comment about annotations needing
to be on the compile classpath. It explained the spotbugs compileOnly that went
with the last javax.annotation uses, and described nothing once that left.1 parent fe259fb commit 9d090ea
4 files changed
Lines changed: 13 additions & 7 deletions
File tree
- testng-core
- src/main/java/org/testng
- internal
- testng-runner-api/src/main/java/org/testng/internal
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
9 | 14 | | |
10 | 15 | | |
11 | 16 | | |
| |||
30 | 35 | | |
31 | 36 | | |
32 | 37 | | |
33 | | - | |
34 | | - | |
| 38 | + | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| |||
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
107 | | - | |
108 | | - | |
| 109 | + | |
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| |||
174 | 175 | | |
175 | 176 | | |
176 | 177 | | |
177 | | - | |
| 178 | + | |
178 | 179 | | |
179 | 180 | | |
180 | 181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
195 | 197 | | |
196 | 198 | | |
197 | 199 | | |
198 | | - | |
| 200 | + | |
199 | 201 | | |
200 | 202 | | |
201 | 203 | | |
| |||
0 commit comments