java.util.stream.LongStreamTestDataProvider Java Examples

The following examples show how to use java.util.stream.LongStreamTestDataProvider. 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: CountTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testOps(String name, TestData.OfLong data) {
    long expectedCount = data.size();

    withData(data).
            terminal(LongStream::count).
            expectedResult(expectedCount).
            exercise();

    withData(data).
            terminal(s -> s.filter(e -> true), LongStream::count).
            expectedResult(expectedCount).
            exercise();

    expectedCount = data.into(new HashSet<>()).size();
    withData(data).
            terminal(LongStream::distinct, LongStream::count).
            expectedResult(expectedCount).
            exercise();
    withData(data).
            terminal(s -> s.unordered().distinct(), LongStream::count).
            expectedResult(expectedCount).
            exercise();
}
 
Example #2
Source File: CountTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testOps(String name, TestData.OfLong data) {
    AtomicLong expectedCount = new AtomicLong();
    data.stream().forEach(e -> expectedCount.incrementAndGet());

    withData(data).
            terminal(LongStream::count).
            expectedResult(expectedCount.get()).
            exercise();
}
 
Example #3
Source File: MatchOpTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongStream(String name, TestData.OfLong data) {
    for (LongPredicate p : LONG_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpFalse), longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpEven), longKinds.get(kind).apply(p));
        }
    }
}
 
Example #4
Source File: FlatMapOpTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongOps(String name, TestData.OfLong data) {
    Collection<Long> result = exerciseOps(data, s -> s.flatMap(i -> Collections.singleton(i).stream().mapToLong(j -> j)));
    assertEquals(data.size(), result.size());
    assertContents(data, result);

    result = exerciseOps(data, s -> LongStream.empty());
    assertEquals(0, result.size());
}
 
Example #5
Source File: MatchOpTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongStream(String name, TestData.OfLong data) {
    for (LongPredicate p : LONG_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpFalse), longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpEven), longKinds.get(kind).apply(p));
        }
    }
}
 
Example #6
Source File: CountTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testOps(String name, TestData.OfLong data) {
    AtomicLong expectedCount = new AtomicLong();
    data.stream().forEach(e -> expectedCount.incrementAndGet());

    withData(data).
            terminal(LongStream::count).
            expectedResult(expectedCount.get()).
            exercise();
}
 
Example #7
Source File: MatchOpTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongStream(String name, TestData.OfLong data) {
    for (LongPredicate p : LONG_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpFalse), longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpEven), longKinds.get(kind).apply(p));
        }
    }
}
 
Example #8
Source File: CountTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testOps(String name, TestData.OfLong data) {
    AtomicLong expectedCount = new AtomicLong();
    data.stream().forEach(e -> expectedCount.incrementAndGet());

    withData(data).
            terminal(LongStream::count).
            expectedResult(expectedCount.get()).
            exercise();
}
 
Example #9
Source File: MatchOpTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongStream(String name, TestData.OfLong data) {
    for (LongPredicate p : LONG_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpFalse), longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpEven), longKinds.get(kind).apply(p));
        }
    }
}
 
Example #10
Source File: CountTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testOps(String name, TestData.OfLong data) {
    AtomicLong expectedCount = new AtomicLong();
    data.stream().forEach(e -> expectedCount.incrementAndGet());

    withData(data).
            terminal(LongStream::count).
            expectedResult(expectedCount.get()).
            exercise();
}
 
Example #11
Source File: MatchOpTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongStream(String name, TestData.OfLong data) {
    for (LongPredicate p : LONG_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpFalse), longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpEven), longKinds.get(kind).apply(p));
        }
    }
}
 
Example #12
Source File: CountTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testOps(String name, TestData.OfLong data) {
    AtomicLong expectedCount = new AtomicLong();
    data.stream().forEach(e -> expectedCount.incrementAndGet());

    withData(data).
            terminal(LongStream::count).
            expectedResult(expectedCount.get()).
            exercise();
}
 
Example #13
Source File: MatchOpTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongStream(String name, TestData.OfLong data) {
    for (LongPredicate p : LONG_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpFalse), longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpEven), longKinds.get(kind).apply(p));
        }
    }
}
 
Example #14
Source File: CountTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testOps(String name, TestData.OfLong data) {
    AtomicLong expectedCount = new AtomicLong();
    data.stream().forEach(e -> expectedCount.incrementAndGet());

    withData(data).
            terminal(LongStream::count).
            expectedResult(expectedCount.get()).
            exercise();
}
 
