diff --git a/src/test/java/com/github/smartfootballtable/cognition/DetectionExamples.java b/src/test/java/com/github/smartfootballtable/cognition/DetectionExamples.java index 6ccaa171..a458f053 100644 --- a/src/test/java/com/github/smartfootballtable/cognition/DetectionExamples.java +++ b/src/test/java/com/github/smartfootballtable/cognition/DetectionExamples.java @@ -469,15 +469,14 @@ public DurationSequence(Arbitrary base, Arbitrary between, Time @Override Arbitrary> build() { - return forDuration - .flatMap(minDuration -> base.collect(positions -> durationReached(positions, minDuration))); + return forDuration.flatMap(m -> base.collect(p -> durationReached(p, m))); } - private boolean durationReached(List positions, long minDuration) { + private boolean durationReached(List positions, long minDuration) { return positions.size() > 1 && duration(positions.stream().limit(positions.size() - 1)) >= minDuration; } - private long duration(Stream stream) { + private long duration(Stream stream) { return stream.mapToLong(OffsetPos::getOffset).sum(); }