Skip to content

Commit c0ecb0e

Browse files
committed
Do not depend on specific map implementation
1 parent d10d466 commit c0ecb0e

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

java/src/main/java/io/cucumber/testngxmlformatter/XmlReportData.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.time.Instant;
2020
import java.time.format.DateTimeFormatter;
2121
import java.util.AbstractMap.SimpleEntry;
22-
import java.util.EnumMap;
2322
import java.util.List;
2423
import java.util.Locale;
2524
import java.util.Map;
@@ -56,7 +55,7 @@ long getDurationInMilliSeconds(TestCaseStarted testCaseStarted) {
5655
.toMillis();
5756
}
5857

59-
EnumMap<TestStepResultStatus, Long> getTestCaseStatusCounts() {
58+
Map<TestStepResultStatus, Long> getTestCaseStatusCounts() {
6059
return query.countMostSevereTestStepResultStatus();
6160
}
6261

java/src/main/java/io/cucumber/testngxmlformatter/XmlReportWriter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
import javax.xml.stream.XMLOutputFactory;
1010
import javax.xml.stream.XMLStreamException;
1111
import java.io.Writer;
12-
import java.util.EnumMap;
1312
import java.util.EnumSet;
1413
import java.util.List;
1514
import java.util.Map;
1615
import java.util.Map.Entry;
1716
import java.util.Optional;
17+
import java.util.Set;
1818
import java.util.function.Supplier;
1919

2020
import static io.cucumber.messages.types.TestStepResultStatus.PASSED;
@@ -47,19 +47,19 @@ private void writeTestngResults(EscapingXmlStreamWriter writer) throws XMLStream
4747
}
4848

4949
private void writeTestngResultsAttributes(EscapingXmlStreamWriter writer) throws XMLStreamException {
50-
EnumMap<TestStepResultStatus, Long> counts = data.getTestCaseStatusCounts();
50+
Map<TestStepResultStatus, Long> counts = data.getTestCaseStatusCounts();
5151

5252
writer.writeAttribute("failed", String.valueOf(countFailures(counts)));
5353
writer.writeAttribute("passed", counts.get(PASSED).toString());
5454
writer.writeAttribute("skipped", counts.get(SKIPPED).toString());
5555
writer.writeAttribute("total", String.valueOf(data.getTestCaseCount()));
5656
}
5757

58-
private static long countFailures(EnumMap<TestStepResultStatus, Long> counts) {
58+
private static long countFailures(Map<TestStepResultStatus, Long> counts) {
5959
return createNotPassedNotSkippedSet().stream().mapToLong(counts::get).sum();
6060
}
6161

62-
private static EnumSet<TestStepResultStatus> createNotPassedNotSkippedSet() {
62+
private static Set<TestStepResultStatus> createNotPassedNotSkippedSet() {
6363
EnumSet<TestStepResultStatus> notPassedNotSkipped = EnumSet.allOf(TestStepResultStatus.class);
6464
notPassedNotSkipped.remove(PASSED);
6565
notPassedNotSkipped.remove(SKIPPED);

0 commit comments

Comments
 (0)