Example #15
Source File: MatchOpTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongStream(String name, TestData.OfLong data) {
    for (LongPredicate p : LONG_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpFalse), longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpEven), longKinds.get(kind).apply(p));
        }
    }
}
 
Example #16
Source File: CountTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testOps(String name, TestData.OfLong data) {
    AtomicLong expectedCount = new AtomicLong();
    data.stream().forEach(e -> expectedCount.incrementAndGet());

    withData(data).
            terminal(LongStream::count).
            expectedResult(expectedCount.get()).
            exercise();
}
 
Example #17
Source File: MatchOpTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongStream(String name, TestData.OfLong data) {
    for (LongPredicate p : LONG_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpFalse), longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpEven), longKinds.get(kind).apply(p));
        }
    }
}
 
Example #18
Source File: CountTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testOps(String name, TestData.OfLong data) {
    AtomicLong expectedCount = new AtomicLong();
    data.stream().forEach(e -> expectedCount.incrementAndGet());

    withData(data).
            terminal(LongStream::count).
            expectedResult(expectedCount.get()).
            exercise();
}
 
Example #19
Source File: MatchOpTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongStream(String name, TestData.OfLong data) {
    for (LongPredicate p : LONG_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpFalse), longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpEven), longKinds.get(kind).apply(p));
        }
    }
}
 
Example #20
Source File: CountTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testOps(String name, TestData.OfLong data) {
    AtomicLong expectedCount = new AtomicLong();
    data.stream().forEach(e -> expectedCount.incrementAndGet());

    withData(data).
            terminal(LongStream::count).
            expectedResult(expectedCount.get()).
            exercise();
}
 
Example #21
Source File: MatchOpTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongStream(String name, TestData.OfLong data) {
    for (LongPredicate p : LONG_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpFalse), longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpEven), longKinds.get(kind).apply(p));
        }
    }
}
 
Example #22
Source File: MatchOpTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongStream(String name, TestData.OfLong data) {
    for (LongPredicate p : LONG_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpFalse), longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpEven), longKinds.get(kind).apply(p));
        }
    }
}
 
Example #23
Source File: CountTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testOps(String name, TestData.OfLong data) {
    AtomicLong expectedCount = new AtomicLong();
    data.stream().forEach(e -> expectedCount.incrementAndGet());

    withData(data).
            terminal(LongStream::count).
            expectedResult(expectedCount.get()).
            exercise();
}
 
Example #24
Source File: CountTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testOps(String name, TestData.OfLong data) {
    AtomicLong expectedCount = new AtomicLong();
    data.stream().forEach(e -> expectedCount.incrementAndGet());

    withData(data).
            terminal(LongStream::count).
            expectedResult(expectedCount.get()).
            exercise();
}
 
Example #25
Source File: CountTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testOps(String name, TestData.OfLong data) {
    AtomicLong expectedCount = new AtomicLong();
    data.stream().forEach(e -> expectedCount.incrementAndGet());

    withData(data).
            terminal(LongStream::count).
            expectedResult(expectedCount.get()).
            exercise();
}
 
Example #26
Source File: MatchOpTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongStream(String name, TestData.OfLong data) {
    for (LongPredicate p : LONG_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpFalse), longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpEven), longKinds.get(kind).apply(p));
        }
    }
}
 
Example #27
Source File: MatchOpTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongStream(String name, TestData.OfLong data) {
    for (LongPredicate p : LONG_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpFalse), longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpEven), longKinds.get(kind).apply(p));
        }
    }
}
 
Example #28
Source File: StreamSpliteratorTest.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongParSpliterators(String name, TestData.OfLong data) {
    for (Function<LongStream, LongStream> f : longStreamFunctions()) {
        SpliteratorTestHelper.testLongSpliterator(() -> f.apply(data.parallelStream()).spliterator());
    }
}
 
Example #29
Source File: StreamSpliteratorTest.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongSpliterators(String name, TestData.OfLong data) {
    for (Function<LongStream, LongStream> f : longStreamFunctions()) {
        SpliteratorTestHelper.testLongSpliterator(() -> f.apply(data.stream()).spliterator());
    }
}
 
Example #30
Source File: StreamSpliteratorTest.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongParSpliterators(String name, TestData.OfLong data) {
    for (Function<LongStream, LongStream> f : longStreamFunctions()) {
        SpliteratorTestHelper.testLongSpliterator(() -> f.apply(data.parallelStream()).spliterator());
    }
}