mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 08:57:12 +02:00
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:
parent
d538dca2e0
commit
8157928a35
53 changed files with 424 additions and 399 deletions
|
@ -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 {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue