com.google.common.collect.testing.features.CollectionSize#com.google.common.collect.testing.MapTestSuiteBuilder源码实例Demo

下面列出了com.google.common.collect.testing.features.CollectionSize#com.google.common.collect.testing.MapTestSuiteBuilder 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: 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();
}
 
源代码2 项目: Chronicle-Map   文件: GuavaTest.java
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;
}
 
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();
}
 
源代码4 项目: xtext-lib   文件: MapExtensionsTest.java
public static TestSuite suite() {
	return MapTestSuiteBuilder
			// The create method is called with an array of elements
			// that should populate the collection.
			.using(new TestStringMapGenerator() {
				@Override
				protected Map<String, String> create(Entry<String, String>[] source) {
					Map<String, String> left = Maps.newHashMap();
					Map<String, String> right = Maps.newHashMap();
					for(int i = 0; i < source.length; i++) {
						Entry<String, String> entry = source[i];
						if (right.containsKey(entry.getKey())) {
							left.put(entry.getKey(), right.get(entry.getKey()));
							right.put(entry.getKey(), entry.getValue());
						} else if (i % 2 != 0) {
							left.put(entry.getKey(), entry.getValue());	
						} else {
							right.put(entry.getKey(), entry.getValue());
							if (i % 4 != 0) {
								left.put(entry.getKey(), "will be ignored");
							}
						}
					}
					return new UnmodifiableMergingMapView(left, right);
				}
			}).named("Guava-based UnmodifiableMergingMapView tests")
			.withFeatures(
					MapFeature.ALLOWS_NULL_KEYS,
					MapFeature.ALLOWS_NULL_VALUES,
					MapFeature.ALLOWS_ANY_NULL_QUERIES,
					MapFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
					CollectionFeature.ALLOWS_NULL_QUERIES,
					CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
					CollectionSize.ANY)
			.createTestSuite();
}
 
源代码5 项目: agrona   文件: Int2IntHashMapConformanceTest.java
private static <T> TestSuite mapTestSuite(final TestMapGenerator<T, T> testMapGenerator, final String name)
{
    return new MapTestSuiteBuilder<T, T>()
    {
        {
            usingGenerator(testMapGenerator);
        }
    }.withFeatures(
        MapFeature.GENERAL_PURPOSE,
        CollectionSize.ANY,
        CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
        .named(name)
        .createTestSuite();
}
 
源代码6 项目: agrona   文件: Long2LongHashMapConformanceTest.java
private static <T> TestSuite mapTestSuite(final TestMapGenerator<T, T> testMapGenerator, final String name)
{
    return new MapTestSuiteBuilder<T, T>()
    {
        {
            usingGenerator(testMapGenerator);
        }
    }.withFeatures(
        MapFeature.GENERAL_PURPOSE,
        CollectionSize.ANY,
        CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
        .named(name)
        .createTestSuite();
}
 
private static <T> TestSuite mapTestSuite(final TestMapGenerator<T, T> testMapGenerator, final String name)
{
    return new MapTestSuiteBuilder<T, T>()
    {
        {
            usingGenerator(testMapGenerator);
        }
    }.withFeatures(
        MapFeature.GENERAL_PURPOSE,
        CollectionSize.ANY,
        CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
        .named(name)
        .createTestSuite();
}
 
源代码8 项目: agrona   文件: Object2IntHashMapConformanceTest.java
private static <T> TestSuite mapTestSuite(final TestMapGenerator<T, T> testMapGenerator, final String name)
{
    return new MapTestSuiteBuilder<T, T>()
    {
        {
            usingGenerator(testMapGenerator);
        }
    }.withFeatures(
        MapFeature.GENERAL_PURPOSE,
        CollectionSize.ANY,
        CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
        .named(name)
        .createTestSuite();
}
 
private static <T> TestSuite mapTestSuite(final TestMapGenerator<T, T> testMapGenerator, final String name)
{
    return new MapTestSuiteBuilder<T, T>()
    {
        {
            usingGenerator(testMapGenerator);
        }
    }.withFeatures(
        MapFeature.GENERAL_PURPOSE,
        CollectionSize.ANY,
        CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
        .named(name)
        .createTestSuite();
}
 
源代码10 项目: agrona   文件: Int2ObjectHashMapConformanceTest.java
private static <T> TestSuite mapTestSuite(final TestMapGenerator<T, T> testMapGenerator, final String name)
{
    return new MapTestSuiteBuilder<T, T>()
    {
        {
            usingGenerator(testMapGenerator);
        }
    }.withFeatures(
        MapFeature.GENERAL_PURPOSE,
        CollectionSize.ANY,
        CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
        .named(name)
        .createTestSuite();
}
 
private static <T> TestSuite mapTestSuite(final TestMapGenerator<T, T> testMapGenerator, final String name)
{
    return new MapTestSuiteBuilder<T, T>()
    {
        {
            usingGenerator(testMapGenerator);
        }
    }.withFeatures(
        MapFeature.GENERAL_PURPOSE,
        MapFeature.ALLOWS_NULL_VALUES,
        CollectionSize.ANY,
        CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
        .named(name)
        .createTestSuite();
}
 
源代码12 项目: agrona   文件: Object2LongHashMapConformanceTest.java
private static <T> TestSuite mapTestSuite(final TestMapGenerator<T, T> testMapGenerator, final String name)
{
    return new MapTestSuiteBuilder<T, T>()
    {
        {
            usingGenerator(testMapGenerator);
        }
    }.withFeatures(
        MapFeature.GENERAL_PURPOSE,
        CollectionSize.ANY,
        CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
        .named(name)
        .createTestSuite();
}
 
private static <T> TestSuite mapTestSuite(final TestMapGenerator<T, T> testMapGenerator, final String name)
{
    return new MapTestSuiteBuilder<T, T>()
    {
        {
            usingGenerator(testMapGenerator);
        }
    }.withFeatures(
        MapFeature.GENERAL_PURPOSE,
        MapFeature.ALLOWS_NULL_VALUES,
        CollectionSize.ANY,
        CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
        .named(name)
        .createTestSuite();
}
 
private static <T> TestSuite mapTestSuite(final TestMapGenerator<T, T> testMapGenerator, final String name)
{
    return new MapTestSuiteBuilder<T, T>()
    {
        {
            usingGenerator(testMapGenerator);
        }
    }.withFeatures(
        MapFeature.GENERAL_PURPOSE,
        MapFeature.ALLOWS_NULL_VALUES,
        CollectionSize.ANY,
        CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
        .named(name)
        .createTestSuite();
}
 
源代码15 项目: Chronicle-Map   文件: GuavaTest.java
private static void configureSuite(MapTestSuiteBuilder<String, String> suite) {
    suite.withFeatures(GENERAL_PURPOSE)
            .withFeatures(CollectionSize.ANY)
            .withFeatures(CollectionFeature.REMOVE_OPERATIONS)
            .withFeatures(RESTRICTS_KEYS, RESTRICTS_VALUES);
}