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

项目:guava-mock    文件:ListListIteratorTester.java   
private void runListIteratorTest(Set<IteratorFeature> features) {
  new ListIteratorTester<E>(
      listListIteratorTesterNumIterations(),
      singleton(e4()),
      features,
      Helpers.copyToList(getOrderedElements()),
      0) {
    @Override
    protected ListIterator<E> newTargetIterator() {
      resetCollection();
      return getList().listIterator();
    }

    @Override
    protected void verify(List<E> elements) {
      expectContents(elements);
    }
  }.test();
}
项目:guava-mock    文件:LinkedListMultimapTest.java   
@GwtIncompatible // unreasonably slow
public void testValuesIteration() {
  List<Integer> addItems = ImmutableList.of(99, 88, 77);

  for (final int startIndex : new int[] {0, 3, 5}) {
    new ListIteratorTester<Integer>(3, addItems,
        ImmutableList.of(SUPPORTS_REMOVE, SUPPORTS_SET),
        Lists.newArrayList(2, 3, 4, 5, 6), startIndex) {
      private LinkedListMultimap<String, Integer> multimap;

      @Override protected ListIterator<Integer> newTargetIterator() {
        multimap = create();
        multimap.put("bar", 2);
        multimap.putAll("foo", Arrays.asList(3, 4));
        multimap.put("bar", 5);
        multimap.put("foo", 6);
        return multimap.values().listIterator(startIndex);
      }

      @Override protected void verify(List<Integer> elements) {
        assertEquals(elements, multimap.values());
      }
    }.test();
  }
}
项目:googles-monorepo-demo    文件:ListListIteratorTester.java   
private void runListIteratorTest(Set<IteratorFeature> features) {
  new ListIteratorTester<E>(
      listListIteratorTesterNumIterations(),
      singleton(e4()),
      features,
      Helpers.copyToList(getOrderedElements()),
      0) {
    @Override
    protected ListIterator<E> newTargetIterator() {
      resetCollection();
      return getList().listIterator();
    }

    @Override
    protected void verify(List<E> elements) {
      expectContents(elements);
    }
  }.test();
}
项目:googles-monorepo-demo    文件:LinkedListMultimapTest.java   
@GwtIncompatible // unreasonably slow
public void testValuesIteration() {
  List<Integer> addItems = ImmutableList.of(99, 88, 77);

  for (final int startIndex : new int[] {0, 3, 5}) {
    new ListIteratorTester<Integer>(3, addItems,
        ImmutableList.of(SUPPORTS_REMOVE, SUPPORTS_SET),
        Lists.newArrayList(2, 3, 4, 5, 6), startIndex) {
      private LinkedListMultimap<String, Integer> multimap;

      @Override protected ListIterator<Integer> newTargetIterator() {
        multimap = create();
        multimap.put("bar", 2);
        multimap.putAll("foo", Arrays.asList(3, 4));
        multimap.put("bar", 5);
        multimap.put("foo", 6);
        return multimap.values().listIterator(startIndex);
      }

      @Override protected void verify(List<Integer> elements) {
        assertEquals(elements, multimap.values());
      }
    }.test();
  }
}
项目:guava-libraries    文件:ListListIteratorTester.java   
private void runListIteratorTest(Set<IteratorFeature> features) {
  new ListIteratorTester<E>(
      listListIteratorTesterNumIterations(), singleton(e4()), features,
      Helpers.copyToList(getOrderedElements()), 0) {
    {
      // TODO: don't set this universally
      stopTestingWhenAddThrowsException();
    }

    @Override protected ListIterator<E> newTargetIterator() {
      resetCollection();
      return getList().listIterator();
    }

    @Override protected void verify(List<E> elements) {
      expectContents(elements);
    }
  }.test();
}
项目:guava-libraries    文件:ListListIteratorTester.java   
private void runListIteratorTest(Set<IteratorFeature> features) {
  new ListIteratorTester<E>(
      listListIteratorTesterNumIterations(), singleton(e4()), features,
      Helpers.copyToList(getOrderedElements()), 0) {
    {
      // TODO: don't set this universally
      stopTestingWhenAddThrowsException();
    }

    @Override protected ListIterator<E> newTargetIterator() {
      resetCollection();
      return getList().listIterator();
    }

    @Override protected void verify(List<E> elements) {
      expectContents(elements);
    }
  }.test();
}
项目:guava-libraries    文件:LinkedListMultimapTest.java   
@GwtIncompatible("unreasonably slow")
public void testValuesIteration() {
  List<Integer> addItems = ImmutableList.of(99, 88, 77);

  for (final int startIndex : new int[] {0, 3, 5}) {
    new ListIteratorTester<Integer>(3, addItems,
        ImmutableList.of(SUPPORTS_REMOVE, SUPPORTS_SET),
        Lists.newArrayList(2, 3, 4, 5, 6), startIndex) {
      private LinkedListMultimap<String, Integer> multimap;

      @Override protected ListIterator<Integer> newTargetIterator() {
        multimap = create();
        multimap.put("bar", 2);
        multimap.putAll("foo", Arrays.asList(3, 4));
        multimap.put("bar", 5);
        multimap.put("foo", 6);
        return multimap.values().listIterator(startIndex);
      }

      @Override protected void verify(List<Integer> elements) {
        assertEquals(elements, multimap.values());
      }
    }.test();
  }
}
项目:guava    文件:ListListIteratorTester.java   
private void runListIteratorTest(Set<IteratorFeature> features) {
  new ListIteratorTester<E>(
      listListIteratorTesterNumIterations(),
      singleton(e4()),
      features,
      Helpers.copyToList(getOrderedElements()),
      0) {
    @Override
    protected ListIterator<E> newTargetIterator() {
      resetCollection();
      return getList().listIterator();
    }

    @Override
    protected void verify(List<E> elements) {
      expectContents(elements);
    }
  }.test();
}
项目:guava    文件:ListListIteratorTester.java   
private void runListIteratorTest(Set<IteratorFeature> features) {
  new ListIteratorTester<E>(
      listListIteratorTesterNumIterations(),
      singleton(e4()),
      features,
      Helpers.copyToList(getOrderedElements()),
      0) {
    @Override
    protected ListIterator<E> newTargetIterator() {
      resetCollection();
      return getList().listIterator();
    }

    @Override
    protected void verify(List<E> elements) {
      expectContents(elements);
    }
  }.test();
}
项目:guava-mock    文件:LinkedListMultimapTest.java   
@SuppressWarnings("unchecked")
@GwtIncompatible // unreasonably slow
public void testEntriesIteration() {
  List<Entry<String, Integer>> addItems = ImmutableList.of(
      Maps.immutableEntry("foo", 99),
      Maps.immutableEntry("foo", 88),
      Maps.immutableEntry("bar", 77));

  for (final int startIndex : new int[] {0, 3, 5}) {
    List<Entry<String, Integer>> list = Lists.newArrayList(
        Maps.immutableEntry("foo", 2),
        Maps.immutableEntry("foo", 3),
        Maps.immutableEntry("bar", 4),
        Maps.immutableEntry("bar", 5),
        Maps.immutableEntry("foo", 6));
    new ListIteratorTester<Entry<String, Integer>>(3, addItems,
        ImmutableList.of(SUPPORTS_REMOVE), list, startIndex) {
      private LinkedListMultimap<String, Integer> multimap;

      @Override protected ListIterator<Entry<String, Integer>> newTargetIterator() {
        multimap = create();
        multimap.putAll("foo", asList(2, 3));
        multimap.putAll("bar", asList(4, 5));
        multimap.put("foo", 6);
        return multimap.entries().listIterator(startIndex);
      }

      @Override protected void verify(List<Entry<String, Integer>> elements) {
        assertEquals(elements, multimap.entries());
      }
    }.test();
  }
}
项目:googles-monorepo-demo    文件:LinkedListMultimapTest.java   
@SuppressWarnings("unchecked")
@GwtIncompatible // unreasonably slow
public void testEntriesIteration() {
  List<Entry<String, Integer>> addItems = ImmutableList.of(
      Maps.immutableEntry("foo", 99),
      Maps.immutableEntry("foo", 88),
      Maps.immutableEntry("bar", 77));

  for (final int startIndex : new int[] {0, 3, 5}) {
    List<Entry<String, Integer>> list = Lists.newArrayList(
        Maps.immutableEntry("foo", 2),
        Maps.immutableEntry("foo", 3),
        Maps.immutableEntry("bar", 4),
        Maps.immutableEntry("bar", 5),
        Maps.immutableEntry("foo", 6));
    new ListIteratorTester<Entry<String, Integer>>(3, addItems,
        ImmutableList.of(SUPPORTS_REMOVE), list, startIndex) {
      private LinkedListMultimap<String, Integer> multimap;

      @Override protected ListIterator<Entry<String, Integer>> newTargetIterator() {
        multimap = create();
        multimap.putAll("foo", asList(2, 3));
        multimap.putAll("bar", asList(4, 5));
        multimap.put("foo", 6);
        return multimap.entries().listIterator(startIndex);
      }

      @Override protected void verify(List<Entry<String, Integer>> elements) {
        assertEquals(elements, multimap.entries());
      }
    }.test();
  }
}
项目:guava-libraries    文件:LinkedListMultimapTest.java   
@SuppressWarnings("unchecked")
@GwtIncompatible("unreasonably slow")
public void testEntriesIteration() {
  List<Entry<String, Integer>> addItems = ImmutableList.of(
      Maps.immutableEntry("foo", 99),
      Maps.immutableEntry("foo", 88),
      Maps.immutableEntry("bar", 77));

  for (final int startIndex : new int[] {0, 3, 5}) {
    List<Entry<String, Integer>> list = Lists.newArrayList(
        Maps.immutableEntry("foo", 2),
        Maps.immutableEntry("foo", 3),
        Maps.immutableEntry("bar", 4),
        Maps.immutableEntry("bar", 5),
        Maps.immutableEntry("foo", 6));
    new ListIteratorTester<Entry<String, Integer>>(3, addItems,
        ImmutableList.of(SUPPORTS_REMOVE), list, startIndex) {
      private LinkedListMultimap<String, Integer> multimap;

      @Override protected ListIterator<Entry<String, Integer>> newTargetIterator() {
        multimap = create();
        multimap.putAll("foo", asList(2, 3));
        multimap.putAll("bar", asList(4, 5));
        multimap.put("foo", 6);
        return multimap.entries().listIterator(startIndex);
      }

      @Override protected void verify(List<Entry<String, Integer>> elements) {
        assertEquals(elements, multimap.entries());
      }
    }.test();
  }
}
项目:guava    文件:LinkedListMultimapTest.java   
@SuppressWarnings("unchecked")
@GwtIncompatible // unreasonably slow
public void testEntriesIteration() {
  List<Entry<String, Integer>> addItems =
      ImmutableList.of(
          Maps.immutableEntry("foo", 99),
          Maps.immutableEntry("foo", 88),
          Maps.immutableEntry("bar", 77));

  for (final int startIndex : new int[] {0, 3, 5}) {
    List<Entry<String, Integer>> list =
        Lists.newArrayList(
            Maps.immutableEntry("foo", 2),
            Maps.immutableEntry("foo", 3),
            Maps.immutableEntry("bar", 4),
            Maps.immutableEntry("bar", 5),
            Maps.immutableEntry("foo", 6));
    new ListIteratorTester<Entry<String, Integer>>(
        3, addItems, ImmutableList.of(SUPPORTS_REMOVE), list, startIndex) {
      private LinkedListMultimap<String, Integer> multimap;

      @Override
      protected ListIterator<Entry<String, Integer>> newTargetIterator() {
        multimap = create();
        multimap.putAll("foo", asList(2, 3));
        multimap.putAll("bar", asList(4, 5));
        multimap.put("foo", 6);
        return multimap.entries().listIterator(startIndex);
      }

      @Override
      protected void verify(List<Entry<String, Integer>> elements) {
        assertEquals(elements, multimap.entries());
      }
    }.test();
  }
}
项目:guava    文件:LinkedListMultimapTest.java   
@GwtIncompatible // unreasonably slow
public void testValuesIteration() {
  List<Integer> addItems = ImmutableList.of(99, 88, 77);

  for (final int startIndex : new int[] {0, 3, 5}) {
    new ListIteratorTester<Integer>(
        3,
        addItems,
        ImmutableList.of(SUPPORTS_REMOVE, SUPPORTS_SET),
        Lists.newArrayList(2, 3, 4, 5, 6),
        startIndex) {
      private LinkedListMultimap<String, Integer> multimap;

      @Override
      protected ListIterator<Integer> newTargetIterator() {
        multimap = create();
        multimap.put("bar", 2);
        multimap.putAll("foo", Arrays.asList(3, 4));
        multimap.put("bar", 5);
        multimap.put("foo", 6);
        return multimap.values().listIterator(startIndex);
      }

      @Override
      protected void verify(List<Integer> elements) {
        assertEquals(elements, multimap.values());
      }
    }.test();
  }
}
项目:guava    文件:LinkedListMultimapTest.java   
@SuppressWarnings("unchecked")
@GwtIncompatible // unreasonably slow
public void testEntriesIteration() {
  List<Entry<String, Integer>> addItems =
      ImmutableList.of(
          Maps.immutableEntry("foo", 99),
          Maps.immutableEntry("foo", 88),
          Maps.immutableEntry("bar", 77));

  for (final int startIndex : new int[] {0, 3, 5}) {
    List<Entry<String, Integer>> list =
        Lists.newArrayList(
            Maps.immutableEntry("foo", 2),
            Maps.immutableEntry("foo", 3),
            Maps.immutableEntry("bar", 4),
            Maps.immutableEntry("bar", 5),
            Maps.immutableEntry("foo", 6));
    new ListIteratorTester<Entry<String, Integer>>(
        3, addItems, ImmutableList.of(SUPPORTS_REMOVE), list, startIndex) {
      private LinkedListMultimap<String, Integer> multimap;

      @Override
      protected ListIterator<Entry<String, Integer>> newTargetIterator() {
        multimap = create();
        multimap.putAll("foo", asList(2, 3));
        multimap.putAll("bar", asList(4, 5));
        multimap.put("foo", 6);
        return multimap.entries().listIterator(startIndex);
      }

      @Override
      protected void verify(List<Entry<String, Integer>> elements) {
        assertEquals(elements, multimap.entries());
      }
    }.test();
  }
}
项目:guava    文件:LinkedListMultimapTest.java   
@GwtIncompatible // unreasonably slow
public void testValuesIteration() {
  List<Integer> addItems = ImmutableList.of(99, 88, 77);

  for (final int startIndex : new int[] {0, 3, 5}) {
    new ListIteratorTester<Integer>(
        3,
        addItems,
        ImmutableList.of(SUPPORTS_REMOVE, SUPPORTS_SET),
        Lists.newArrayList(2, 3, 4, 5, 6),
        startIndex) {
      private LinkedListMultimap<String, Integer> multimap;

      @Override
      protected ListIterator<Integer> newTargetIterator() {
        multimap = create();
        multimap.put("bar", 2);
        multimap.putAll("foo", Arrays.asList(3, 4));
        multimap.put("bar", 5);
        multimap.put("foo", 6);
        return multimap.values().listIterator(startIndex);
      }

      @Override
      protected void verify(List<Integer> elements) {
        assertEquals(elements, multimap.values());
      }
    }.test();
  }
}