Skip to content

Commit 3e33f24

Browse files
committed
Update test for #104 to cover empty and non-empty cases
1 parent b44de19 commit 3e33f24

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

guava/src/test/java/com/fasterxml/jackson/datatype/guava/failing/MultiMap104Test.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,26 @@ static class Outside104 {
1313
public Object aProperty;
1414
}
1515

16+
private final ObjectMapper MAPPER = mapperWithModule();
17+
1618
// [datatypes-collections#104]
17-
public void testPolymorphicArrayMap() throws Exception
19+
public void testPolymorphicArrayMapEmpty() throws Exception {
20+
final ArrayListMultimap<String,Object> multimap = ArrayListMultimap.create();
21+
multimap.put("aKey", 1);
22+
_testPolymorphicArrayMap(multimap);
23+
}
24+
25+
public void testPolymorphicArrayMapNonEmpty() throws Exception {
26+
_testPolymorphicArrayMap(ArrayListMultimap.create());
27+
}
28+
29+
private void _testPolymorphicArrayMap(ArrayListMultimap<String,Object> multimap)
30+
throws Exception
1831
{
19-
final ObjectMapper mapper = mapperWithModule();
20-
final ArrayListMultimap<String,Object> multimap = ArrayListMultimap.create();
21-
multimap.put("aKey", 1);
2232
final Outside104 outside = new Outside104();
2333
outside.aProperty = multimap;
24-
final String s = mapper.writeValueAsString(outside);
25-
Outside104 result = mapper.readValue(s, Outside104.class);
34+
final String json = MAPPER.writeValueAsString(outside);
35+
Outside104 result = MAPPER.readValue(json, Outside104.class);
2636
assertNotNull(result);
2737
}
2838
}

0 commit comments

Comments
 (0)