Search in sources :

Example 1 with TestStringListMultimapGenerator

use of com.google.common.collect.testing.google.TestStringListMultimapGenerator in project guava by google.

the class ArrayListMultimapTest method suite.

// suite
@GwtIncompatible
public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTest(ListMultimapTestSuiteBuilder.using(new TestStringListMultimapGenerator() {

        @Override
        protected ListMultimap<String, String> create(Entry<String, String>[] entries) {
            ListMultimap<String, String> multimap = ArrayListMultimap.create();
            for (Entry<String, String> entry : entries) {
                multimap.put(entry.getKey(), entry.getValue());
            }
            return multimap;
        }
    }).named("ArrayListMultimap").withFeatures(MapFeature.ALLOWS_NULL_KEYS, MapFeature.ALLOWS_NULL_VALUES, MapFeature.ALLOWS_ANY_NULL_QUERIES, MapFeature.GENERAL_PURPOSE, MapFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, CollectionFeature.SERIALIZABLE, CollectionSize.ANY).createTestSuite());
    suite.addTestSuite(ArrayListMultimapTest.class);
    return suite;
}
Also used : Entry(java.util.Map.Entry) TestSuite(junit.framework.TestSuite) TestStringListMultimapGenerator(com.google.common.collect.testing.google.TestStringListMultimapGenerator) GwtIncompatible(com.google.common.annotations.GwtIncompatible)

Example 2 with TestStringListMultimapGenerator

use of com.google.common.collect.testing.google.TestStringListMultimapGenerator in project guava by google.

the class MultimapsCollectionTest method suite.

public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTest(transformSuite());
    suite.addTest(filterSuite());
    suite.addTest(ListMultimapTestSuiteBuilder.using(new TestStringListMultimapGenerator() {

        @Override
        protected ListMultimap<String, String> create(Entry<String, String>[] entries) {
            ListMultimap<String, String> multimap = Multimaps.synchronizedListMultimap(ArrayListMultimap.<String, String>create());
            for (Entry<String, String> entry : entries) {
                multimap.put(entry.getKey(), entry.getValue());
            }
            return multimap;
        }
    }).named("synchronized ArrayListMultimap").withFeatures(MapFeature.ALLOWS_NULL_KEYS, MapFeature.ALLOWS_NULL_VALUES, MapFeature.ALLOWS_ANY_NULL_QUERIES, MapFeature.GENERAL_PURPOSE, MapFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, CollectionSize.ANY).createTestSuite());
    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {

        @Override
        protected Set<String> create(String[] elements) {
            PopulatableMapAsMultimap<Integer, String> multimap = PopulatableMapAsMultimap.create();
            populateMultimapForGet(multimap, elements);
            return multimap.build().get(3);
        }
    }).named("Multimaps.forMap.get").withFeatures(FOR_MAP_FEATURES_ONE).createTestSuite());
    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {

        @Override
        protected Set<String> create(String[] elements) {
            PopulatableMapAsMultimap<String, Integer> multimap = PopulatableMapAsMultimap.create();
            populateMultimapForKeySet(multimap, elements);
            return multimap.build().keySet();
        }
    }).named("Multimaps.forMap.keySet").withFeatures(FOR_MAP_FEATURES_ANY).createTestSuite());
    // TODO: use collection testers on Multimaps.forMap.values
    suite.addTest(MultisetTestSuiteBuilder.using(new TestStringMultisetGenerator() {

        @Override
        protected Multiset<String> create(String[] elements) {
            PopulatableMapAsMultimap<String, Integer> multimap = PopulatableMapAsMultimap.create();
            populateMultimapForKeys(multimap, elements);
            return multimap.build().keys();
        }
    }).named("Multimaps.forMap.keys").withFeatures(FOR_MAP_FEATURES_ANY).suppressing(getCountDuplicateInitializingMethods()).suppressing(getSetCountDuplicateInitializingMethods()).suppressing(getIteratorDuplicateInitializingMethods()).suppressing(getRemoveDuplicateInitializingMethods()).createTestSuite());
    return suite;
}
Also used : TreeSet(java.util.TreeSet) Set(java.util.Set) TestStringSetGenerator(com.google.common.collect.testing.TestStringSetGenerator) Helpers.mapEntry(com.google.common.collect.testing.Helpers.mapEntry) Entry(java.util.Map.Entry) TestSuite(junit.framework.TestSuite) TestStringListMultimapGenerator(com.google.common.collect.testing.google.TestStringListMultimapGenerator) TestStringMultisetGenerator(com.google.common.collect.testing.google.TestStringMultisetGenerator)

Example 3 with TestStringListMultimapGenerator

use of com.google.common.collect.testing.google.TestStringListMultimapGenerator in project guava by google.

the class LinkedListMultimapTest method suite.

// suite
@GwtIncompatible
public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTest(ListMultimapTestSuiteBuilder.using(new TestStringListMultimapGenerator() {

        @Override
        protected ListMultimap<String, String> create(Entry<String, String>[] entries) {
            ListMultimap<String, String> multimap = LinkedListMultimap.create();
            for (Entry<String, String> entry : entries) {
                multimap.put(entry.getKey(), entry.getValue());
            }
            return multimap;
        }
    }).named("LinkedListMultimap").withFeatures(MapFeature.ALLOWS_NULL_KEYS, MapFeature.ALLOWS_NULL_VALUES, MapFeature.ALLOWS_ANY_NULL_QUERIES, MapFeature.GENERAL_PURPOSE, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, CollectionFeature.SERIALIZABLE, CollectionFeature.KNOWN_ORDER, CollectionSize.ANY).createTestSuite());
    suite.addTestSuite(LinkedListMultimapTest.class);
    return suite;
}
Also used : Entry(java.util.Map.Entry) TestSuite(junit.framework.TestSuite) TestStringListMultimapGenerator(com.google.common.collect.testing.google.TestStringListMultimapGenerator) GwtIncompatible(com.google.common.annotations.GwtIncompatible)

Aggregations

TestStringListMultimapGenerator (com.google.common.collect.testing.google.TestStringListMultimapGenerator)3 Entry (java.util.Map.Entry)3 TestSuite (junit.framework.TestSuite)3 GwtIncompatible (com.google.common.annotations.GwtIncompatible)2 Helpers.mapEntry (com.google.common.collect.testing.Helpers.mapEntry)1 TestStringSetGenerator (com.google.common.collect.testing.TestStringSetGenerator)1 TestStringMultisetGenerator (com.google.common.collect.testing.google.TestStringMultisetGenerator)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1