Skip to content

Commit fbfc3cd

Browse files
committed
Robustify a test wrt primitive nulls
1 parent 74dc786 commit fbfc3cd

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/test/java/com/fasterxml/jackson/databind/views/ViewDeserializationTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ static class DefaultsBean
4545
static class ViewsAndCreatorBean
4646
{
4747
@JsonView(ViewA.class)
48-
public int a;
48+
public Integer a;
4949

5050
@JsonView(ViewB.class)
51-
public int b;
51+
public Integer b;
5252

5353
@JsonCreator
54-
public ViewsAndCreatorBean(@JsonProperty("a") int a,
55-
@JsonProperty("b") int b)
54+
public ViewsAndCreatorBean(@JsonProperty("a") Integer a,
55+
@JsonProperty("b") Integer b)
5656
{
5757
this.a = a;
5858
this.b = b;
@@ -133,19 +133,19 @@ public void testWithCreatorAndViews() throws Exception
133133
.withView(ViewA.class)
134134
.readValue(a2q("{'a':1,'b':2}"));
135135
assertEquals(1, result.a);
136-
assertEquals(0, result.b);
136+
assertEquals(null, result.b);
137137

138138
result = mapper.readerFor(ViewsAndCreatorBean.class)
139139
.withView(ViewB.class)
140140
.readValue(a2q("{'a':1,'b':2}"));
141-
assertEquals(0, result.a);
141+
assertEquals(null, result.a);
142142
assertEquals(2, result.b);
143143

144144
// and actually... fine to skip incompatible stuff too
145145
result = mapper.readerFor(ViewsAndCreatorBean.class)
146146
.withView(ViewB.class)
147147
.readValue(a2q("{'a':[ 1, 23, { } ],'b':2}"));
148-
assertEquals(0, result.a);
148+
assertEquals(null, result.a);
149149
assertEquals(2, result.b);
150150
}
151151
}

0 commit comments

Comments
 (0)