-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
.../test/java/tools/jackson/dataformat/csv/failing/MissingNullsOnObjectArrayWrite10Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package tools.jackson.dataformat.csv.failing; | ||
|
||
import java.io.StringWriter; | ||
|
||
import tools.jackson.databind.ObjectWriter; | ||
import tools.jackson.databind.SequenceWriter; | ||
import tools.jackson.dataformat.csv.CsvMapper; | ||
import tools.jackson.dataformat.csv.CsvSchema; | ||
import tools.jackson.dataformat.csv.ModuleTestBase; | ||
|
||
public class MissingNullsOnObjectArrayWrite10Test extends ModuleTestBase | ||
{ | ||
private final CsvMapper MAPPER = mapperForCsv(); | ||
|
||
// for [dataformats-text#10] | ||
public void testNullsOnObjectArrayWrites2Col() throws Exception | ||
{ | ||
CsvSchema schema = CsvSchema.builder() | ||
.addColumn("a", CsvSchema.ColumnType.NUMBER) | ||
.addColumn("b", CsvSchema.ColumnType.NUMBER) | ||
.setUseHeader(true) | ||
.build(); | ||
ObjectWriter writer = MAPPER.writer(schema); | ||
StringWriter out = new StringWriter(); | ||
SequenceWriter sequence = writer.writeValues(out); | ||
|
||
sequence.write(new Object[]{ null, 2 }); | ||
sequence.write(new Object[]{ null, null }); | ||
sequence.write(new Object[]{ 1, null }); | ||
|
||
final String csv = out.toString().trim(); | ||
|
||
assertEquals("\"a\",\"b\"\n" + | ||
",2\n" + | ||
",\n" + | ||
"1,", | ||
csv); | ||
} | ||
} |