Java Code Examples for java.util.stream.LambdaTestHelpers#assertContents()

The following examples show how to use java.util.stream.LambdaTestHelpers#assertContents() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InfiniteStreamWithLimitOpTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private <T> ResultAsserter<Iterable<T>> unorderedAsserter() {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            // Can only assert that all elements of the actual result
            // are distinct and that the count is the limit size
            // any element within the range [0, Long.MAX_VALUE) may be
            // present
            assertUnique(act);
            long count = 0;
            for (T l : act) {
                count++;
            }
            assertEquals(count, SKIP_LIMIT_SIZE, "size not equal");
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 2
Source File: SliceOpTest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private ResultAsserter<Iterable<Integer>> sliceResultAsserter(Iterable<Integer> data,
                                                              int expectedSize) {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            List<Integer> expected = new ArrayList<>();
            data.forEach(expected::add);

            List<Integer> actual = new ArrayList<>();
            act.forEach(actual::add);

            assertEquals(actual.size(), expectedSize);
            assertTrue(expected.containsAll(actual));
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 3
Source File: InfiniteStreamWithLimitOpTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private <T> ResultAsserter<Iterable<T>> unorderedAsserter() {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            // Can only assert that all elements of the actual result
            // are distinct and that the count is the limit size
            // any element within the range [0, Long.MAX_VALUE) may be
            // present
            assertUnique(act);
            long count = 0;
            for (T l : act) {
                count++;
            }
            assertEquals(count, SKIP_LIMIT_SIZE, "size not equal");
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 4
Source File: SliceOpTest.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private ResultAsserter<Iterable<Integer>> sliceResultAsserter(Iterable<Integer> data,
                                                              int expectedSize) {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            List<Integer> expected = new ArrayList<>();
            data.forEach(expected::add);

            List<Integer> actual = new ArrayList<>();
            act.forEach(actual::add);

            assertEquals(actual.size(), expectedSize);
            assertTrue(expected.containsAll(actual));
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 5
Source File: InfiniteStreamWithLimitOpTest.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private <T> ResultAsserter<Iterable<T>> unorderedAsserter() {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            // Can only assert that all elements of the actual result
            // are distinct and that the count is the limit size
            // any element within the range [0, Long.MAX_VALUE) may be
            // present
            assertUnique(act);
            long count = 0;
            for (T l : act) {
                count++;
            }
            assertEquals(count, SKIP_LIMIT_SIZE, "size not equal");
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 6
Source File: SliceOpTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private ResultAsserter<Iterable<Integer>> sliceResultAsserter(Iterable<Integer> data,
                                                              int expectedSize) {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            List<Integer> expected = new ArrayList<>();
            data.forEach(expected::add);

            List<Integer> actual = new ArrayList<>();
            act.forEach(actual::add);

            assertEquals(actual.size(), expectedSize);
            assertTrue(expected.containsAll(actual));
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 7
Source File: InfiniteStreamWithLimitOpTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private <T> ResultAsserter<Iterable<T>> unorderedAsserter() {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            // Can only assert that all elements of the actual result
            // are distinct and that the count is the limit size
            // any element within the range [0, Long.MAX_VALUE) may be
            // present
            assertUnique(act);
            long count = 0;
            for (T l : act) {
                count++;
            }
            assertEquals(count, SKIP_LIMIT_SIZE, "size not equal");
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 8
Source File: SliceOpTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private ResultAsserter<Iterable<Integer>> sliceResultAsserter(Iterable<Integer> data,
                                                              int expectedSize) {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            List<Integer> expected = new ArrayList<>();
            data.forEach(expected::add);

            List<Integer> actual = new ArrayList<>();
            act.forEach(actual::add);

            assertEquals(actual.size(), expectedSize);
            assertTrue(expected.containsAll(actual));
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 9
Source File: InfiniteStreamWithLimitOpTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private <T> ResultAsserter<Iterable<T>> unorderedAsserter() {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            // Can only assert that all elements of the actual result
            // are distinct and that the count is the limit size
            // any element within the range [0, Long.MAX_VALUE) may be
            // present
            assertUnique(act);
            long count = 0;
            for (T l : act) {
                count++;
            }
            assertEquals(count, SKIP_LIMIT_SIZE, "size not equal");
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 10
Source File: SliceOpTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private ResultAsserter<Iterable<Integer>> sliceResultAsserter(Iterable<Integer> data,
                                                              int expectedSize) {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            List<Integer> expected = new ArrayList<>();
            data.forEach(expected::add);

            List<Integer> actual = new ArrayList<>();
            act.forEach(actual::add);

            assertEquals(actual.size(), expectedSize);
            assertTrue(expected.containsAll(actual));
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 11
Source File: InfiniteStreamWithLimitOpTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private <T> ResultAsserter<Iterable<T>> unorderedAsserter() {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            // Can only assert that all elements of the actual result
            // are distinct and that the count is the limit size
            // any element within the range [0, Long.MAX_VALUE) may be
            // present
            assertUnique(act);
            long count = 0;
            for (T l : act) {
                count++;
            }
            assertEquals(count, SKIP_LIMIT_SIZE, "size not equal");
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 12
Source File: SliceOpTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private ResultAsserter<Iterable<Integer>> sliceResultAsserter(Iterable<Integer> data,
                                                              int expectedSize) {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            List<Integer> expected = new ArrayList<>();
            data.forEach(expected::add);

            List<Integer> actual = new ArrayList<>();
            act.forEach(actual::add);

            assertEquals(actual.size(), expectedSize);
            assertTrue(expected.containsAll(actual));
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 13
Source File: InfiniteStreamWithLimitOpTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private <T> ResultAsserter<Iterable<T>> unorderedAsserter() {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            // Can only assert that all elements of the actual result
            // are distinct and that the count is the limit size
            // any element within the range [0, Long.MAX_VALUE) may be
            // present
            assertUnique(act);
            long count = 0;
            for (T l : act) {
                count++;
            }
            assertEquals(count, SKIP_LIMIT_SIZE, "size not equal");
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 14
Source File: SliceOpTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private ResultAsserter<Iterable<Integer>> sliceResultAsserter(Iterable<Integer> data,
                                                              int expectedSize) {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            List<Integer> expected = new ArrayList<>();
            data.forEach(expected::add);

            List<Integer> actual = new ArrayList<>();
            act.forEach(actual::add);

            assertEquals(actual.size(), expectedSize);
            assertTrue(expected.containsAll(actual));
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 15
Source File: SliceOpTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private ResultAsserter<Iterable<Integer>> sliceResultAsserter(Iterable<Integer> data,
                                                              int expectedSize) {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            List<Integer> expected = new ArrayList<>();
            data.forEach(expected::add);

            List<Integer> actual = new ArrayList<>();
            act.forEach(actual::add);

            assertEquals(actual.size(), expectedSize);
            assertTrue(expected.containsAll(actual));
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 16
Source File: SliceOpTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private ResultAsserter<Iterable<Integer>> sliceResultAsserter(Iterable<Integer> data,
                                                              int expectedSize) {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            List<Integer> expected = new ArrayList<>();
            data.forEach(expected::add);

            List<Integer> actual = new ArrayList<>();
            act.forEach(actual::add);

            assertEquals(actual.size(), expectedSize);
            assertTrue(expected.containsAll(actual));
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 17
Source File: InfiniteStreamWithLimitOpTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private <T> ResultAsserter<Iterable<T>> unorderedAsserter() {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            // Can only assert that all elements of the actual result
            // are distinct and that the count is the limit size
            // any element within the range [0, Long.MAX_VALUE) may be
            // present
            assertUnique(act);
            long count = 0;
            for (T l : act) {
                count++;
            }
            assertEquals(count, SKIP_LIMIT_SIZE, "size not equal");
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 18
Source File: SliceOpTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private ResultAsserter<Iterable<Integer>> sliceResultAsserter(Iterable<Integer> data,
                                                              int expectedSize) {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            List<Integer> expected = new ArrayList<>();
            data.forEach(expected::add);

            List<Integer> actual = new ArrayList<>();
            act.forEach(actual::add);

            assertEquals(actual.size(), expectedSize);
            assertTrue(expected.containsAll(actual));
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 19
Source File: InfiniteStreamWithLimitOpTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private <T> ResultAsserter<Iterable<T>> unorderedAsserter() {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            // Can only assert that all elements of the actual result
            // are distinct and that the count is the limit size
            // any element within the range [0, Long.MAX_VALUE) may be
            // present
            assertUnique(act);
            long count = 0;
            for (T l : act) {
                count++;
            }
            assertEquals(count, SKIP_LIMIT_SIZE, "size not equal");
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}
 
Example 20
Source File: SliceOpTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private ResultAsserter<Iterable<Integer>> sliceResultAsserter(Iterable<Integer> data,
                                                              int expectedSize) {
    return (act, exp, ord, par) -> {
        if (par & !ord) {
            List<Integer> expected = new ArrayList<>();
            data.forEach(expected::add);

            List<Integer> actual = new ArrayList<>();
            act.forEach(actual::add);

            assertEquals(actual.size(), expectedSize);
            assertTrue(expected.containsAll(actual));
        }
        else {
            LambdaTestHelpers.assertContents(act, exp);
        }
    };
}