This repository has been archived by the owner on Jan 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
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
1 parent
1c60e9d
commit c2c83f8
Showing
4 changed files
with
124 additions
and
58 deletions.
There are no files selected for viewing
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
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
35 changes: 35 additions & 0 deletions
35
src/test/java/com/fasterxml/jackson/dataformat/csv/GeneratorIgnoreUnknownTest.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,35 @@ | ||
package com.fasterxml.jackson.dataformat.csv; | ||
|
||
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
import com.fasterxml.jackson.core.JsonGenerator; | ||
import com.fasterxml.jackson.databind.*; | ||
|
||
public class GeneratorIgnoreUnknownTest extends ModuleTestBase | ||
{ | ||
@JsonPropertyOrder({ "x", "y", "z" }) | ||
public static class Point { | ||
public int x; | ||
public Integer y; | ||
public Integer z = 8; | ||
} | ||
|
||
/* | ||
/********************************************************** | ||
/* Test methods | ||
/********************************************************** | ||
*/ | ||
|
||
public void testSimpleIgnore() throws Exception | ||
{ | ||
ObjectMapper mapper = mapperForCsv(); | ||
final CsvSchema schema = CsvSchema.builder() | ||
.addColumn("x") | ||
.addColumn("z") | ||
.build(); | ||
ObjectWriter writer = mapper.writerWithType(Point.class) | ||
.withSchema(schema) | ||
.with(JsonGenerator.Feature.IGNORE_UNKNOWN); | ||
String csv = writer.writeValueAsString(new Point()); | ||
assertNotNull(csv); | ||
} | ||
} |
Oops, something went wrong.