File tree 2 files changed +32
-2
lines changed
src/test/java/com/fasterxml/jackson/dataformat/xml
2 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ public String toString() {
197
197
+" }"
198
198
+"}"
199
199
;
200
-
200
+
201
201
/*
202
202
/**********************************************************
203
203
/* Construction, factory methods
@@ -211,7 +211,7 @@ protected XmlTestBase() {
211
211
protected XmlFactoryBuilder streamFactoryBuilder () {
212
212
return XmlFactory .builder ();
213
213
}
214
-
214
+
215
215
protected static XmlMapper newMapper () {
216
216
return new XmlMapper ();
217
217
}
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .dataformat .xml .failing ;
2
+
3
+ import com .fasterxml .jackson .annotation .JsonRootName ;
4
+ import com .fasterxml .jackson .databind .DeserializationFeature ;
5
+ import com .fasterxml .jackson .databind .SerializationFeature ;
6
+ import com .fasterxml .jackson .dataformat .xml .*;
7
+ import com .fasterxml .jackson .dataformat .xml .annotation .JacksonXmlRootElement ;
8
+
9
+ public class Unwrapped374Test extends XmlTestBase
10
+ {
11
+ @ JacksonXmlRootElement (localName = "Root" )
12
+ @ JsonRootName ("Root" )
13
+ static class Root {
14
+ public int id = 1 ;
15
+ }
16
+
17
+ private final XmlMapper MAPPER = mapperBuilder ()
18
+ .enable (SerializationFeature .WRAP_ROOT_VALUE )
19
+ .enable (DeserializationFeature .UNWRAP_ROOT_VALUE )
20
+ .build ();
21
+
22
+ public void testUnwrappedRoundTrip () throws Exception
23
+ {
24
+ String xml = MAPPER .writeValueAsString (new Root ());
25
+ System .err .println ("XML: " +xml );
26
+ // assertEquals("<Root><id>hello</id></Root>", xml);
27
+ Root result = MAPPER .readValue (xml , Root .class );
28
+ assertNotNull (result );
29
+ }
30
+ }
You can’t perform that action at this time.
0 commit comments