Search in sources :

Example 11 with TestStringMapGenerator

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

the class ForwardingNavigableMapTest method suite.

public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(ForwardingNavigableMapTest.class);
    suite.addTest(NavigableMapTestSuiteBuilder.using(new TestStringMapGenerator() {

        @Override
        protected Map<String, String> create(Entry<String, String>[] entries) {
            NavigableMap<String, String> map = new SafeTreeMap<String, String>();
            for (Entry<String, String> entry : entries) {
                map.put(entry.getKey(), entry.getValue());
            }
            return new StandardImplForwardingNavigableMap<String, String>(map);
        }

        @Override
        public Iterable<Entry<String, String>> order(List<Entry<String, String>> insertionOrder) {
            return sort(insertionOrder);
        }
    }).named("ForwardingNavigableMap[SafeTreeMap] with no comparator and standard " + "implementations").withFeatures(CollectionSize.ANY, CollectionFeature.KNOWN_ORDER, MapFeature.ALLOWS_NULL_VALUES, MapFeature.GENERAL_PURPOSE).createTestSuite());
    // TODO(user): add forwarding-to-ImmutableSortedMap test
    return suite;
}
Also used : Maps.immutableEntry(com.google.common.collect.Maps.immutableEntry) Entry(java.util.Map.Entry) TestSuite(junit.framework.TestSuite) NavigableMap(java.util.NavigableMap) TestStringMapGenerator(com.google.common.collect.testing.TestStringMapGenerator) NavigableMap(java.util.NavigableMap) SafeTreeMap(com.google.common.collect.testing.SafeTreeMap) Map(java.util.Map) SortedMap(java.util.SortedMap)

Aggregations

TestStringMapGenerator (com.google.common.collect.testing.TestStringMapGenerator)11 Map (java.util.Map)11 Entry (java.util.Map.Entry)11 TestSuite (junit.framework.TestSuite)11 SafeTreeMap (com.google.common.collect.testing.SafeTreeMap)5 SortedMap (java.util.SortedMap)5 MapTestSuiteBuilder (com.google.common.collect.testing.MapTestSuiteBuilder)4 Helpers.mapEntry (com.google.common.collect.testing.Helpers.mapEntry)3 NavigableMap (java.util.NavigableMap)3 GwtIncompatible (com.google.common.annotations.GwtIncompatible)1 Builder (com.google.common.collect.ImmutableMap.Builder)1 Maps.immutableEntry (com.google.common.collect.Maps.immutableEntry)1 CollectionTestSuiteBuilder (com.google.common.collect.testing.CollectionTestSuiteBuilder)1 ListTestSuiteBuilder (com.google.common.collect.testing.ListTestSuiteBuilder)1 ImmutableMapCopyOfEntriesGenerator (com.google.common.collect.testing.google.MapGenerators.ImmutableMapCopyOfEntriesGenerator)1 ImmutableMapCopyOfEnumMapGenerator (com.google.common.collect.testing.google.MapGenerators.ImmutableMapCopyOfEnumMapGenerator)1 ImmutableMapCopyOfGenerator (com.google.common.collect.testing.google.MapGenerators.ImmutableMapCopyOfGenerator)1 ImmutableMapEntryListGenerator (com.google.common.collect.testing.google.MapGenerators.ImmutableMapEntryListGenerator)1 ImmutableMapGenerator (com.google.common.collect.testing.google.MapGenerators.ImmutableMapGenerator)1 ImmutableMapKeyListGenerator (com.google.common.collect.testing.google.MapGenerators.ImmutableMapKeyListGenerator)1