当前位置: 首页>>代码示例>>Java>>正文


Java MapTestSuiteBuilder类代码示例

本文整理汇总了Java中com.google.common.collect.testing.MapTestSuiteBuilder的典型用法代码示例。如果您正苦于以下问题:Java MapTestSuiteBuilder类的具体用法?Java MapTestSuiteBuilder怎么用?Java MapTestSuiteBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MapTestSuiteBuilder类属于com.google.common.collect.testing包,在下文中一共展示了MapTestSuiteBuilder类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testsForPatriciaTrie

import com.google.common.collect.testing.MapTestSuiteBuilder; //导入依赖的package包/类
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();
}
 
开发者ID:veqryn,项目名称:cidr-ip-trie,代码行数:23,代码来源:TestPatriciaTrieWithGuava.java

示例2: suite

import com.google.common.collect.testing.MapTestSuiteBuilder; //导入依赖的package包/类
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();
}
 
开发者ID:parentjo,项目名称:pareto4j,代码行数:20,代码来源:ParetoHashMapTestSuite.java

示例3: suite

import com.google.common.collect.testing.MapTestSuiteBuilder; //导入依赖的package包/类
public static Test suite() {
    MapTestSuiteBuilder<String, String> chmSuite = using(new CHMTestGenerator());
    configureSuite(chmSuite);
    TestSuite chmTests = chmSuite.named("Guava tests of Chronicle Map").createTestSuite();

    MapTestSuiteBuilder<String, String> backed = using(new BackedUpMapGenerator());
    configureSuite(backed);
    TestSuite backedTests = backed
            .named("Guava tests tests of Chronicle Map, backed with HashMap")
            .createTestSuite();
    
    TestSuite tests = new TestSuite();
    tests.addTest(chmTests);
    // TODO
    //tests.addTest(backedTests);
    return tests;
}
 
开发者ID:OpenHFT,项目名称:Chronicle-Map,代码行数:18,代码来源:GuavaTest.java

示例4: testsForPauselessHashMap

import com.google.common.collect.testing.MapTestSuiteBuilder; //导入依赖的package包/类
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();
}
 
开发者ID:giltene,项目名称:PauselessHashMap,代码行数:23,代码来源:PauselessHashMapGuavaTest.java

示例5: createDerivedSuites

import com.google.common.collect.testing.MapTestSuiteBuilder; //导入依赖的package包/类
@Override
protected List<TestSuite> createDerivedSuites(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<M, Map.Entry<K, V>>>
        parentBuilder) {
  // TODO: Once invariant support is added, supply invariants to each of the
  // derived suites, to check that mutations to the derived collections are
  // reflected in the underlying map.

  List<TestSuite> derivedSuites = super.createDerivedSuites(parentBuilder);

  if (parentBuilder.getFeatures().contains(CollectionFeature.SERIALIZABLE)) {
    derivedSuites.add(
        MultimapTestSuiteBuilder.using(
                new ReserializedMultimapGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
            .withFeatures(computeReserializedMultimapFeatures(parentBuilder.getFeatures()))
            .named(parentBuilder.getName() + " reserialized")
            .suppressing(parentBuilder.getSuppressedTests())
            .createTestSuite());
  }

  derivedSuites.add(
      MapTestSuiteBuilder.using(new AsMapGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
          .withFeatures(computeAsMapFeatures(parentBuilder.getFeatures()))
          .named(parentBuilder.getName() + ".asMap")
          .suppressing(parentBuilder.getSuppressedTests())
          .createTestSuite());

  derivedSuites.add(computeEntriesTestSuite(parentBuilder));
  derivedSuites.add(computeMultimapGetTestSuite(parentBuilder));
  derivedSuites.add(computeMultimapAsMapGetTestSuite(parentBuilder));
  derivedSuites.add(computeKeysTestSuite(parentBuilder));
  derivedSuites.add(computeValuesTestSuite(parentBuilder));

  return derivedSuites;
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:37,代码来源:MultimapTestSuiteBuilder.java

示例6: suite

import com.google.common.collect.testing.MapTestSuiteBuilder; //导入依赖的package包/类
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();
}
 
开发者ID:alexmojaki,项目名称:boxes,代码行数:37,代码来源:MapBoxTest.java

示例7: suite

import com.google.common.collect.testing.MapTestSuiteBuilder; //导入依赖的package包/类
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();
}
 
开发者ID:alexmojaki,项目名称:boxes,代码行数:34,代码来源:BoxesMapTest.java

示例8: createDerivedSuites

import com.google.common.collect.testing.MapTestSuiteBuilder; //导入依赖的package包/类
createDerivedSuites(
        FeatureSpecificTestSuiteBuilder<?,
            ? extends OneSizeTestContainerGenerator<BiMap<K, V>, Entry<K, V>>> parentBuilder) {
  List<TestSuite> derived = super.createDerivedSuites(parentBuilder);
  // TODO(cpovirk): consider using this approach (derived suites instead of extension) in
  // ListTestSuiteBuilder, etc.?
  derived.add(MapTestSuiteBuilder
      .using(new MapGenerator<K, V>(parentBuilder.getSubjectGenerator()))
      .withFeatures(parentBuilder.getFeatures())
      .named(parentBuilder.getName() + " [Map]")
      .suppressing(parentBuilder.getSuppressedTests())
      .suppressing(SetCreationTester.class.getMethods())
         // BiMap.entrySet() duplicate-handling behavior is too confusing for SetCreationTester
      .createTestSuite());
  /*
   * TODO(cpovirk): the Map tests duplicate most of this effort by using a
   * CollectionTestSuiteBuilder on values(). It would be nice to avoid that
   */
  derived.add(SetTestSuiteBuilder
      .using(new BiMapValueSetGenerator<K, V>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeValuesSetFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + " values [Set]")
      .suppressing(parentBuilder.getSuppressedTests())
      .suppressing(SetCreationTester.class.getMethods())
        // BiMap.values() duplicate-handling behavior is too confusing for SetCreationTester
      .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());
  }

  return derived;
}
 
