Skip to content

Commit f262f71

Browse files
committed
More unit test fixes wrt defaults
1 parent fbfc3cd commit f262f71

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderInfiniteLoop1978Test.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ public class BuilderInfiniteLoop1978Test
1515
static class Builder
1616
{
1717
private SubBean temp;
18-
private int id;
18+
private Integer id;
1919

20-
Builder(@JsonProperty("beanId") int beanId) {
20+
Builder(@JsonProperty("beanId") Integer beanId) {
2121
this.id = beanId;
2222
}
2323

@@ -38,10 +38,10 @@ public Bean build()
3838
@JsonDeserialize(builder = Builder.class)
3939
static class Bean
4040
{
41-
int id;
41+
Integer id;
4242
SubBean thing;
4343

44-
public Bean(int id) {
44+
public Bean(Integer id) {
4545
this.id = id;
4646
}
4747

src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderWithViewTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
99

1010
import static org.junit.jupiter.api.Assertions.assertEquals;
11+
import static org.junit.jupiter.api.Assertions.assertNull;
1112

1213
import 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

Comments
 (0)