Skip to content

Commit

Permalink
Per [FasterXML#106] added allowNullFields to provide the option of pr…
Browse files Browse the repository at this point in the history
…ocessing null elements of lists as empty fields or the nullCharacter during serialization instead of the default behavior which skips null elements.
  • Loading branch information
morbrian committed Jan 1, 2016
1 parent b6c7a0a commit 106f33b
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ public void testCustomNullValueInObjectListIssue106() throws Exception

String result = mapper.writer(schema).writeValueAsString(list);
assertEquals("d0,n/a,d2\n", result);

list = Arrays.asList(null, "d1", "d2");
result = mapper.writer(schema).writeValueAsString(list);
assertEquals("n/a,d1,d2\n", result);

list = Arrays.asList("d0", "d1", null);
result = mapper.writer(schema).writeValueAsString(list);
assertEquals("d0,d1,n/a\n", result);
}

public void testDefaultNullValueInObjectListIssue106() throws Exception
Expand All @@ -104,8 +112,15 @@ public void testDefaultNullValueInObjectListIssue106() throws Exception
.build();

List list = Arrays.asList("d0", null, "d2");

String result = mapper.writer(schema).writeValueAsString(list);
assertEquals("d0,,d2\n", result);

list = Arrays.asList(null, "d1", "d2");
result = mapper.writer(schema).writeValueAsString(list);
assertEquals(",d1,d2\n", result);

list = Arrays.asList("d0", "d1", null);
result = mapper.writer(schema).writeValueAsString(list);
assertEquals("d0,d1,\n", result);
}
}

0 comments on commit 106f33b

Please sign in to comment.