-
-
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
4f7255f
commit ebc13fd
Showing
2 changed files
with
68 additions
and
10 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
41 changes: 41 additions & 0 deletions
41
src/test/java/com/fasterxml/jackson/dataformat/xml/lists/TestWrappedLists.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.lists; | ||
|
||
import java.util.*; | ||
|
||
import com.fasterxml.jackson.dataformat.xml.XmlMapper; | ||
import com.fasterxml.jackson.dataformat.xml.XmlTestBase; | ||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; | ||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; | ||
|
||
public class TestWrappedLists extends XmlTestBase | ||
{ | ||
static class Order { | ||
@JacksonXmlElementWrapper(localName = "line_items") | ||
@JacksonXmlProperty(localName = "item") | ||
private List<ListItem> line_items; // new ArrayList<ListItem>(); | ||
} | ||
|
||
static class ListItem { | ||
public int id; | ||
|
||
public ListItem(int id) { this.id = id; } | ||
} | ||
|
||
/* | ||
/********************************************************** | ||
/* Unit tests | ||
/********************************************************** | ||
*/ | ||
|
||
private final XmlMapper MAPPER = xmlMapper(true); | ||
|
||
/* For [Issue#103] | ||
*/ | ||
public void testEmptyList() throws Exception | ||
{ | ||
String xml = MAPPER.writeValueAsString(new Order()); | ||
assertEquals("<Order/>", xml); | ||
// If we expected Empty list, it'd be: | ||
// assertEquals("<Order><line_items/></Order>", xml); | ||
} | ||
} |