use of com.google.common.collect.testing.features.MapFeature.SUPPORTS_PUT in project guava by google.
the class MapComputeIfAbsentTester method testComputeIfAbsent_supportedPresent.
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(absent = ZERO)
public void testComputeIfAbsent_supportedPresent() {
assertEquals("computeIfAbsent(present, function) should return existing value", v0(), getMap().computeIfAbsent(k0(), k -> {
throw new AssertionFailedError();
}));
expectUnchanged();
}
use of com.google.common.collect.testing.features.MapFeature.SUPPORTS_PUT in project guava by google.
the class MapMergeTester method testMergeAbsentNullKey.
@MapFeature.Require({ SUPPORTS_PUT, ALLOWS_NULL_KEYS })
public void testMergeAbsentNullKey() {
assertEquals("Map.merge(null, value, function) should return value", v3(), getMap().merge(null, v3(), (oldV, newV) -> {
throw new AssertionFailedError("Should not call merge function if key was absent");
}));
expectAdded(entry(null, v3()));
}
Aggregations