-
-
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
7fabd98
commit 78448f9
Showing
2 changed files
with
60 additions
and
1 deletion.
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
60 changes: 60 additions & 0 deletions
60
src/test/java/com/fasterxml/jackson/dataformat/xml/failing/ListDeser433Test.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,60 @@ | ||
package com.fasterxml.jackson.dataformat.xml.failing; | ||
|
||
import java.math.BigDecimal; | ||
import java.util.*; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.dataformat.xml.XmlMapper; | ||
import com.fasterxml.jackson.dataformat.xml.XmlTestBase; | ||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; | ||
|
||
// [dataformat-xml#433] | ||
public class ListDeser433Test extends XmlTestBase | ||
{ | ||
@JacksonXmlRootElement(localName = "Product") | ||
static class Product433 { | ||
@JsonProperty("Prices") | ||
public Prices prices; | ||
} | ||
|
||
static class Prices { | ||
@JsonProperty("Price") | ||
public List<Price> price; | ||
|
||
public List<Price> getPrice() { | ||
if (price == null) { | ||
price = new ArrayList<Price>(); | ||
} | ||
return this.price; | ||
} | ||
} | ||
|
||
static class Price { | ||
@JsonProperty("Start") | ||
public Integer start; | ||
@JsonProperty("End") | ||
public Integer end; | ||
@JsonProperty("Price") | ||
public BigDecimal price; | ||
} | ||
|
||
private final XmlMapper MAPPER = mapperBuilder() | ||
.defaultUseWrapper(false) | ||
// .annotationIntrospector(new XmlJaxbAnnotationIntrospector(TypeFactory.defaultInstance())) | ||
.build(); | ||
|
||
// [dataformat-xml#433] | ||
public void testIssue433() throws Exception { | ||
final String XML = | ||
"<Product>\n" + | ||
" <Price>\n" + | ||
" <Start>50</Start>\n" + | ||
" <End>99</End>\n" + | ||
" <Price>2.53</Price>\n" + | ||
" </Price>\n" + | ||
"</Product>"; | ||
|
||
Product433 main = MAPPER.readValue(XML, Product433.class); | ||
assertNotNull(main); | ||
} | ||
} |