001/* 002 * Copyright (C) 2015 The Guava Authors 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 005 * in compliance with the License. You may obtain a copy of the License at 006 * 007 * http://www.apache.org/licenses/LICENSE-2.0 008 * 009 * Unless required by applicable law or agreed to in writing, software distributed under the License 010 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 011 * or implied. See the License for the specific language governing permissions and limitations under 012 * the License. 013 */ 014 015package com.google.common.collect.testing; 016 017import com.google.common.annotations.GwtIncompatible; 018import com.google.common.collect.testing.testers.ConcurrentMapPutIfAbsentTester; 019import com.google.common.collect.testing.testers.ConcurrentMapRemoveTester; 020import com.google.common.collect.testing.testers.ConcurrentMapReplaceEntryTester; 021import com.google.common.collect.testing.testers.ConcurrentMapReplaceTester; 022import java.util.Arrays; 023import java.util.List; 024 025/** 026 * Creates, based on your criteria, a JUnit test suite that exhaustively tests a ConcurrentMap 027 * implementation. 028 * 029 * @author Louis Wasserman 030 */ 031@GwtIncompatible 032public class ConcurrentMapTestSuiteBuilder<K, V> extends MapTestSuiteBuilder<K, V> { 033 public static <K, V> ConcurrentMapTestSuiteBuilder<K, V> using(TestMapGenerator<K, V> generator) { 034 ConcurrentMapTestSuiteBuilder<K, V> result = new ConcurrentMapTestSuiteBuilder<>(); 035 result.usingGenerator(generator); 036 return result; 037 } 038 039 static final List<? extends Class<? extends AbstractTester>> TESTERS = 040 Arrays.asList( 041 ConcurrentMapPutIfAbsentTester.class, 042 ConcurrentMapRemoveTester.class, 043 ConcurrentMapReplaceTester.class, 044 ConcurrentMapReplaceEntryTester.class); 045 046 @Override 047 protected List<Class<? extends AbstractTester>> getTesters() { 048 List<Class<? extends AbstractTester>> testers = Helpers.copyToList(super.getTesters()); 049 testers.addAll(TESTERS); 050 return testers; 051 } 052}