Debian Codegraph @

guava-testlib/src/com/google/common/collect/testing/ConcurrentMapTestSuiteBuilder.java

raw
1 /*
2 * Copyright (C) 2015 The Guava Authors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 * in compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software distributed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 * or implied. See the License for the specific language governing permissions and limitations under
12 * the License.
13 */
14
15 package com.google.common.collect.testing;
16
17 import com.google.common.annotations.GwtIncompatible;
18 import com.google.common.collect.testing.testers.ConcurrentMapPutIfAbsentTester;
19 import com.google.common.collect.testing.testers.ConcurrentMapRemoveTester;
20 import com.google.common.collect.testing.testers.ConcurrentMapReplaceEntryTester;
21 import com.google.common.collect.testing.testers.ConcurrentMapReplaceTester;
22 import java.util.Arrays;
23 import java.util.List;
24
25 /**
26 * Creates, based on your criteria, a JUnit test suite that exhaustively tests a ConcurrentMap
27 * implementation.
28 *
29 * @author Louis Wasserman
30 */
31 @GwtIncompatible
32 public class ConcurrentMapTestSuiteBuilder<K, V> extends MapTestSuiteBuilder<K, V> {
33 public static <K, V> ConcurrentMapTestSuiteBuilder<K, V> using(TestMapGenerator<K, V> generator) {
34 ConcurrentMapTestSuiteBuilder<K, V> result = new ConcurrentMapTestSuiteBuilder<>();
35 result.usingGenerator(generator);
36 return result;
37 }
38
39 static final List<? extends Class<? extends AbstractTester>> TESTERS =
40 Arrays.asList(
41 ConcurrentMapPutIfAbsentTester.class,
42 ConcurrentMapRemoveTester.class,
43 ConcurrentMapReplaceTester.class,
44 ConcurrentMapReplaceEntryTester.class);
45
46 @Override
47 protected List<Class<? extends AbstractTester>> getTesters() {
48 List<Class<? extends AbstractTester>> testers = Helpers.copyToList(super.getTesters());
49 testers.addAll(TESTERS);
50 return testers;
51 }
52 }