32
32
import java .util .AbstractMap .SimpleEntry ;
33
33
import java .util .ArrayList ;
34
34
import java .util .Arrays ;
35
+ import java .util .Collection ;
35
36
import java .util .Collections ;
36
37
import java .util .Comparator ;
37
38
import java .util .EnumMap ;
@@ -74,11 +75,11 @@ public final class Query {
74
75
.collect (Collectors .toMap (identity (), (s ) -> 0L ));
75
76
private final Comparator <TestStepResult > testStepResultComparator = nullsFirst (comparing (o -> o .getStatus ().ordinal ()));
76
77
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 <>();
80
81
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 <>();
82
83
private final Map <String , Step > stepById = new LinkedHashMap <>();
83
84
private final Map <String , TestStep > testStepById = new LinkedHashMap <>();
84
85
private final Map <String , PickleStep > pickleStepById = new LinkedHashMap <>();
@@ -121,6 +122,12 @@ public List<TestCaseStarted> findAllTestCaseStarted() {
121
122
.collect (toList ());
122
123
}
123
124
125
+ public List <TestCaseFinished > findAllTestCaseFinished () {
126
+ return this .testCaseFinishedByTestCaseStartedId .values ().stream ()
127
+ .filter (TestCaseFinished ::getWillBeRetried )
128
+ .collect (toList ());
129
+ }
130
+
124
131
public Map <Optional <Feature >, List <TestCaseStarted >> findAllTestCaseStartedGroupedByFeature () {
125
132
return findAllTestCaseStarted ()
126
133
.stream ()
@@ -144,6 +151,22 @@ public List<TestStep> findAllTestSteps() {
144
151
return new ArrayList <>(testStepById .values ());
145
152
}
146
153
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
+
147
170
public List <Attachment > findAttachmentsBy (TestStepFinished testStepFinished ) {
148
171
requireNonNull (testStepFinished );
149
172
return attachmentsByTestCaseStartedId .getOrDefault (testStepFinished .getTestCaseStartedId (), emptyList ()).stream ()
0 commit comments