开发者ID:sander120786,项目名称:guava-libraries,代码行数:38,代码来源:BiMapTestSuiteBuilder.java

示例9: createDerivedSuites

import com.google.common.collect.testing.MapTestSuiteBuilder; //导入依赖的package包/类
@Override
protected List<TestSuite> createDerivedSuites(
    FeatureSpecificTestSuiteBuilder<
    ?,
    ? extends OneSizeTestContainerGenerator<M, Map.Entry<K, V>>>
    parentBuilder) {
  // TODO: Once invariant support is added, supply invariants to each of the
  // derived suites, to check that mutations to the derived collections are
  // reflected in the underlying map.

  List<TestSuite> derivedSuites = super.createDerivedSuites(parentBuilder);

  if (parentBuilder.getFeatures().contains(CollectionFeature.SERIALIZABLE)) {
    derivedSuites.add(MultimapTestSuiteBuilder.using(
        new ReserializedMultimapGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
        .withFeatures(computeReserializedMultimapFeatures(parentBuilder.getFeatures()))
        .named(parentBuilder.getName() + " reserialized")
        .suppressing(parentBuilder.getSuppressedTests())
        .createTestSuite());
  }

  derivedSuites.add(MapTestSuiteBuilder.using(
      new AsMapGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeAsMapFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".asMap")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite());

  derivedSuites.add(computeEntriesTestSuite(parentBuilder));
  derivedSuites.add(computeMultimapGetTestSuite(parentBuilder));
  derivedSuites.add(computeMultimapAsMapGetTestSuite(parentBuilder));
  derivedSuites.add(computeKeysTestSuite(parentBuilder));
  derivedSuites.add(computeValuesTestSuite(parentBuilder));

  return derivedSuites;
}
 
开发者ID:sander120786,项目名称:guava-libraries,代码行数:37,代码来源:MultimapTestSuiteBuilder.java

示例10: suite

import com.google.common.collect.testing.MapTestSuiteBuilder; //导入依赖的package包/类
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();
}
 
开发者ID:parentjo,项目名称:pareto4j,代码行数:16,代码来源:ParetoLinkedHashMapTestSuite.java

示例11: createDerivedSuites

