com.google.common.collect.testing.features.MapFeature Java Examples
The following examples show how to use
com.google.common.collect.testing.features.MapFeature.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestPatriciaTrieWithGuava.java From cidr-ip-trie with Mozilla Public License 2.0 | 6 votes |
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(); }
Example #2
Source File: PauselessHashMapGuavaTest.java From PauselessHashMap with Apache License 2.0 | 6 votes |
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(); }
Example #3
Source File: NonBlockingHashMapTest.java From JCTools with Apache License 2.0 | 6 votes |
private static <T> TestSuite mapTestSuite(TestMapGenerator<T, T> testMapGenerator, String name) { return new MapTestSuiteBuilder<T, T>() { { usingGenerator(testMapGenerator); } @Override protected List<Class<? extends AbstractTester>> getTesters() { List<Class<? extends AbstractTester>> testers = new ArrayList<>(super.getTesters()); // NonBlockingHashMap doesn't support null in putIfAbsent and provides putIfAbsentAllowsNull instead testers.remove(MapReplaceEntryTester.class); testers.remove(MapReplaceTester.class); return testers; } }.withFeatures( MapFeature.GENERAL_PURPOSE, CollectionSize.ANY, CollectionFeature.SUPPORTS_ITERATOR_REMOVE) .named(name) .createTestSuite(); }
Example #4
Source File: MapExtensionsTest.java From xtext-lib with Eclipse Public License 2.0 | 5 votes |
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(); }
Example #5
Source File: MapTestFactory.java From caffeine with Apache License 2.0 | 5 votes |
/** * Returns a test suite. * * @param name the name of the cache type under test * @param generator the map generator * @return a suite of tests */ public static Test suite(String name, TestMapGenerator<?, ?> generator) { return ConcurrentMapTestSuiteBuilder .using(generator) .named(name) .withFeatures( MapFeature.GENERAL_PURPOSE, MapFeature.ALLOWS_NULL_ENTRY_QUERIES, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, CollectionSize.ANY) .createTestSuite(); }
Example #6
Source File: Int2IntHashMapConformanceTest.java From agrona with Apache License 2.0 | 5 votes |
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(); }
Example #7
Source File: Long2LongHashMapConformanceTest.java From agrona with Apache License 2.0 | 5 votes |
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(); }
Example #8
Source File: Long2ObjectHashMapConformanceTest.java From agrona with Apache License 2.0 | 5 votes |
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(); }
Example #9
Source File: Object2IntHashMapConformanceTest.java From agrona with Apache License 2.0 | 5 votes |
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(); }
Example #10
Source File: Object2ObjectHashMapConformanceTest.java From agrona with Apache License 2.0 | 5 votes |
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(); }
Example #11
Source File: Int2ObjectHashMapConformanceTest.java From agrona with Apache License 2.0 | 5 votes |
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(); }
Example #12
Source File: Int2NullableObjectHashMapConformanceTest.java From agrona with Apache License 2.0 | 5 votes |
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(); }
Example #13
Source File: Object2LongHashMapConformanceTest.java From agrona with Apache License 2.0 | 5 votes |
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(); }
Example #14
Source File: Object2NullableObjectHashMapConformanceTest.java From agrona with Apache License 2.0 | 5 votes |
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(); }
Example #15
Source File: Long2NullableObjectHashMapConformanceTest.java From agrona with Apache License 2.0 | 5 votes |
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(); }