public static TestSuite suite() { TestSuite suite = new TestSuite(SynchronizedBiMapTest.class); suite.addTest( BiMapTestSuiteBuilder.using(new SynchTestingBiMapGenerator()) .named("Synchronized.biMap[TestBiMap]") .withFeatures( CollectionSize.ANY, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, MapFeature.ALLOWS_NULL_KEYS, MapFeature.ALLOWS_NULL_VALUES, MapFeature.ALLOWS_ANY_NULL_QUERIES, MapFeature.GENERAL_PURPOSE, MapFeature.REJECTS_DUPLICATES_AT_CREATION) .createTestSuite()); suite.addTest( BiMapTestSuiteBuilder.using(new SynchronizedHashBiMapGenerator()) .named("synchronizedBiMap[HashBiMap]") .withFeatures( CollectionSize.ANY, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, MapFeature.ALLOWS_NULL_KEYS, MapFeature.ALLOWS_NULL_VALUES, MapFeature.ALLOWS_ANY_NULL_QUERIES, MapFeature.GENERAL_PURPOSE, MapFeature.REJECTS_DUPLICATES_AT_CREATION, CollectionFeature.SERIALIZABLE) .suppressing(BiMapInverseTester.getInverseSameAfterSerializingMethods()) .createTestSuite()); return suite; }
public static <K, V> BiMapTestSuiteBuilder<K, V> using(TestBiMapGenerator<K, V> generator) { return new BiMapTestSuiteBuilder<K, V>().usingGenerator(generator); }
private static Set<Feature<?>> computeValuesSetFeatures(Set<Feature<?>> mapFeatures) { Set<Feature<?>> valuesCollectionFeatures = computeCommonDerivedCollectionFeatures(mapFeatures); valuesCollectionFeatures.add(CollectionFeature.ALLOWS_NULL_QUERIES); if (mapFeatures.contains(MapFeature.ALLOWS_NULL_VALUES)) { valuesCollectionFeatures.add(CollectionFeature.ALLOWS_NULL_VALUES); } valuesCollectionFeatures.add(CollectionFeature.REJECTS_DUPLICATES_AT_CREATION); return valuesCollectionFeatures; }
SetTestSuiteBuilder.using( new BiMapValueSetGenerator<K, V>(parentBuilder.getSubjectGenerator())) .withFeatures(computeValuesSetFeatures(parentBuilder.getFeatures())) .named(parentBuilder.getName() + " values [Set]") .suppressing(parentBuilder.getSuppressedTests()) if (!parentBuilder.getFeatures().contains(NoRecurse.INVERSE)) { derived.add( BiMapTestSuiteBuilder.using( new InverseBiMapGenerator<K, V>(parentBuilder.getSubjectGenerator())) .withFeatures(computeInverseFeatures(parentBuilder.getFeatures())) .named(parentBuilder.getName() + " inverse") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite());
.withFeatures(computeValuesSetFeatures(parentBuilder.getFeatures())) .named(parentBuilder.getName() + " values [Set]") .suppressing(parentBuilder.getSuppressedTests()) .suppressing(SetCreationTester.class.getMethods()) .createTestSuite()); if (!parentBuilder.getFeatures().contains(NoRecurse.INVERSE)) { derived.add(BiMapTestSuiteBuilder .using(new InverseBiMapGenerator<K, V>(parentBuilder.getSubjectGenerator())) .withFeatures(computeInverseFeatures(parentBuilder.getFeatures())) .named(parentBuilder.getName() + " inverse") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite());
static TestSuite filterBiMapSuite() { TestSuite suite = new TestSuite("FilterBiMap"); suite.addTest( BiMapTestSuiteBuilder.using( new TestStringBiMapGenerator() { @Override .named("Maps.filterKeys[BiMap, Predicate]") .withFeatures( MapFeature.ALLOWS_NULL_KEYS, MapFeature.ALLOWS_NULL_VALUES, MapFeature.GENERAL_PURPOSE, CollectionSize.ANY) .createTestSuite()); suite.addTest( BiMapTestSuiteBuilder.using( new TestStringBiMapGenerator() { @Override .named("Maps.filterValues[BiMap, Predicate]") .withFeatures( MapFeature.ALLOWS_NULL_KEYS, MapFeature.ALLOWS_NULL_VALUES, MapFeature.GENERAL_PURPOSE, CollectionSize.ANY) .createTestSuite()); suite.addTest( BiMapTestSuiteBuilder.using( new TestStringBiMapGenerator() {
SetTestSuiteBuilder.using( new BiMapValueSetGenerator<K, V>(parentBuilder.getSubjectGenerator())) .withFeatures(computeValuesSetFeatures(parentBuilder.getFeatures())) .named(parentBuilder.getName() + " values [Set]") .suppressing(parentBuilder.getSuppressedTests()) if (!parentBuilder.getFeatures().contains(NoRecurse.INVERSE)) { derived.add( BiMapTestSuiteBuilder.using( new InverseBiMapGenerator<K, V>(parentBuilder.getSubjectGenerator())) .withFeatures(computeInverseFeatures(parentBuilder.getFeatures())) .named(parentBuilder.getName() + " inverse") .suppressing(parentBuilder.getSuppressedTests()) .createTestSuite());
public static <K, V> BiMapTestSuiteBuilder<K, V> using(TestBiMapGenerator<K, V> generator) { return new BiMapTestSuiteBuilder<K, V>().usingGenerator(generator); }
private static Set<Feature<?>> computeValuesSetFeatures(Set<Feature<?>> mapFeatures) { Set<Feature<?>> valuesCollectionFeatures = computeCommonDerivedCollectionFeatures(mapFeatures); valuesCollectionFeatures.add(CollectionFeature.ALLOWS_NULL_QUERIES); if (mapFeatures.contains(MapFeature.ALLOWS_NULL_VALUES)) { valuesCollectionFeatures.add(CollectionFeature.ALLOWS_NULL_VALUES); } valuesCollectionFeatures.add(CollectionFeature.REJECTS_DUPLICATES_AT_CREATION); return valuesCollectionFeatures; }
@GwtIncompatible // suite public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest( BiMapTestSuiteBuilder.using(new EnumBiMapGenerator()) .named("EnumBiMap") .withFeatures( CollectionSize.ANY, CollectionFeature.SERIALIZABLE, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, MapFeature.GENERAL_PURPOSE, CollectionFeature.KNOWN_ORDER) .createTestSuite()); suite.addTestSuite(EnumBiMapTest.class); return suite; }
public static <K, V> BiMapTestSuiteBuilder<K, V> using(TestBiMapGenerator<K, V> generator) { return new BiMapTestSuiteBuilder<K, V>().usingGenerator(generator); }
private static Set<Feature<?>> computeValuesSetFeatures( Set<Feature<?>> mapFeatures) { Set<Feature<?>> valuesCollectionFeatures = computeCommonDerivedCollectionFeatures(mapFeatures); valuesCollectionFeatures.add(CollectionFeature.ALLOWS_NULL_QUERIES); if (mapFeatures.contains(MapFeature.ALLOWS_NULL_VALUES)) { valuesCollectionFeatures.add(CollectionFeature.ALLOWS_NULL_VALUES); } valuesCollectionFeatures.add(CollectionFeature.REJECTS_DUPLICATES_AT_CREATION); return valuesCollectionFeatures; }
@GwtIncompatible // suite public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest( BiMapTestSuiteBuilder.using(new EnumHashBiMapGenerator()) .named("EnumHashBiMap") .withFeatures( CollectionSize.ANY, CollectionFeature.SERIALIZABLE, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, MapFeature.ALLOWS_NULL_VALUES, MapFeature.GENERAL_PURPOSE, CollectionFeature.KNOWN_ORDER) .createTestSuite()); suite.addTestSuite(EnumHashBiMapTest.class); return suite; }
@GwtIncompatible // suite public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest( BiMapTestSuiteBuilder.using(new HashBiMapGenerator()) .named("HashBiMap") .withFeatures( CollectionSize.ANY, CollectionFeature.SERIALIZABLE, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, CollectionFeature.KNOWN_ORDER, MapFeature.ALLOWS_NULL_KEYS, MapFeature.ALLOWS_NULL_VALUES, MapFeature.ALLOWS_ANY_NULL_QUERIES, MapFeature.GENERAL_PURPOSE) .createTestSuite()); suite.addTestSuite(HashBiMapTest.class); return suite; }
BiMapTestSuiteBuilder.using(new ImmutableBiMapGenerator()) .named("ImmutableBiMap") .withFeatures( CollectionSize.ANY, CollectionFeature.SERIALIZABLE, MapFeature.REJECTS_DUPLICATES_AT_CREATION, MapFeature.ALLOWS_ANY_NULL_QUERIES) .suppressing(BiMapInverseTester.getInverseSameAfterSerializingMethods()) .createTestSuite()); suite.addTest( BiMapTestSuiteBuilder.using( new TestStringBiMapGenerator() { @Override .named("ImmutableBiMap [JDK backed]") .withFeatures( CollectionSize.ANY, CollectionFeature.SERIALIZABLE, MapFeature.REJECTS_DUPLICATES_AT_CREATION, MapFeature.ALLOWS_ANY_NULL_QUERIES) .suppressing(BiMapInverseTester.getInverseSameAfterSerializingMethods()) .createTestSuite()); suite.addTest( BiMapTestSuiteBuilder.using(new ImmutableBiMapCopyOfGenerator()) .named("ImmutableBiMap.copyOf[Map]") .withFeatures( CollectionSize.ANY,
.createTestSuite()); suite.addTest( BiMapTestSuiteBuilder.using( new TestStringBiMapGenerator() { @Override .named("unmodifiableBiMap[HashBiMap]") .withFeatures( CollectionSize.ANY, MapFeature.ALLOWS_NULL_VALUES, MapFeature.REJECTS_DUPLICATES_AT_CREATION, CollectionFeature.SERIALIZABLE) .createTestSuite()); suite.addTest( MapTestSuiteBuilder.using(
@GwtIncompatible // suite public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(BiMapTestSuiteBuilder.using(new EnumBiMapGenerator()) .named("EnumBiMap") .withFeatures(CollectionSize.ANY, CollectionFeature.SERIALIZABLE, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, MapFeature.GENERAL_PURPOSE, CollectionFeature.KNOWN_ORDER) .createTestSuite()); suite.addTestSuite(EnumBiMapTest.class); return suite; }
static TestSuite filterBiMapSuite() { TestSuite suite = new TestSuite("FilterBiMap"); suite.addTest(BiMapTestSuiteBuilder.using(new TestStringBiMapGenerator() { @Override protected BiMap<String, String> create(Entry<String, String>[] entries) { .named("Maps.filterKeys[BiMap, Predicate]") .withFeatures( MapFeature.ALLOWS_NULL_KEYS, MapFeature.ALLOWS_NULL_VALUES, MapFeature.GENERAL_PURPOSE, CollectionSize.ANY) .createTestSuite()); suite.addTest(BiMapTestSuiteBuilder.using(new TestStringBiMapGenerator() { @Override protected BiMap<String, String> create(Entry<String, String>[] entries) { .named("Maps.filterValues[BiMap, Predicate]") .withFeatures( MapFeature.ALLOWS_NULL_KEYS, MapFeature.ALLOWS_NULL_VALUES, MapFeature.GENERAL_PURPOSE, CollectionSize.ANY) .createTestSuite()); suite.addTest(BiMapTestSuiteBuilder.using(new TestStringBiMapGenerator() { @Override protected BiMap<String, String> create(Entry<String, String>[] entries) { .named("Maps.filterEntries[BiMap, Predicate]")
public static TestSuite suite() { TestSuite suite = new TestSuite(SynchronizedBiMapTest.class); suite.addTest(BiMapTestSuiteBuilder.using(new SynchTestingBiMapGenerator()) .named("Synchronized.biMap[TestBiMap]") .withFeatures(CollectionSize.ANY, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, MapFeature.ALLOWS_NULL_KEYS, MapFeature.ALLOWS_NULL_VALUES, MapFeature.ALLOWS_ANY_NULL_QUERIES, MapFeature.GENERAL_PURPOSE, MapFeature.REJECTS_DUPLICATES_AT_CREATION) .createTestSuite()); suite.addTest(BiMapTestSuiteBuilder.using(new SynchronizedHashBiMapGenerator()) .named("synchronizedBiMap[HashBiMap]") .withFeatures(CollectionSize.ANY, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, MapFeature.ALLOWS_NULL_KEYS, MapFeature.ALLOWS_NULL_VALUES, MapFeature.ALLOWS_ANY_NULL_QUERIES, MapFeature.GENERAL_PURPOSE, MapFeature.REJECTS_DUPLICATES_AT_CREATION, CollectionFeature.SERIALIZABLE) .suppressing(BiMapInverseTester.getInverseSameAfterSerializingMethods()) .createTestSuite()); return suite; }
@GwtIncompatible // suite public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(BiMapTestSuiteBuilder.using(new EnumHashBiMapGenerator()) .named("EnumHashBiMap") .withFeatures(CollectionSize.ANY, CollectionFeature.SERIALIZABLE, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, MapFeature.ALLOWS_NULL_VALUES, MapFeature.GENERAL_PURPOSE, CollectionFeature.KNOWN_ORDER) .createTestSuite()); suite.addTestSuite(EnumHashBiMapTest.class); return suite; }