It appears that there are some small coverage mistakes that break the Map contract. Guava's testlib provides a nice way to perform a deep validation in a pluggable manner. In the following configuration there are 7 errors and 40 failures (many are duplicates at different population counts).
For example, testPutAll_nullKeyUnsupported fails due to putAll delegating to putInternal which does not perform a null key check. Instead it could delegate to any of the put(...) methods which includes it.
public final class ExpiringMapTest {
public static Test suite() throws Exception {
TestSuite suite = new TestSuite();
suite.addTest(ExpiringMapTest.suite("ExpiringMap", () -> {
return ExpiringMap.builder().build();
}));
return suite;
}
private static Test suite(String name, Supplier<Map<String, String>> supplier) {
return MapTestSuiteBuilder
.using(new TestStringMapGenerator() {
@Override protected Map<String, String> create(Entry<String, String>[] entries) {
Map<String, String> map = supplier.get();
for (Entry<String, String> entry : entries) {
map.put(entry.getKey(), entry.getValue());
}
return map;
}
})
.named(name)
.withFeatures(
MapFeature.GENERAL_PURPOSE,
MapFeature.ALLOWS_NULL_ENTRY_QUERIES,
MapFeature.ALLOWS_NULL_VALUES,
CollectionFeature.SUPPORTS_ITERATOR_REMOVE,
CollectionSize.ANY)
.createTestSuite();
}
}
It appears that there are some small coverage mistakes that break the
Map
contract. Guava's testlib provides a nice way to perform a deep validation in a pluggable manner. In the following configuration there are 7 errors and 40 failures (many are duplicates at different population counts).For example,
testPutAll_nullKeyUnsupported
fails due toputAll
delegating toputInternal
which does not perform a null key check. Instead it could delegate to any of theput(...)
methods which includes it.