提交 71c922ec 编写于 作者: P psandoz

8027712: DistinctOpTest fails for unordered test

Reviewed-by: henryjen, alanb
上级 2280901d
......@@ -54,10 +54,14 @@ public class DistinctOpTest extends OpTestCase {
// These tests should short-circuit, otherwise will fail with a time-out
// or an OOME
Integer one = Stream.iterate(1, i -> i + 1).unordered().parallel().distinct().findAny().get();
assertEquals(one.intValue(), 1);
// Note that since the streams are unordered and any element is requested
// (a non-deterministic process) the only assertion that can be made is
// that an element should be found
Optional<Integer> oi = ThreadLocalRandom.current().ints().boxed().parallel().distinct().findAny();
Optional<Integer> oi = Stream.iterate(1, i -> i + 1).unordered().parallel().distinct().findAny();
assertTrue(oi.isPresent());
oi = ThreadLocalRandom.current().ints().boxed().parallel().distinct().findAny();
assertTrue(oi.isPresent());
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册