import com.google.common.collect.testing.MapTestSuiteBuilder; //导入依赖的package包/类
@Override
protected List<TestSuite> createDerivedSuites(
    FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<M, Entry<K, V>>>
        parentBuilder) {
  // TODO: Once invariant support is added, supply invariants to each of the
  // derived suites, to check that mutations to the derived collections are
  // reflected in the underlying map.

  List<TestSuite> derivedSuites = super.createDerivedSuites(parentBuilder);

  if (parentBuilder.getFeatures().contains(CollectionFeature.SERIALIZABLE)) {
    derivedSuites.add(
        MultimapTestSuiteBuilder.using(
                new ReserializedMultimapGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
            .withFeatures(computeReserializedMultimapFeatures(parentBuilder.getFeatures()))
            .named(parentBuilder.getName() + " reserialized")
            .suppressing(parentBuilder.getSuppressedTests())
            .createTestSuite());
  }

  derivedSuites.add(
      MapTestSuiteBuilder.using(new AsMapGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
          .withFeatures(computeAsMapFeatures(parentBuilder.getFeatures()))
          .named(parentBuilder.getName() + ".asMap")
          .suppressing(parentBuilder.getSuppressedTests())
          .createTestSuite());

  derivedSuites.add(computeEntriesTestSuite(parentBuilder));
  derivedSuites.add(computeMultimapGetTestSuite(parentBuilder));
  derivedSuites.add(computeMultimapAsMapGetTestSuite(parentBuilder));
  derivedSuites.add(computeKeysTestSuite(parentBuilder));
  derivedSuites.add(computeValuesTestSuite(parentBuilder));

  return derivedSuites;
}
 
开发者ID:google,项目名称:guava,代码行数:36,代码来源:MultimapTestSuiteBuilder.java

示例12: createDerivedSuites

import com.google.common.collect.testing.MapTestSuiteBuilder; //导入依赖的package包/类
@Override
protected List<TestSuite> createDerivedSuites(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<BiMap<K, V>, Entry<K, V>>>
        parentBuilder) {
  List<TestSuite> derived = super.createDerivedSuites(parentBuilder);
  // TODO(cpovirk): consider using this approach (derived suites instead of extension) in
  // ListTestSuiteBuilder, etc.?
  derived.add(
      MapTestSuiteBuilder.using(new MapGenerator<K, V>(parentBuilder.getSubjectGenerator()))
          .withFeatures(parentBuilder.getFeatures())
          .named(parentBuilder.getName() + " [Map]")
          .suppressing(parentBuilder.getSuppressedTests())
          .suppressing(SetCreationTester.class.getMethods())
          // BiMap.entrySet() duplicate-handling behavior is too confusing for SetCreationTester
          .createTestSuite());
  /*
   * TODO(cpovirk): the Map tests duplicate most of this effort by using a
   * CollectionTestSuiteBuilder on values(). It would be nice to avoid that
   */
  derived.add(
      SetTestSuiteBuilder.using(
              new BiMapValueSetGenerator<K, V>(parentBuilder.getSubjectGenerator()))
          .withFeatures(computeValuesSetFeatures(parentBuilder.getFeatures()))
          .named(parentBuilder.getName() + " values [Set]")
          .suppressing(parentBuilder.getSuppressedTests())
          .suppressing(SetCreationTester.class.getMethods())
          // BiMap.values() duplicate-handling behavior is too confusing for SetCreationTester
          .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());
  }

  return derived;
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:42,代码来源:BiMapTestSuiteBuilder.java

示例13: computeCommonDerivedCollectionFeatures

import com.google.common.collect.testing.MapTestSuiteBuilder; //导入依赖的package包/类
private static Set<Feature<?>> computeCommonDerivedCollectionFeatures(
    Set<Feature<?>> mapFeatures) {
  return MapTestSuiteBuilder.computeCommonDerivedCollectionFeatures(mapFeatures);
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:5,代码来源:BiMapTestSuiteBuilder.java

示例14: configureSuite

import com.google.common.collect.testing.MapTestSuiteBuilder; //导入依赖的package包/类
private static void configureSuite(MapTestSuiteBuilder<String, String> suite) {
    suite.withFeatures(GENERAL_PURPOSE)
            .withFeatures(CollectionSize.ANY)
            .withFeatures(CollectionFeature.REMOVE_OPERATIONS)
            .withFeatures(RESTRICTS_KEYS, RESTRICTS_VALUES);
}
 
开发者ID:OpenHFT,项目名称:Chronicle-Map,代码行数:7,代码来源:GuavaTest.java


注:本文中的com.google.common.collect.testing.MapTestSuiteBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。