Skip to content

Commit

Permalink
Merge branch '2.19'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 6, 2025
2 parents e082e0a + 713401b commit 58dceba
Showing 1 changed file with 39 additions and 0 deletions.
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);
}
}

0 comments on commit 58dceba

Please sign in to comment.