Coverage Summary for Class: ListIteratorTester (com.google.common.collect.testing)

Class Class, % Method, % Line, %
ListIteratorTester 100% (1/1) 100% (2/2) 100% (6/6)


1 /* 2  * Copyright (C) 2007 The Guava Authors 3  * 4  * Licensed under the Apache License, Version 2.0 (the "License"); 5  * you may not use this file except in compliance with the License. 6  * You may obtain a copy of the License at 7  * 8  * http://www.apache.org/licenses/LICENSE-2.0 9  * 10  * Unless required by applicable law or agreed to in writing, software 11  * distributed under the License is distributed on an "AS IS" BASIS, 12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13  * See the License for the specific language governing permissions and 14  * limitations under the License. 15  */ 16  17 package com.google.common.collect.testing; 18  19 import com.google.common.annotations.GwtCompatible; 20 import java.util.ArrayList; 21 import java.util.List; 22 import java.util.ListIterator; 23  24 /** 25  * A utility similar to {@link IteratorTester} for testing a {@link ListIterator} against a known 26  * good reference implementation. As with {@code IteratorTester}, a concrete subclass must provide 27  * target iterators on demand. It also requires three additional constructor parameters: {@code 28  * elementsToInsert}, the elements to be passed to {@code set()} and {@code add()} calls; {@code 29  * features}, the features supported by the iterator; and {@code expectedElements}, the elements the 30  * iterator should return in order. 31  * 32  * <p>The items in {@code elementsToInsert} will be repeated if {@code steps} is larger than the 33  * number of provided elements. 34  * 35  * @author Chris Povirk 36  */ 37 @GwtCompatible 38 public abstract class ListIteratorTester<E> extends AbstractIteratorTester<E, ListIterator<E>> { 39  protected ListIteratorTester( 40  int steps, 41  Iterable<E> elementsToInsert, 42  Iterable<? extends IteratorFeature> features, 43  Iterable<E> expectedElements, 44  int startIndex) { 45  super(steps, elementsToInsert, features, expectedElements, KnownOrder.KNOWN_ORDER, startIndex); 46  } 47  48  @Override 49  protected final Iterable<? extends Stimulus<E, ? super ListIterator<E>>> getStimulusValues() { 50  List<Stimulus<E, ? super ListIterator<E>>> list = new ArrayList<>(); 51  Helpers.addAll(list, iteratorStimuli()); 52  Helpers.addAll(list, listIteratorStimuli()); 53  return list; 54  } 55  56  @Override 57  protected abstract ListIterator<E> newTargetIterator(); 58 }