Skip to content

Commit

Permalink
Merge branch '2.17'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Feb 1, 2024
2 parents 36cb0ee + 3753cd7 commit 5f8e2a4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class IonFuzz_471_66141_AssertionErrorTest
private final ObjectMapper ION_MAPPER = new IonObjectMapper();

@Test
public void testFuzz66077_AssertionError() throws Exception {
public void testFuzz66141_AssertionError() throws Exception {
final byte[] doc = IonFuzzTestUtil.readResource("/data/fuzz-66141.ion");
try {
ION_MAPPER.readValue(doc, java.util.Date.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package tools.jackson.dataformat.ion.failing;

import org.junit.Test;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import tools.jackson.databind.DeserializationFeature;
import tools.jackson.databind.ObjectMapper;

import tools.jackson.dataformat.ion.IonObjectMapper;
import tools.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);
}
}

0 comments on commit 5f8e2a4

Please sign in to comment.