Skip to content

Commit ed99e51

Browse files
committed
Improve debug output for single test split
1 parent 8873fe5 commit ed99e51

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/main/java/de/donnerbart/split/TestSplit.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,20 @@ public TestSplit(
141141
}));
142142

143143
if (debug) {
144-
final var fastestSplit = splits.stream().min(Comparator.naturalOrder()).orElseThrow();
145-
LOG.debug("Fastest test plan is #{} with {} tests ({})",
146-
fastestSplit.formatIndex(),
147-
fastestSplit.tests().size(),
148-
formatTime(fastestSplit.totalRecordedTime()));
149-
final var slowestSplit = splits.stream().max(Comparator.naturalOrder()).orElseThrow();
150-
LOG.debug("Slowest test plan is #{} with {} tests ({})",
151-
slowestSplit.formatIndex(),
152-
slowestSplit.tests().size(),
153-
formatTime(slowestSplit.totalRecordedTime()));
154-
LOG.debug("Difference between the fastest and slowest test plan: {}",
155-
formatTime(slowestSplit.totalRecordedTime() - fastestSplit.totalRecordedTime()));
144+
if (splitTotal > 1) {
145+
final var fastestSplit = splits.stream().min(Comparator.naturalOrder()).orElseThrow();
146+
LOG.debug("Fastest test plan is #{} with {} tests ({})",
147+
fastestSplit.formatIndex(),
148+
fastestSplit.tests().size(),
149+
formatTime(fastestSplit.totalRecordedTime()));
150+
final var slowestSplit = splits.stream().max(Comparator.naturalOrder()).orElseThrow();
151+
LOG.debug("Slowest test plan is #{} with {} tests ({})",
152+
slowestSplit.formatIndex(),
153+
slowestSplit.tests().size(),
154+
formatTime(slowestSplit.totalRecordedTime()));
155+
LOG.debug("Difference between the fastest and slowest test plan: {}",
156+
formatTime(slowestSplit.totalRecordedTime() - fastestSplit.totalRecordedTime()));
157+
}
156158
LOG.debug("Test splits:");
157159
splits.stream().sorted(Comparator.reverseOrder()).forEach(n -> LOG.debug(n.toString()));
158160
}

0 commit comments

Comments
 (0)