22
33import  org .junit .jupiter .api .Test ;
44
5+ import  com .fasterxml .jackson .databind .DeserializationFeature ;
56import  com .fasterxml .jackson .databind .JsonNode ;
67import  com .fasterxml .jackson .databind .ObjectReader ;
78import  com .fasterxml .jackson .dataformat .xml .XmlMapper ;
@@ -13,7 +14,7 @@ public class XsiNilBasicTest extends XmlTestUtil
1314{
1415    private  final  static  String  XSI_NS_DECL  = "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" ;
1516
16-     protected  static  class  DoubleWrapper  {
17+     public  static  class  DoubleWrapper  {
1718        public  Double  d ;
1819
1920        public  DoubleWrapper () { }
@@ -22,14 +23,17 @@ public DoubleWrapper(Double value) {
2223        }
2324    }
2425
25-     protected  static  class  DoubleWrapper2  {
26+     public  static  class  DoubleWrapper2  {
2627        public  Double  a  = 100.0 ; // init to ensure it gets overwritten 
2728        public  Double  b  = 200.0 ;
2829
2930        public  DoubleWrapper2 () { }
3031    }
3132
32-     private  final  XmlMapper  MAPPER  = newMapper ();
33+     // 30-Jan-2025, tatu: To tease out [dataformat-xml#714] let's do this: 
34+     private  final  XmlMapper  MAPPER  = mapperBuilder ()
35+             .enable (DeserializationFeature .FAIL_ON_TRAILING_TOKENS )
36+             .build ();
3337
3438    @ Test 
3539    public  void  testWithDoubleAsNull () throws  Exception 
@@ -94,6 +98,8 @@ public void testWithDoubleAsMixed() throws Exception
9498        assertEquals (defaultValue .b , bean .b );
9599    }
96100
101+     // [dataformat-xml#714]: trailing END_OBJECT 
102+     /* 
97103    @Test 
98104    public void testRootPojoAsNull() throws Exception 
99105    { 
@@ -102,6 +108,7 @@ public void testRootPojoAsNull() throws Exception
102108                Point.class); 
103109        assertNull(bean); 
104110    } 
111+     */ 
105112
106113    @ Test 
107114    public  void  testRootPojoAsNonNull () throws  Exception 
@@ -142,6 +149,8 @@ public void testDisableXsiNilLeafProcessing() throws Exception
142149
143150    // [dataformat-xml#468]: Allow disabling xsi:nil special handling 
144151
152+     // [dataformat-xml#714]: trailing END_OBJECT 
153+     /* 
145154    @Test 
146155    public void testDisableXsiNilRootProcessing() throws Exception 
147156    { 
@@ -153,10 +162,10 @@ public void testDisableXsiNilRootProcessing() throws Exception
153162
154163        // 07-Jul-2021, tatu: Alas! 2.x sets format feature flags too late to 
155164        //   affect root element (3.0 works correctly). So cannot test 
156- /* 
165+ 
157166        ObjectReader noXsiNilReader = r.without(FromXmlParser.Feature.PROCESS_XSI_NIL); 
158167        assertEquals(a2q("{'nil':'true'}"), 
159168                noXsiNilReader.readValue(DOC).toString()); 
160-                 */ 
161169    } 
170+     */ 
162171}
0 commit comments