• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 com.google.common.collect.testing.testers.SetAddAllTester;
20 import com.google.common.collect.testing.testers.SetAddTester;
21 import com.google.common.collect.testing.testers.SetCreationTester;
22 import com.google.common.collect.testing.testers.SetEqualsTester;
23 import com.google.common.collect.testing.testers.SetHashCodeTester;
24 import com.google.common.collect.testing.testers.SetRemoveTester;
25 
26 import java.util.List;
27 
28 /**
29  * Creates, based on your criteria, a JUnit test suite that exhaustively tests
30  * a Set implementation.
31  *
32  * @author George van den Driessche
33  */
34 public class SetTestSuiteBuilder<E>
35     extends AbstractCollectionTestSuiteBuilder<SetTestSuiteBuilder<E>, E> {
using( TestSetGenerator<E> generator)36   public static <E> SetTestSuiteBuilder<E> using(
37       TestSetGenerator<E> generator) {
38     return new SetTestSuiteBuilder<E>().usingGenerator(generator);
39   }
40 
getTesters()41   @Override protected List<Class<? extends AbstractTester>> getTesters() {
42     List<Class<? extends AbstractTester>> testers
43         = Helpers.copyToList(super.getTesters());
44 
45     testers.add(SetAddAllTester.class);
46     testers.add(SetAddTester.class);
47     testers.add(SetCreationTester.class);
48     testers.add(SetHashCodeTester.class);
49     testers.add(SetEqualsTester.class);
50     testers.add(SetRemoveTester.class);
51     // SetRemoveAllTester doesn't exist because, Sets not permitting
52     // duplicate elements, there are no tests for Set.removeAll() that aren't
53     // covered by CollectionRemoveAllTester.
54     return testers;
55   }
56 }
57