File tree 1 file changed +34
-0
lines changed
src/test/java/com/fasterxml/jackson/dataformat/xml/failing
1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .dataformat .xml .failing ;
2
+
3
+ import com .fasterxml .jackson .core .JsonProcessingException ;
4
+ import com .fasterxml .jackson .databind .ObjectMapper ;
5
+ import com .fasterxml .jackson .dataformat .xml .XmlTestBase ;
6
+
7
+ public class VerifyRootLocalName247Test extends XmlTestBase
8
+ {
9
+ static class Root {
10
+ public int value ;
11
+ }
12
+
13
+ /*
14
+ /**********************************************************************
15
+ /* Test methods
16
+ /**********************************************************************
17
+ */
18
+
19
+ private final ObjectMapper MAPPER = newMapper ();
20
+
21
+ public void testRootNameValidation247 () throws Exception
22
+ {
23
+ Root root = MAPPER .readValue ("<Root><value>42</value></Root>" , Root .class );
24
+ assertEquals (42 , root .value );
25
+
26
+ // so far so good. But why no validation for root local name?
27
+ try {
28
+ MAPPER .readValue ("<Boot><value>42</value></Boot>" , Root .class );
29
+ fail ("Should not allow wrong local name!" );
30
+ } catch (JsonProcessingException e ) {
31
+ verifyException (e , "Foobar" );
32
+ }
33
+ }
34
+ }
You can’t perform that action at this time.
0 commit comments