-
-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a failing test for #463 -- fix will be in Woodstox 6.2.5 when rel…
…eased
- Loading branch information
1 parent
9369bec
commit 91a4f32
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
...test/java/com/fasterxml/jackson/dataformat/xml/failing/XmlParserErrorHandling463Test.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,27 @@ | ||
package com.fasterxml.jackson.dataformat.xml.failing; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
|
||
import com.fasterxml.jackson.core.exc.StreamReadException; | ||
import com.fasterxml.jackson.dataformat.xml.XmlMapper; | ||
import com.fasterxml.jackson.dataformat.xml.XmlTestBase; | ||
|
||
// [dataformat-xml#463] | ||
// (but root cause of https://github.com/FasterXML/woodstox/issues/123) | ||
public class XmlParserErrorHandling463Test extends XmlTestBase | ||
{ | ||
private final XmlMapper MAPPER = newMapper(); | ||
|
||
public void testInvalidXmlDecl() throws Exception | ||
{ | ||
final byte[] doc = "<?xml version=\"1.1\" encoding=\"U\"?>".getBytes(StandardCharsets.UTF_8); | ||
try { | ||
MAPPER.readTree(doc); | ||
fail("Should not pass"); | ||
} catch (StreamReadException e) { | ||
verifyException(e, "Unsupported encoding: U"); | ||
} catch (RuntimeException e) { | ||
fail("Should fail with specific `StreamReadException` but got: "+e); | ||
} | ||
} | ||
} |