Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8027712

DistinctOpTest fails for unordered test

XMLWordPrintable

        TESTFAIL:java/util/stream/test/org/openjdk/tests/java/util/stream/DistinctOpTest.java

            public void testWithUnorderedInfiniteStream() {
                // 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);

                Optional<Integer> oi = ThreadLocalRandom.current().ints().boxed().parallel().distinct().findAny();
                assertTrue(oi.isPresent());
            }

        The first part of this test is failing because it incorrectly asserts the value for the first element, it should be the same as the second part of the test.

              psandoz Paul Sandoz
              psandoz Paul Sandoz
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: