Replace com.google.common.base.Function with java.util.function.Function

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179249159
This commit is contained in:
guyben 2017-12-15 15:41:05 -08:00 committed by Ben McIlwain
parent d538dca2e0
commit 8157928a35
53 changed files with 424 additions and 399 deletions

View file

@ -251,6 +251,27 @@ public class ImmutableObjectTest {
assertThat(cloned.heterogenousMap).containsEntry("b", "");
}
/** Subclass of ImmutableObject with fields that are containers containing null values. */
public static class NullInContainersObject extends ImmutableObject {
Object[] array = new Object[] {null};
List<?> list = newArrayList((Object) null);
Set<?> set = newHashSet((Object) null);
Map<String, ?> map = newHashMap();
public NullInContainersObject() {
map.put("a", null);
}
}
@Test
public void testToDiffableFieldMap_withEmptyAndNulls() {
Map<String, Object> diffableFieldMap = new NullInContainersObject().toDiffableFieldMap();
assertThat((List<?>) diffableFieldMap.get("array")).containsExactly((Object) null);
assertThat((List<?>) diffableFieldMap.get("list")).containsExactly((Object) null);
assertThat((Set<?>) diffableFieldMap.get("set")).containsExactly((Object) null);
assertThat((Map<?, ?>) diffableFieldMap.get("map")).containsExactly("a", (Object) null);
}
/** Subclass of ImmutableObject with keys to other objects. */
public static class RootObject extends ImmutableObject {