diff --git a/src/test/java/com/fasterxml/jackson/databind/BaseMapTest.java b/src/test/java/com/fasterxml/jackson/databind/BaseMapTest.java index 3cdc9e6391..c31bb25ce9 100644 --- a/src/test/java/com/fasterxml/jackson/databind/BaseMapTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/BaseMapTest.java @@ -82,7 +82,7 @@ public StringWrapper(String value) { } protected static class ObjectWrapper { - private final Object object; + final Object object; protected ObjectWrapper(final Object object) { this.object = object; } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UntypedDeserializationTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UntypedDeserializationTest.java index 55fbf57671..2271ff6485 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UntypedDeserializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UntypedDeserializationTest.java @@ -96,20 +96,24 @@ public Map deserialize(JsonParser p, DeserializationContext ctxt) } } - static class Untyped989 { + static class DelegatingUntyped { protected Object value; @JsonCreator // delegating - public Untyped989(Object v) { + public DelegatingUntyped(Object v) { value = v; } } - static class WrappedUntyped { + static class WrappedPolymorphicUntyped { @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS) public Object value; } + static class WrappedUntyped1460 { + public Object value; + } + /* /********************************************************** /* Test methods @@ -272,11 +276,11 @@ public void testNonVanilla() throws IOException assertTrue(l.get(0) instanceof Map); assertTrue(l.get(1) instanceof List); - ObjectReader rDefault = mapper.readerFor(WrappedUntyped.class); + ObjectReader rDefault = mapper.readerFor(WrappedPolymorphicUntyped.class); ObjectReader rAlt = rDefault .with(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS, DeserializationFeature.USE_BIG_INTEGER_FOR_INTS); - WrappedUntyped w; + WrappedPolymorphicUntyped w; w = rDefault.readValue(aposToQuotes("{'value':10}")); assertEquals(Integer.valueOf(10), w.value); @@ -340,8 +344,8 @@ public void testUntypedWithMapDeser() throws IOException public void testNestedUntyped989() throws IOException { - Untyped989 pojo; - ObjectReader r = MAPPER.readerFor(Untyped989.class); + DelegatingUntyped pojo; + ObjectReader r = MAPPER.readerFor(DelegatingUntyped.class); pojo = r.readValue("[]"); assertTrue(pojo.value instanceof List); @@ -365,4 +369,17 @@ public void testUntypedWithJsonArrays() throws Exception ob = MAPPER.readValue("[1]", Object.class); assertEquals(Object[].class, ob.getClass()); } + + public void testUntypedIntAsLong() throws Exception + { + final String JSON = aposToQuotes("{'value':3}"); + WrappedUntyped1460 w = MAPPER.readerFor(WrappedUntyped1460.class) + .readValue(JSON); + assertEquals(Integer.valueOf(3), w.value); + + w = MAPPER.readerFor(WrappedUntyped1460.class) + .with(DeserializationFeature.USE_LONG_FOR_INTS) + .readValue(JSON); + assertEquals(Long.valueOf(3), w.value); + } }