Skip to content

Commit aaceb75

Browse files
committed
Add more queries
1 parent 59b88cf commit aaceb75

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

java/src/main/java/io/cucumber/query/Query.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,12 @@ public Optional<Location> findLocationOf(Pickle pickle) {
247247
public Optional<Pickle> findPickleBy(TestCaseStarted testCaseStarted) {
248248
requireNonNull(testCaseStarted);
249249
return findTestCaseBy(testCaseStarted)
250-
.map(TestCase::getPickleId)
251-
.map(pickleById::get);
250+
.flatMap(this::findPickleBy);
251+
}
252+
253+
public Optional<Pickle> findPickleBy(TestCase testCase) {
254+
requireNonNull(testCase);
255+
return ofNullable(pickleById.get(testCase.getPickleId()));
252256
}
253257

254258
public Optional<Pickle> findPickleBy(TestStepStarted testStepStarted) {

0 commit comments

Comments
 (0)