3232import java .util .AbstractMap .SimpleEntry ;
3333import java .util .ArrayList ;
3434import java .util .Arrays ;
35+ import java .util .Collection ;
3536import java .util .Collections ;
3637import java .util .Comparator ;
3738import java .util .EnumMap ;
@@ -74,11 +75,11 @@ public final class Query {
7475 .collect (Collectors .toMap (identity (), (s ) -> 0L ));
7576 private final Comparator <TestStepResult > testStepResultComparator = nullsFirst (comparing (o -> o .getStatus ().ordinal ()));
7677 private final Map <String , TestCaseStarted > testCaseStartedById = new LinkedHashMap <>();
77- private final Map <String , TestCaseFinished > testCaseFinishedByTestCaseStartedId = new HashMap <>();
78- private final Map <String , List <TestStepFinished >> testStepsFinishedByTestCaseStartedId = new HashMap <>();
79- private final Map <String , List <TestStepStarted >> testStepsStartedByTestCaseStartedId = new HashMap <>();
78+ private final Map <String , TestCaseFinished > testCaseFinishedByTestCaseStartedId = new LinkedHashMap <>();
79+ private final Map <String , List <TestStepFinished >> testStepsFinishedByTestCaseStartedId = new LinkedHashMap <>();
80+ private final Map <String , List <TestStepStarted >> testStepsStartedByTestCaseStartedId = new LinkedHashMap <>();
8081 private final Map <String , Pickle > pickleById = new LinkedHashMap <>();
81- private final Map <String , TestCase > testCaseById = new HashMap <>();
82+ private final Map <String , TestCase > testCaseById = new LinkedHashMap <>();
8283 private final Map <String , Step > stepById = new LinkedHashMap <>();
8384 private final Map <String , TestStep > testStepById = new LinkedHashMap <>();
8485 private final Map <String , PickleStep > pickleStepById = new LinkedHashMap <>();
@@ -121,6 +122,12 @@ public List<TestCaseStarted> findAllTestCaseStarted() {
121122 .collect (toList ());
122123 }
123124
125+ public List <TestCaseFinished > findAllTestCaseFinished () {
126+ return this .testCaseFinishedByTestCaseStartedId .values ().stream ()
127+ .filter (TestCaseFinished ::getWillBeRetried )
128+ .collect (toList ());
129+ }
130+
124131 public Map <Optional <Feature >, List <TestCaseStarted >> findAllTestCaseStartedGroupedByFeature () {
125132 return findAllTestCaseStarted ()
126133 .stream ()
@@ -144,6 +151,22 @@ public List<TestStep> findAllTestSteps() {
144151 return new ArrayList <>(testStepById .values ());
145152 }
146153
154+ public List <TestCase > findAllTestCases () {
155+ return new ArrayList <>(testCaseById .values ());
156+ }
157+
158+ public List <TestStepStarted > findAllTestStepsStarted () {
159+ return testStepsStartedByTestCaseStartedId .values ().stream ()
160+ .flatMap (Collection ::stream )
161+ .collect (toList ());
162+ }
163+
164+ public List <TestStepFinished > findAllTestStepsFinished () {
165+ return testStepsFinishedByTestCaseStartedId .values ().stream ()
166+ .flatMap (Collection ::stream )
167+ .collect (toList ());
168+ }
169+
147170 public List <Attachment > findAttachmentsBy (TestStepFinished testStepFinished ) {
148171 requireNonNull (testStepFinished );
149172 return attachmentsByTestCaseStartedId .getOrDefault (testStepFinished .getTestCaseStartedId (), emptyList ()).stream ()
0 commit comments