@@ -64,6 +64,19 @@ public Value1654UsingCustomSerDeserUntypedContainer(Value1654... v) {
6464 }
6565 }
6666
67+ static class SingleValue1654UsingCustomSerDeserUntyped {
68+ @ JsonDeserialize (using = Value1654Deserializer .class )
69+ @ JsonSerialize (using = Value1654Serializer .class )
70+ @ JsonTypeInfo (use = JsonTypeInfo .Id .NONE )
71+ public Value1654 value ;
72+
73+ protected SingleValue1654UsingCustomSerDeserUntyped () { }
74+
75+ public SingleValue1654UsingCustomSerDeserUntyped (Value1654 v ) {
76+ value = v ;
77+ }
78+ }
79+
6780 static class Value1654Deserializer extends ValueDeserializer <Value1654 > {
6881 @ Override
6982 public Value1654 deserialize (JsonParser p , DeserializationContext ctxt ) {
@@ -142,7 +155,6 @@ void withNoTypeInfoOverrideSer() throws Exception {
142155 // [databind#1654]: override, no polymorphic type id, custom deserialization
143156 @ Test
144157 void withNoTypeInfoOverrideDeser () throws Exception {
145- // and then actual failing case
146158 final String noTypeJson = a2q (
147159 "{'values':[{'v':3},{'v':7}]}"
148160 );
@@ -153,4 +165,23 @@ void withNoTypeInfoOverrideDeser() throws Exception {
153165 assertEquals (7 , unResult .values .get (1 ).x );
154166 }
155167
168+ // // And then validation for individual value, not in Container
169+
170+ // override, no polymorphic type id, custom serialization
171+ @ Test
172+ void singleWithNoTypeInfoOverrideSer () throws Exception {
173+ SingleValue1654UsingCustomSerDeserUntyped wrapper = new SingleValue1654UsingCustomSerDeserUntyped (
174+ new Value1654 (42 ));
175+ assertEquals (a2q ("{'value':{'v':42}}" ),
176+ MAPPER .writeValueAsString (wrapper ));
177+ }
178+
179+ // override, no polymorphic type id, custom deserialization
180+ @ Test
181+ void singleWithNoTypeInfoOverrideDeser () throws Exception {
182+ String noTypeJson = a2q ("{'value':{'v':42}}" );
183+ SingleValue1654UsingCustomSerDeserUntyped result = MAPPER .readValue (noTypeJson ,
184+ SingleValue1654UsingCustomSerDeserUntyped .class );
185+ assertEquals (42 ,result .value .x );
186+ }
156187}
0 commit comments