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(); }
@SuppressWarnings("unchecked") // Class parameters must be raw. @Override protected List<Class<? extends AbstractTester>> getTesters() { return Arrays.<Class<? extends AbstractTester>>asList( MapClearTester.class, MapComputeTester.class, MapComputeIfAbsentTester.class, MapComputeIfPresentTester.class, MapContainsKeyTester.class, MapContainsValueTester.class, MapCreationTester.class, MapEntrySetTester.class, MapEqualsTester.class, MapForEachTester.class, MapGetTester.class, MapGetOrDefaultTester.class, MapHashCodeTester.class, MapIsEmptyTester.class, MapMergeTester.class, MapPutTester.class, MapPutAllTester.class, MapPutIfAbsentTester.class, MapRemoveTester.class, MapRemoveEntryTester.class, MapReplaceTester.class, MapReplaceAllTester.class, MapReplaceEntryTester.class, MapSerializationTester.class, MapSizeTester.class, MapToStringTester.class); }