1 /* 2 * Copyright (C) 2008 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 junit.framework.TestSuite; 20 21 import java.util.List; 22 23 /** 24 * Given a test iterable generator, builds a test suite for the 25 * iterable's iterator, by delegating to a {@link IteratorTestSuiteBuilder}. 26 * 27 * @author George van den Driessche 28 */ 29 public class DerivedIteratorTestSuiteBuilder<E> 30 extends FeatureSpecificTestSuiteBuilder< 31 DerivedIteratorTestSuiteBuilder<E>, 32 TestSubjectGenerator<? extends Iterable<E>>> { 33 /** 34 * We rely entirely on the delegate builder for test creation, so this 35 * just throws UnsupportedOperationException. 36 * 37 * @return never. 38 */ getTesters()39 @Override protected List<Class<? extends AbstractTester>> getTesters() { 40 throw new UnsupportedOperationException(); 41 } 42 createTestSuite()43 @Override public TestSuite createTestSuite() { 44 checkCanCreate(); 45 return new IteratorTestSuiteBuilder<E>() 46 .named(getName() + " iterator") 47 .usingGenerator(new DerivedTestIteratorGenerator<E>( 48 getSubjectGenerator())) 49 .withFeatures(getFeatures()) 50 .createTestSuite(); 51 } 52 } 53