-
-
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
e29a1dd
commit 54a72b5
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
.../java/com/fasterxml/jackson/dataformat/xml/deser/creator/NestedSingleArgCtors547Test.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,58 @@ | ||
package com.fasterxml.jackson.dataformat.xml.deser.creator; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import com.fasterxml.jackson.dataformat.xml.XmlMapper; | ||
import com.fasterxml.jackson.dataformat.xml.XmlTestBase; | ||
|
||
public class NestedSingleArgCtors547Test extends XmlTestBase | ||
{ | ||
private static final XmlMapper XML_MAPPER = newMapper(); | ||
|
||
static class Outer547Del { | ||
public Inner547Del inner; | ||
} | ||
|
||
static class Inner547Del { | ||
protected String value; | ||
|
||
@JsonCreator(mode = JsonCreator.Mode.DELEGATING) | ||
public Inner547Del(@JsonProperty("value") String v) { | ||
value = v; | ||
} | ||
} | ||
|
||
static class Outer547Props { | ||
public Inner547Props inner; | ||
} | ||
|
||
static class Inner547Props { | ||
protected String value; | ||
|
||
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES) | ||
public Inner547Props(@JsonProperty("value") String v) { | ||
value = v; | ||
} | ||
|
||
protected Inner547Props() { } | ||
} | ||
|
||
// [dataformat-xml#547] | ||
public void testNested1ArgCtorsDelegating() throws Exception | ||
{ | ||
String xml = "<outer><inner></inner></outer>"; | ||
Outer547Del result = XML_MAPPER.readValue(xml, Outer547Del.class); | ||
assertNotNull(result.inner); | ||
assertEquals("", result.inner.value); | ||
} | ||
|
||
// [dataformat-xml#547] | ||
public void testNested1ArgCtorsProps() throws Exception | ||
{ | ||
String xml = "<outer><inner></inner></outer>"; | ||
Outer547Props result = XML_MAPPER.readValue(xml, Outer547Props.class); | ||
assertNotNull(result.inner); | ||
assertNull(result.inner.value); | ||
} | ||
} |