Skip to content

Commit 6459114

Browse files
committed
Add a unit test wrt #91
1 parent d4210be commit 6459114

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.fasterxml.jackson.dataformat.xml.failing;
2+
3+
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
4+
5+
import com.fasterxml.jackson.dataformat.xml.*;
6+
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
7+
8+
public class TestOrderingIssue91 extends XmlTestBase
9+
{
10+
@JsonPropertyOrder({"a", "c" })
11+
static class Bean91 {
12+
public String a;
13+
@JacksonXmlProperty(isAttribute = true)
14+
public String b;
15+
public String c;
16+
17+
public Bean91(String a, String b, String c) {
18+
this.a = a;
19+
this.b = b;
20+
this.c = c;
21+
}
22+
}
23+
24+
public void testOrdering() throws Exception
25+
{
26+
XmlMapper xmlMapper = new XmlMapper();
27+
String xml = xmlMapper.writeValueAsString(new Bean91("1", "2", "3"));
28+
assertEquals("<Bean91 b=\"2\"><a>1</a><c>3</c></Bean91>", xml);
29+
}
30+
}

0 commit comments

Comments
 (0)