-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
8c91746
commit 3753cd7
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
ion/src/test/java/com/fasterxml/jackson/dataformat/ion/failing/IonTimestampDeser251Test.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,47 @@ | ||
package com.fasterxml.jackson.dataformat.ion.failing; | ||
|
||
import org.junit.Test; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.DeserializationFeature; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.dataformat.ion.IonObjectMapper; | ||
import com.fasterxml.jackson.dataformat.ion.ionvalue.IonValueModule; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
// For [dataformats-binary#251] | ||
public class IonTimestampDeser251Test | ||
{ | ||
static class Message { | ||
final String message; | ||
final Integer count; | ||
|
||
@JsonCreator | ||
public Message(@JsonProperty("message") String message, | ||
@JsonProperty("count") Integer count) { | ||
this.message = message; | ||
this.count = count; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
} | ||
|
||
private final ObjectMapper ION_MAPPER = IonObjectMapper.builder() | ||
.addModule(new IonValueModule()) | ||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) | ||
.build(); | ||
|
||
// [dataformats-binary#251] | ||
@Test | ||
public void testTimestampDeserWithBuffering() throws Exception { | ||
String ion = "{message: \"Hello, world\", timestamp:2021-03-10T01:49:30.242-00:00}"; | ||
Message message = ION_MAPPER.readValue(ion, Message.class); | ||
assertNotNull(message); | ||
assertEquals("Hello, world", message.message); | ||
} | ||
} |