Skip to content

Commit c3e0113

Browse files
committed
Add a passing test for #1460
1 parent fa6f247 commit c3e0113

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

src/test/java/com/fasterxml/jackson/databind/BaseMapTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public StringWrapper(String value) {
8282
}
8383

8484
protected static class ObjectWrapper {
85-
private final Object object;
85+
final Object object;
8686
protected ObjectWrapper(final Object object) {
8787
this.object = object;
8888
}

src/test/java/com/fasterxml/jackson/databind/deser/TestUntypedDeserialization.java

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,19 @@ public Map<String,Object> deserialize(JsonParser jp, DeserializationContext ctxt
9292
}
9393
}
9494

95-
static class Untyped989 {
95+
static class DelegatingUntyped {
9696
protected Object value;
9797

9898
@JsonCreator // delegating
99-
public Untyped989(Object v) {
99+
public DelegatingUntyped(Object v) {
100100
value = v;
101101
}
102102
}
103-
103+
104+
static class WrappedUntyped1460 {
105+
public Object value;
106+
}
107+
104108
/*
105109
/**********************************************************
106110
/* Test methods
@@ -253,8 +257,8 @@ public void testUntypedWithMapDeser() throws IOException
253257

254258
public void testNestedUntyped989() throws IOException
255259
{
256-
Untyped989 pojo;
257-
ObjectReader r = MAPPER.readerFor(Untyped989.class);
260+
DelegatingUntyped pojo;
261+
ObjectReader r = MAPPER.readerFor(DelegatingUntyped.class);
258262

259263
pojo = r.readValue("[]");
260264
assertTrue(pojo.value instanceof List);
@@ -278,4 +282,17 @@ public void testUntypedWithJsonArrays() throws Exception
278282
ob = MAPPER.readValue("[1]", Object.class);
279283
assertEquals(Object[].class, ob.getClass());
280284
}
285+
286+
public void testUntypedIntAsLong() throws Exception
287+
{
288+
final String JSON = aposToQuotes("{'value':3}");
289+
WrappedUntyped1460 w = MAPPER.readerFor(WrappedUntyped1460.class)
290+
.readValue(JSON);
291+
assertEquals(Integer.valueOf(3), w.value);
292+
293+
w = MAPPER.readerFor(WrappedUntyped1460.class)
294+
.with(DeserializationFeature.USE_LONG_FOR_INTS)
295+
.readValue(JSON);
296+
assertEquals(Long.valueOf(3), w.value);
297+
}
281298
}

0 commit comments

Comments
 (0)