-
-
Notifications
You must be signed in to change notification settings - Fork 138
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
aa043df
commit d4b80c5
Showing
5 changed files
with
61 additions
and
1 deletion.
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
42 changes: 42 additions & 0 deletions
42
ion/src/test/java/com/fasterxml/jackson/dataformat/ion/misc/UncaughtExceptionsTest.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,42 @@ | ||
package com.fasterxml.jackson.dataformat.ion.misc; | ||
|
||
import java.net.URL; | ||
import java.util.Arrays; | ||
|
||
import org.junit.Test; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.dataformat.ion.IonObjectMapper; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* A set of unit tests for reported issues where implementation does | ||
* not catch exceptions like {@link NullPointerException} where it should. | ||
*/ | ||
public class UncaughtExceptionsTest | ||
{ | ||
private final IonObjectMapper MAPPER = IonObjectMapper.builder().build(); | ||
|
||
// [dataformats-binary#302] | ||
@Test | ||
public void testUncaughtException302() throws Exception | ||
{ | ||
URL poc = getClass().getResource("/data/issue-302.ion"); | ||
try { | ||
MAPPER.readTree(poc); | ||
fail("Should not pass with invalid content"); | ||
} catch (JsonProcessingException e) { | ||
verifyException(e, "Invalid embedded TIMESTAMP"); | ||
} | ||
} | ||
|
||
void verifyException(Throwable e, String match) | ||
{ | ||
String msg = e.getMessage(); | ||
String lmsg = (msg == null) ? "" : msg.toLowerCase(); | ||
if (lmsg.indexOf(match.toLowerCase()) < 0) { | ||
fail("Expected an exception with a substrings ("+match+"): got one with message \""+msg+"\""); | ||
} | ||
} | ||
} |
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 @@ | ||
(=V(#252222(=V(#252222(2_222-11-93((-84(22000n23mlock($0c |
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