Java 类com.google.common.collect.testing.TestStringMapGenerator 实例源码

项目:cidr-ip-trie    文件:TestPatriciaTrieWithGuava.java   
public Test testsForPatriciaTrie() {
  return MapTestSuiteBuilder
      .using(new TestStringMapGenerator() {
        @Override
        protected Map<String, String> create(
            final Entry<String, String>[] entries) {
          return populate(new PatriciaTrie<String>(), entries);
        }
      })
      .named("PatriciaTrie")
      .withFeatures(
          MapFeature.GENERAL_PURPOSE,
          MapFeature.ALLOWS_NULL_ENTRY_QUERIES,
          MapFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
          CollectionFeature.SUPPORTS_ITERATOR_REMOVE,
          // Assumes Insertion Order if you don't implement SortedMap
          // CollectionFeature.KNOWN_ORDER,
          CollectionFeature.SERIALIZABLE,
          CollectionSize.ANY)
      .suppressing(suppressForPatriciaTrie())
      .createTestSuite();
}
项目:pareto4j    文件:ParetoHashMapTestSuite.java   
public static TestSuite suite() throws Exception {
    return MapTestSuiteBuilder.using(new TestStringMapGenerator() {
        @Override
        protected Map<String, String> create(Map.Entry<String, String>[] entries) {
            ParetoHashMap m = new ParetoHashMap();
            //
            for (Map.Entry<String, String> entry : entries) {
                if (entry == null)
                    m.put(null, null);
                else
                    m.put(entry.getKey(), entry.getValue());
            }
            return m;
        }
    }
    ).named("ParetoHashMap"
    ).withFeatures(MapFeature.GENERAL_PURPOSE, CollectionSize.ANY, MapFeature.ALLOWS_NULL_VALUES, MapFeature.ALLOWS_NULL_KEYS
    ).createTestSuite();
}
项目:PauselessHashMap    文件:PauselessHashMapGuavaTest.java   
public Test testsForPauselessHashMap() {
    return MapTestSuiteBuilder
            .using(new TestStringMapGenerator() {
                @Override
                protected Map<String, String> create(
                        Map.Entry<String, String>[] entries) {
                    return toHashMap(entries);
                }
            })
            .named("HashMap")
            .withFeatures(
                    MapFeature.GENERAL_PURPOSE,
                    MapFeature.ALLOWS_NULL_KEYS,
                    MapFeature.ALLOWS_NULL_VALUES,
                    MapFeature.ALLOWS_ANY_NULL_QUERIES,
                    MapFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
                    CollectionFeature.SUPPORTS_ITERATOR_REMOVE,
                    CollectionFeature.SERIALIZABLE,
                    CollectionSize.ANY)
            .suppressing(suppressForHashMap())
            .createTestSuite();
}
项目:boxes    文件:MapBoxTest.java   
public static TestSuite suite() {
    return MapTestSuiteBuilder
            .using(new TestStringMapGenerator() {

                @Override
                protected Map<String, String> create(Map.Entry<String, String>[] entries) {
                    MapBox<String, String> inner = new MapBox<String, String>(MapBoxTest.class, "map").init();
                    for (Map.Entry<String, String> entry : entries) {
                        if (entry != null) {
                            inner.put(entry.getKey(), entry.getValue());
                        }
                    }
                    MapBox<String, String> outer = new MapBox<String, String>(
                            BoxFamily.getInstance(MapBoxTest.class, "map"));
                    outer.set(inner);
                    return outer;
                }
            })
            .named("MapBox")
            .withFeatures(
                    CollectionFeature.ALLOWS_NULL_QUERIES,
                    CollectionFeature.DESCENDING_VIEW,
                    CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
                    CollectionFeature.SUBSET_VIEW,
                    CollectionFeature.SUPPORTS_ITERATOR_REMOVE,
                    CollectionFeature.SUPPORTS_REMOVE,
                    CollectionSize.ANY,
                    MapFeature.ALLOWS_ANY_NULL_QUERIES,
                    MapFeature.ALLOWS_NULL_KEYS,
                    MapFeature.ALLOWS_NULL_VALUES,
                    MapFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
                    MapFeature.GENERAL_PURPOSE,
                    MapFeature.SUPPORTS_PUT,
                    MapFeature.SUPPORTS_REMOVE
            ).createTestSuite();
}
项目:boxes    文件:BoxesMapTest.java   
public static TestSuite suite() {
    return MapTestSuiteBuilder
            .using(new TestStringMapGenerator() {

                @Override
                protected Map<String, String> create(Map.Entry<String, String>[] entries) {
                    BoxesMap<String, String> map = new BoxesMap<String, String>().allowBoxlessKeys();
                    for (Map.Entry<String, String> entry : entries) {
                        if (entry != null) {
                            map.put(entry.getKey(), entry.getValue());
                        }
                    }
                    return map;
                }
            })
            .named("BoxesMap")
            .withFeatures(
                    CollectionFeature.ALLOWS_NULL_QUERIES,
                    CollectionFeature.DESCENDING_VIEW,
                    CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
                    CollectionFeature.SUBSET_VIEW,
                    CollectionFeature.SUPPORTS_ITERATOR_REMOVE,
                    CollectionFeature.SUPPORTS_REMOVE,
                    CollectionSize.ANY,
                    MapFeature.ALLOWS_ANY_NULL_QUERIES,
                    MapFeature.ALLOWS_NULL_KEYS,
                    MapFeature.ALLOWS_NULL_VALUES,
                    MapFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
                    MapFeature.GENERAL_PURPOSE,
                    MapFeature.SUPPORTS_PUT,
                    MapFeature.SUPPORTS_REMOVE
            ).createTestSuite();
}
项目:pareto4j    文件:ParetoLinkedHashMapTestSuite.java   
public static TestSuite suite() throws Exception {
    return MapTestSuiteBuilder.using(new TestStringMapGenerator() {
        @Override
        protected Map<String, String> create(Map.Entry<String, String>[] entries) {
            ParetoLinkedHashMap m = new ParetoLinkedHashMap();
            //
            for (Map.Entry<String, String> entry : entries) {
                m.put(entry.getKey(), entry.getValue());
            }
            return m;
        }
    }).named("ParetoHashMap")
            .withFeatures(MapFeature.GENERAL_PURPOSE, CollectionSize.ANY, MapFeature.ALLOWS_NULL_KEYS, MapFeature.GENERAL_PURPOSE, MapFeature.ALLOWS_NULL_VALUES)
            .createTestSuite();
}