88import com .fasterxml .jackson .databind .annotation .JsonDeserialize ;
99
1010import static org .junit .jupiter .api .Assertions .assertEquals ;
11+ import static org .junit .jupiter .api .Assertions .assertNull ;
1112
1213import static com .fasterxml .jackson .databind .testutil .DatabindTestUtil .a2q ;
1314
@@ -51,9 +52,9 @@ public ValueClassXY build() {
5152 @ JsonDeserialize (builder =CreatorBuilderXY .class )
5253 static class CreatorValueXY
5354 {
54- final int _x , _y ;
55+ final Integer _x , _y ;
5556
56- protected CreatorValueXY (int x , int y ) {
57+ protected CreatorValueXY (Integer x , Integer y ) {
5758 _x = x ;
5859 _y = y ;
5960 }
@@ -62,11 +63,11 @@ protected CreatorValueXY(int x, int y) {
6263 @ JsonIgnoreProperties ({ "bogus" })
6364 static class CreatorBuilderXY
6465 {
65- public int x , y ;
66+ public Integer x , y ;
6667
6768 @ JsonCreator
68- public CreatorBuilderXY (@ JsonProperty ("x" ) @ JsonView (ViewX .class ) int x ,
69- @ JsonProperty ("y" ) @ JsonView (ViewY .class ) int y )
69+ public CreatorBuilderXY (@ JsonProperty ("x" ) @ JsonView (ViewX .class ) Integer x ,
70+ @ JsonProperty ("y" ) @ JsonView (ViewY .class ) Integer y )
7071 {
7172 this .x = x ;
7273 this .y = y ;
@@ -110,12 +111,12 @@ public void testCreatorViews() throws Exception
110111 .withView (ViewX .class )
111112 .readValue (json );
112113 assertEquals (5 , resultX ._x );
113- assertEquals ( 0 , resultX ._y );
114+ assertNull ( resultX ._y );
114115
115116 CreatorValueXY resultY = MAPPER .readerFor (CreatorValueXY .class )
116117 .withView (ViewY .class )
117118 .readValue (json );
118- assertEquals ( 0 , resultY ._x );
119+ assertNull ( resultY ._x );
119120 assertEquals (10 , resultY ._y );
120121 }
121122}
0 commit comments