-
-
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.
- Loading branch information
1 parent
af5a9fb
commit 85a7f10
Showing
3 changed files
with
69 additions
and
5 deletions.
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
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
41 changes: 41 additions & 0 deletions
41
src/test/java/com/fasterxml/jackson/dataformat/xml/failing/XsiNil378Test.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,41 @@ | ||
package com.fasterxml.jackson.dataformat.xml.failing; | ||
|
||
import com.fasterxml.jackson.dataformat.xml.XmlMapper; | ||
import com.fasterxml.jackson.dataformat.xml.XmlTestBase; | ||
|
||
public class XsiNil378Test extends XmlTestBase | ||
{ | ||
private final static String XSI_NS_DECL = "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"; | ||
|
||
protected static class StringPair { | ||
public String first, second; | ||
} | ||
|
||
private final XmlMapper MAPPER = newMapper(); | ||
|
||
// [dataformat-xml#378] | ||
public void testWithStringAsNull() throws Exception | ||
{ | ||
StringPair bean; | ||
|
||
bean = MAPPER.readValue( | ||
"<StringPair "+XSI_NS_DECL+"><first>not null</first><second xsi:nil='true' /></StringPair>", | ||
StringPair.class); | ||
assertNotNull(bean); | ||
assertEquals("not null", bean.first); | ||
assertNull(bean.second); | ||
} | ||
|
||
// [dataformat-xml#378] | ||
public void testWithStringAsNull2() throws Exception | ||
{ | ||
StringPair bean; | ||
|
||
bean = MAPPER.readValue( | ||
"<StringPair "+XSI_NS_DECL+"><first xsi:nil='true' /><second>not null</second></StringPair>", | ||
StringPair.class); | ||
assertNotNull(bean); | ||
assertNull(bean.first); | ||
assertEquals("not null", bean.second); | ||
} | ||
} |