List of usage examples for com.google.common.collect.testing.features MapFeature FAILS_FAST_ON_CONCURRENT_MODIFICATION
MapFeature FAILS_FAST_ON_CONCURRENT_MODIFICATION
To view the source code for com.google.common.collect.testing.features MapFeature FAILS_FAST_ON_CONCURRENT_MODIFICATION.
Click Source Link
From source file:org.java0.collection.HashSetMapSuite.java
public static TestSuite suite() { TestMapGenerator<String, Set<String>> generator = new TestMapGenerator<String, Set<String>>() { @Override// w w w . java 2 s . com public SampleElements<Map.Entry<String, Set<String>>> samples() { return new SampleElements<Map.Entry<String, Set<String>>>( Helpers.mapEntry("AAA", (Set<String>) new HashSet<String>(Arrays.asList(new String[] { "111", "222" }))), Helpers.mapEntry("BBB", (Set<String>) new HashSet<String>(Arrays.asList(new String[] { "333", "444" }))), Helpers.mapEntry("CCC", (Set<String>) new HashSet<String>(Arrays.asList(new String[] { "555", "666" }))), Helpers.mapEntry("DDD", (Set<String>) new HashSet<String>(Arrays.asList(new String[] { "777", "888" }))), Helpers.mapEntry("EEE", (Set<String>) new HashSet<String>(Arrays.asList(new String[] { "999", "000" })))); } @Override public Map<String, Set<String>> create(Object... entries) { Map<String, Set<String>> map = new HashSetMap<String, String>(); for (Object o : entries) { @SuppressWarnings("unchecked") Entry<String, Set<String>> entry = (Entry<String, Set<String>>) o; map.put(entry.getKey(), entry.getValue()); } return map; } @Override @SuppressWarnings("unchecked") public final Entry<String, Set<String>>[] createArray(int length) { return new Entry[length]; } @Override public final String[] createKeyArray(int length) { return new String[length]; } @SuppressWarnings("unchecked") @Override public final HashSet<String>[] createValueArray(int length) { return new HashSet[length]; } /** Returns the original element list, unchanged. */ @Override public Iterable<Entry<String, Set<String>>> order(List<Entry<String, Set<String>>> insertionOrder) { return insertionOrder; } }; TestSuite suite = MapTestSuiteBuilder.using(generator).named("HashSetMapSuite") .withFeatures(MapFeature.GENERAL_PURPOSE, MapFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION, MapFeature.SUPPORTS_PUT, MapFeature.SUPPORTS_REMOVE, MapFeature.ALLOWS_NULL_KEYS, MapFeature.ALLOWS_NULL_VALUES, CollectionFeature.SUPPORTS_ITERATOR_REMOVE, CollectionSize.ANY) .createTestSuite(); return suite; }
From source file:com.koloboke.collect.testing.map.HyperCharShortMapTestSuiteBuilder.java
private MapTestSuiteBuilder<Character, Short> forEachTestSuiteBuilder( MapTestSuiteBuilder<Character, Short> builder) { return builder.suppressing(suppressing).withFeatures(MapFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION) .withFeatures(MapFeature.ALLOWS_NULL_ENTRY_QUERIES).withFeatures(CollectionSize.ANY) .withFeatures(specialFeatures); }