-
-
Notifications
You must be signed in to change notification settings - Fork 220
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
c7a2478
commit c801a96
Showing
4 changed files
with
50 additions
and
7 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
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
36 changes: 36 additions & 0 deletions
36
src/test/java/com/fasterxml/jackson/dataformat/xml/failing/XsiNil354Test.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,36 @@ | ||
package com.fasterxml.jackson.dataformat.xml.failing; | ||
|
||
import com.fasterxml.jackson.dataformat.xml.XmlMapper; | ||
import com.fasterxml.jackson.dataformat.xml.XmlTestBase; | ||
|
||
public class XsiNil354Test extends XmlTestBase | ||
{ | ||
protected static class DoubleWrapper { | ||
public Double d; | ||
|
||
public DoubleWrapper() { } | ||
public DoubleWrapper(Double value) { | ||
d = value; | ||
} | ||
} | ||
|
||
private final XmlMapper MAPPER = newMapper(); | ||
|
||
public void testWithDoubleAsNull() throws Exception | ||
{ | ||
DoubleWrapper bean = MAPPER.readValue( | ||
"<DoubleWrapper xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><d xsi:nil='true'></DoubleWrapper>", | ||
DoubleWrapper.class); | ||
assertNotNull(bean); | ||
assertNull(bean.d); | ||
} | ||
|
||
public void testWithDoubleAsNonNull() throws Exception | ||
{ | ||
DoubleWrapper bean = MAPPER.readValue( | ||
"<DoubleWrapper xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><d xsi:nil='false'>0.25</DoubleWrapper>", | ||
DoubleWrapper.class); | ||
assertNotNull(bean); | ||
assertEquals(Double.valueOf(0.25), bean.d); | ||
} | ||
} |