Skip to content

Commit dbcfff6

Browse files
committed
Add failing test for #303
1 parent d4b80c5 commit dbcfff6

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.fasterxml.jackson.dataformat.ion.failing;
2+
3+
import java.net.URL;
4+
5+
import org.junit.Test;
6+
7+
import com.fasterxml.jackson.core.JsonProcessingException;
8+
import com.fasterxml.jackson.dataformat.ion.IonObjectMapper;
9+
10+
import static org.junit.Assert.*;
11+
12+
public class UncaughtException303Test
13+
{
14+
private final IonObjectMapper MAPPER = IonObjectMapper.builder().build();
15+
16+
// [dataformats-binary#303]
17+
@Test
18+
public void testUncaughtException303() throws Exception
19+
{
20+
URL poc = getClass().getResource("/data/issue-303.ion");
21+
try {
22+
MAPPER.readTree(poc);
23+
fail("Should not pass with invalid content");
24+
} catch (JsonProcessingException e) {
25+
// !!! TODO: change to match what we actually expect
26+
verifyException(e, "MATCH MESSAGE");
27+
}
28+
}
29+
30+
void verifyException(Throwable e, String match)
31+
{
32+
String msg = e.getMessage();
33+
String lmsg = (msg == null) ? "" : msg.toLowerCase();
34+
if (lmsg.indexOf(match.toLowerCase()) < 0) {
35+
fail("Expected an exception with a substrings ("+match+"): got one with message \""+msg+"\"");
36+
}
37+
}
38+
}

ion/src/test/java/com/fasterxml/jackson/dataformat/ion/misc/UncaughtExceptionsTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.fasterxml.jackson.dataformat.ion.misc;
22

33
import java.net.URL;
4-
import java.util.Arrays;
54

65
import org.junit.Test;
76

56 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)