com.google.common.collect.testing.MapTestSuiteBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of guava-testlib-jdk5 Show documentation
Show all versions of guava-testlib-jdk5 Show documentation
Guava testlib is a set of java classes used for more convenient
unit testing - particularly to assist the tests for Guava itself.
/*
* Copyright (C) 2008 The Guava Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.common.collect.testing;
import static com.google.common.collect.testing.DerivedCollectionGenerators.keySetGenerator;
import com.google.common.collect.testing.DerivedCollectionGenerators.MapEntrySetGenerator;
import com.google.common.collect.testing.DerivedCollectionGenerators.MapValueCollectionGenerator;
import com.google.common.collect.testing.features.CollectionFeature;
import com.google.common.collect.testing.features.CollectionSize;
import com.google.common.collect.testing.features.Feature;
import com.google.common.collect.testing.features.MapFeature;
import com.google.common.collect.testing.testers.MapClearTester;
import com.google.common.collect.testing.testers.MapContainsKeyTester;
import com.google.common.collect.testing.testers.MapContainsValueTester;
import com.google.common.collect.testing.testers.MapCreationTester;
import com.google.common.collect.testing.testers.MapEntrySetTester;
import com.google.common.collect.testing.testers.MapEqualsTester;
import com.google.common.collect.testing.testers.MapGetTester;
import com.google.common.collect.testing.testers.MapHashCodeTester;
import com.google.common.collect.testing.testers.MapIsEmptyTester;
import com.google.common.collect.testing.testers.MapPutAllTester;
import com.google.common.collect.testing.testers.MapPutTester;
import com.google.common.collect.testing.testers.MapRemoveTester;
import com.google.common.collect.testing.testers.MapSerializationTester;
import com.google.common.collect.testing.testers.MapSizeTester;
import com.google.common.collect.testing.testers.MapToStringTester;
import com.google.common.testing.SerializableTester;
import junit.framework.TestSuite;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Creates, based on your criteria, a JUnit test suite that exhaustively tests
* a Map implementation.
*
* @author George van den Driessche
*/
public class MapTestSuiteBuilder
extends PerCollectionSizeTestSuiteBuilder<
MapTestSuiteBuilder,
TestMapGenerator, Map, Map.Entry> {
public static MapTestSuiteBuilder using(
TestMapGenerator generator) {
return new MapTestSuiteBuilder().usingGenerator(generator);
}
@SuppressWarnings("unchecked") // Class parameters must be raw.
@Override protected List> getTesters() {
return Arrays.>asList(
MapClearTester.class,
MapContainsKeyTester.class,
MapContainsValueTester.class,
MapCreationTester.class,
MapEntrySetTester.class,
MapEqualsTester.class,
MapGetTester.class,
MapHashCodeTester.class,
MapIsEmptyTester.class,
MapPutTester.class,
MapPutAllTester.class,
MapRemoveTester.class,
MapSerializationTester.class,
MapSizeTester.class,
MapToStringTester.class
);
}
@Override
protected List createDerivedSuites(
FeatureSpecificTestSuiteBuilder<
?,
? extends OneSizeTestContainerGenerator
© 2015 - 2024 Weber Informatics LLC | Privacy Policy