Java 类com.google.common.collect.testing.SpliteratorTester 实例源码

项目:guava-mock    文件:CollectSpliteratorsTest.java   
public void testMap() {
  SpliteratorTester.of(
          ()
              -> CollectSpliterators.map(
                  Arrays.spliterator(new String[] {"a", "b", "c", "d", "e"}), Ascii::toUpperCase))
      .expect("A", "B", "C", "D", "E");
}
项目:guava-mock    文件:CollectSpliteratorsTest.java   
public void testFlatMap() {
  SpliteratorTester.of(
          ()
              -> CollectSpliterators.flatMap(
                  Arrays.spliterator(new String[] {"abc", "", "de", "f", "g", ""}),
                  (String str) -> Lists.charactersOf(str).spliterator(),
                  Spliterator.SIZED | Spliterator.DISTINCT | Spliterator.NONNULL,
                  7))
      .expect('a', 'b', 'c', 'd', 'e', 'f', 'g');
}
项目:guava-mock    文件:StreamsTest.java   
public void testConcat_refStream() {
  assertThat(Streams.concat(Stream.of("a"), Stream.of("b"), Stream.empty(), Stream.of("c", "d")))
      .containsExactly("a", "b", "c", "d")
      .inOrder();
  SpliteratorTester.of(
          () ->
              Streams.concat(Stream.of("a"), Stream.of("b"), Stream.empty(), Stream.of("c", "d"))
                  .spliterator())
      .expect("a", "b", "c", "d");
}
项目:guava-mock    文件:StreamsTest.java   
private void testMapWithIndex(Function<Collection<String>, Stream<String>> collectionImpl) {
  SpliteratorTester.of(
          () ->
              Streams.mapWithIndex(
                      collectionImpl.apply(ImmutableList.of()), (str, i) -> str + ":" + i)
                  .spliterator())
      .expect(ImmutableList.of());
  SpliteratorTester.of(
          () ->
              Streams.mapWithIndex(
                      collectionImpl.apply(ImmutableList.of("a", "b", "c", "d", "e")),
                      (str, i) -> str + ":" + i)
                  .spliterator())
      .expect("a:0", "b:1", "c:2", "d:3", "e:4");
}
项目:googles-monorepo-demo    文件:CollectSpliteratorsTest.java   
public void testMap() {
  SpliteratorTester.of(
          ()
              -> CollectSpliterators.map(
                  Arrays.spliterator(new String[] {"a", "b", "c", "d", "e"}), Ascii::toUpperCase))
      .expect("A", "B", "C", "D", "E");
}
项目:googles-monorepo-demo    文件:CollectSpliteratorsTest.java   
public void testFlatMap() {
  SpliteratorTester.of(
          ()
              -> CollectSpliterators.flatMap(
                  Arrays.spliterator(new String[] {"abc", "", "de", "f", "g", ""}),
                  (String str) -> Lists.charactersOf(str).spliterator(),
                  Spliterator.SIZED | Spliterator.DISTINCT | Spliterator.NONNULL,
                  7))
      .expect('a', 'b', 'c', 'd', 'e', 'f', 'g');
}
项目:googles-monorepo-demo    文件:StreamsTest.java   
private void testMapWithIndex(Function<Collection<String>, Stream<String>> collectionImpl) {
  SpliteratorTester.of(
          () ->
              Streams.mapWithIndex(
                      collectionImpl.apply(ImmutableList.of()), (str, i) -> str + ":" + i)
                  .spliterator())
      .expect(ImmutableList.of());
  SpliteratorTester.of(
          () ->
              Streams.mapWithIndex(
                      collectionImpl.apply(ImmutableList.of("a", "b", "c", "d", "e")),
                      (str, i) -> str + ":" + i)
                  .spliterator())
      .expect("a:0", "b:1", "c:2", "d:3", "e:4");
}
项目:guava    文件:CollectSpliteratorsTest.java   
public void testMap() {
  SpliteratorTester.of(
          () ->
              CollectSpliterators.map(
                  Arrays.spliterator(new String[] {"a", "b", "c", "d", "e"}), Ascii::toUpperCase))
      .expect("A", "B", "C", "D", "E");
}
项目:guava    文件:CollectSpliteratorsTest.java   
public void testFlatMap() {
  SpliteratorTester.of(
          () ->
              CollectSpliterators.flatMap(
                  Arrays.spliterator(new String[] {"abc", "", "de", "f", "g", ""}),
                  (String str) -> Lists.charactersOf(str).spliterator(),
                  Spliterator.SIZED | Spliterator.DISTINCT | Spliterator.NONNULL,
                  7))
      .expect('a', 'b', 'c', 'd', 'e', 'f', 'g');
}
项目:guava    文件:StreamsTest.java   
public void testConcat_refStream() {
  assertThat(Streams.concat(Stream.of("a"), Stream.of("b"), Stream.empty(), Stream.of("c", "d")))
      .containsExactly("a", "b", "c", "d")
      .inOrder();
  SpliteratorTester.of(
          () ->
              Streams.concat(Stream.of("a"), Stream.of("b"), Stream.empty(), Stream.of("c", "d"))
                  .spliterator())
      .expect("a", "b", "c", "d");
}
项目:guava    文件:StreamsTest.java   
private void testMapWithIndex(Function<Collection<String>, Stream<String>> collectionImpl) {
  SpliteratorTester.of(
          () ->
              Streams.mapWithIndex(
                      collectionImpl.apply(ImmutableList.of()), (str, i) -> str + ":" + i)
                  .spliterator())
      .expect(ImmutableList.of());
  SpliteratorTester.of(
          () ->
              Streams.mapWithIndex(
                      collectionImpl.apply(ImmutableList.of("a", "b", "c", "d", "e")),
                      (str, i) -> str + ":" + i)
                  .spliterator())
      .expect("a:0", "b:1", "c:2", "d:3", "e:4");
}
项目:guava    文件:StreamsTest.java   
@GwtIncompatible // TODO(b/38490623): reenable after GWT double-to-string conversion is fixed
public void testMapWithIndex_doubleStream() {
  SpliteratorTester.of(
          () ->
              Streams.mapWithIndex(DoubleStream.of(0, 1, 2), (x, i) -> x + ":" + i).spliterator())
      .expect("0.0:0", "1.0:1", "2.0:2");
}
项目:guava-mock    文件:CollectionSpliteratorTester.java   
@CollectionFeature.Require(absent = KNOWN_ORDER)
public void testSpliteratorUnknownOrder() {
  synchronized (collection) {
    SpliteratorTester.of(collection::spliterator).expect(getSampleElements());
  }
}
项目:guava-mock    文件:CollectionSpliteratorTester.java   
@CollectionFeature.Require(KNOWN_ORDER)
public void testSpliteratorKnownOrder() {
  synchronized (collection) {
    SpliteratorTester.of(collection::spliterator).expect(getOrderedElements()).inOrder();
  }
}
项目:guava-mock    文件:StreamsTest.java   
public void testMapWithIndex_intStream() {
  SpliteratorTester.of(
          () -> Streams.mapWithIndex(IntStream.of(0, 1, 2), (x, i) -> x + ":" + i).spliterator())
      .expect("0:0", "1:1", "2:2");
}
项目:guava-mock    文件:StreamsTest.java   
public void testMapWithIndex_longStream() {
  SpliteratorTester.of(
          () -> Streams.mapWithIndex(LongStream.of(0, 1, 2), (x, i) -> x + ":" + i).spliterator())
      .expect("0:0", "1:1", "2:2");
}
项目:guava-mock    文件:StreamsTest.java   
public void testMapWithIndex_doubleStream() {
  SpliteratorTester.of(
          () ->
              Streams.mapWithIndex(DoubleStream.of(0, 1, 2), (x, i) -> x + ":" + i).spliterator())
      .expect("0.0:0", "1.0:1", "2.0:2");
}
项目:googles-monorepo-demo    文件:CollectionSpliteratorTester.java   
@CollectionFeature.Require(absent = KNOWN_ORDER)
public void testSpliteratorUnknownOrder() {
  synchronized (collection) {
    SpliteratorTester.of(collection::spliterator).expect(getSampleElements());
  }
}
项目:googles-monorepo-demo    文件:CollectionSpliteratorTester.java   
@CollectionFeature.Require(KNOWN_ORDER)
public void testSpliteratorKnownOrder() {
  synchronized (collection) {
    SpliteratorTester.of(collection::spliterator).expect(getOrderedElements()).inOrder();
  }
}
项目:googles-monorepo-demo    文件:StreamsTest.java   
public void testMapWithIndex_intStream() {
  SpliteratorTester.of(
          () -> Streams.mapWithIndex(IntStream.of(0, 1, 2), (x, i) -> x + ":" + i).spliterator())
      .expect("0:0", "1:1", "2:2");
}
项目:googles-monorepo-demo    文件:StreamsTest.java   
public void testMapWithIndex_longStream() {
  SpliteratorTester.of(
          () -> Streams.mapWithIndex(LongStream.of(0, 1, 2), (x, i) -> x + ":" + i).spliterator())
      .expect("0:0", "1:1", "2:2");
}
项目:googles-monorepo-demo    文件:StreamsTest.java   
public void testMapWithIndex_doubleStream() {
  SpliteratorTester.of(
          () ->
              Streams.mapWithIndex(DoubleStream.of(0, 1, 2), (x, i) -> x + ":" + i).spliterator())
      .expect("0.0:0", "1.0:1", "2.0:2");
}
项目:guava    文件:CollectionSpliteratorTester.java   
@CollectionFeature.Require(absent = KNOWN_ORDER)
public void testSpliteratorUnknownOrder() {
  synchronized (collection) {
    SpliteratorTester.of(collection::spliterator).expect(getSampleElements());
  }
}
项目:guava    文件:CollectionSpliteratorTester.java   
@CollectionFeature.Require(KNOWN_ORDER)
public void testSpliteratorKnownOrder() {
  synchronized (collection) {
    SpliteratorTester.of(collection::spliterator).expect(getOrderedElements()).inOrder();
  }
}
项目:guava    文件:StreamsTest.java   
public void testMapWithIndex_intStream() {
  SpliteratorTester.of(
          () -> Streams.mapWithIndex(IntStream.of(0, 1, 2), (x, i) -> x + ":" + i).spliterator())
      .expect("0:0", "1:1", "2:2");
}
项目:guava    文件:StreamsTest.java   
public void testMapWithIndex_longStream() {
  SpliteratorTester.of(
          () -> Streams.mapWithIndex(LongStream.of(0, 1, 2), (x, i) -> x + ":" + i).spliterator())
      .expect("0:0", "1:1", "2:2");
}