Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Changed
- [Java] increase dependency messages to at least v28.1 ([#87](https://github.com/cucumber/query/pull/87))


## [13.6.0] - 2025-08-11
### Changed
Expand Down
2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>messages</artifactId>
<version>[24.0.0,29.0.0)</version>
<version>[28.1.0,29.0.0)</version>
</dependency>

<dependency>
Expand Down
15 changes: 6 additions & 9 deletions java/src/main/java/io/cucumber/query/Query.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.cucumber.query;

import io.cucumber.messages.Convertor;
import io.cucumber.messages.TestStepResultStatusComparator;
import io.cucumber.messages.types.Attachment;
import io.cucumber.messages.types.Envelope;
import io.cucumber.messages.types.Examples;
Expand Down Expand Up @@ -31,9 +32,7 @@
import java.time.Duration;
import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.LinkedHashMap;
Expand All @@ -44,11 +43,9 @@
import java.util.Optional;
import java.util.function.BiFunction;
import java.util.function.Supplier;
import java.util.stream.Collectors;

import static java.util.Collections.emptyList;
import static java.util.Comparator.comparing;
import static java.util.Comparator.nullsFirst;
import static java.util.Objects.requireNonNull;
import static java.util.Optional.ofNullable;
import static java.util.function.Function.identity;
Expand All @@ -70,9 +67,6 @@
* @see <a href="https://github.com/cucumber/messages?tab=readme-ov-file#message-overview">Cucumber Messages - Message Overview</a>
*/
public final class Query {
private static final Map<TestStepResultStatus, Long> ZEROES_BY_TEST_STEP_RESULT_STATUSES = Arrays.stream(TestStepResultStatus.values())
.collect(Collectors.toMap(identity(), (s) -> 0L));
private final Comparator<TestStepResult> testStepResultComparator = nullsFirst(comparing(o -> o.getStatus().ordinal()));
private final Map<String, TestCaseStarted> testCaseStartedById = new LinkedHashMap<>();
private final Map<String, TestCaseFinished> testCaseFinishedByTestCaseStartedId = new HashMap<>();
private final Map<String, List<TestStepFinished>> testStepsFinishedByTestCaseStartedId = new HashMap<>();
Expand All @@ -91,7 +85,10 @@ public final class Query {
private TestRunFinished testRunFinished;

public Map<TestStepResultStatus, Long> countMostSevereTestStepResultStatus() {
EnumMap<TestStepResultStatus, Long> results = new EnumMap<>(ZEROES_BY_TEST_STEP_RESULT_STATUSES);
EnumMap<TestStepResultStatus, Long> results = new EnumMap<>(TestStepResultStatus.class);
for (TestStepResultStatus value : TestStepResultStatus.values()) {
results.put(value, 0L);
}
results.putAll(findAllTestCaseStarted().stream()
.map(this::findMostSevereTestStepResultBy)
.filter(Optional::isPresent)
Expand Down Expand Up @@ -172,7 +169,7 @@ public Optional<TestStepResult> findMostSevereTestStepResultBy(TestCaseStarted t
return findTestStepsFinishedBy(testCaseStarted)
.stream()
.map(TestStepFinished::getTestStepResult)
.max(testStepResultComparator);
.max(comparing(TestStepResult::getStatus, new TestStepResultStatusComparator()));
}

public String findNameOf(GherkinDocument element, NamingStrategy namingStrategy) {
Expand Down
30 changes: 0 additions & 30 deletions java/src/main/java/io/cucumber/query/TimestampComparator.java

This file was deleted.

42 changes: 0 additions & 42 deletions java/src/test/java/io/cucumber/query/TimestampComparatorTest.java

This file was deleted.