UntypedObjectDeserializerSerializer extends UntypedObjectDeserializer { protected final Object defaultDeserialize(final String fieldName, final JsonParser parser, final DeserializationContext context) throws IOException { if (nonNull(fieldName)) { generator.writeFieldName(fieldName); } Object value = defaultValueDeserialize(parser, context); if (nonNull(value) || parser.currentTokenId() == ID_NULL) { generator.writeObject(value); } return value; } UntypedObjectDeserializerSerializer(final JsonGenerator generator); @Override @Nullable Object deserialize(final JsonParser parser, final DeserializationContext context);  }
@Test public void serializes_During_DefaultDeserialize() throws IOException { Object deserializedValue = underTest.defaultDeserialize(FIELD_NAME, parser, context); assertThat(deserializedValue, equalTo(FIELD_VALUE)); verify(generator).writeFieldName(eq(FIELD_NAME)); verify(generator).writeObject(eq(FIELD_VALUE)); }