Skip to content

Commit

Permalink
Update test for #104 to cover empty and non-empty cases
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Mar 1, 2023
1 parent b44de19 commit 3e33f24
Showing 1 changed file with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,26 @@ static class Outside104 {
public Object aProperty;
}

private final ObjectMapper MAPPER = mapperWithModule();

// [datatypes-collections#104]
public void testPolymorphicArrayMap() throws Exception
public void testPolymorphicArrayMapEmpty() throws Exception {

This comment has been minimized.

Copy link
@magical-l

magical-l Mar 2, 2023

Contributor

oh, I think this method is nonEmpty and the one after this method is Empty

This comment has been minimized.

Copy link
@cowtowncoder

cowtowncoder Mar 3, 2023

Author Member

Yes, I renamed it in next commit

final ArrayListMultimap<String,Object> multimap = ArrayListMultimap.create();
multimap.put("aKey", 1);
_testPolymorphicArrayMap(multimap);
}

public void testPolymorphicArrayMapNonEmpty() throws Exception {
_testPolymorphicArrayMap(ArrayListMultimap.create());
}

private void _testPolymorphicArrayMap(ArrayListMultimap<String,Object> multimap)
throws Exception
{
final ObjectMapper mapper = mapperWithModule();
final ArrayListMultimap<String,Object> multimap = ArrayListMultimap.create();
multimap.put("aKey", 1);
final Outside104 outside = new Outside104();
outside.aProperty = multimap;
final String s = mapper.writeValueAsString(outside);
Outside104 result = mapper.readValue(s, Outside104.class);
final String json = MAPPER.writeValueAsString(outside);
Outside104 result = MAPPER.readValue(json, Outside104.class);
assertNotNull(result);
}
}

0 comments on commit 3e33f24

Please sign in to comment.