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;
}
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;
}
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;
}
Aggregations