@Test public void should_Not_Deserialize_Null_Value() throws IOException { Object value = underTest.deserialize(FIELD_NAME, null, parser, context, generator); assertThat(value, nullValue()); verify(generator).writeFieldName(eq(FIELD_NAME)); verify(generator, never()).writeObject(any()); }
public Object deserialize(final String fieldName, final Object defaultValue, final JsonParser parser, final DeserializationContext context, final JsonGenerator generator) throws IOException { generator.writeFieldName(fieldName); Object value; try { value = deserializeValue(defaultValue); } catch (RuntimeException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw e; } if (nonNull(value) || parser.currentTokenId() == ID_NULL) { generator.writeObject(value); } return value; }
NpmFieldDeserializer { public Object deserialize(final String fieldName, final Object defaultValue, final JsonParser parser, final DeserializationContext context, final JsonGenerator generator) throws IOException { generator.writeFieldName(fieldName); Object value; try { value = deserializeValue(defaultValue); } catch (RuntimeException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw e; } if (nonNull(value) || parser.currentTokenId() == ID_NULL) { generator.writeObject(value); } return value; } }
NpmFieldDeserializer { public Object deserialize(final String fieldName, final Object defaultValue, final JsonParser parser, final DeserializationContext context, final JsonGenerator generator) throws IOException { generator.writeFieldName(fieldName); Object value; try { value = deserializeValue(defaultValue); } catch (RuntimeException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw e; } if (nonNull(value) || parser.currentTokenId() == ID_NULL) { generator.writeObject(value); } return value; }  }
NpmFieldDeserializer { public Object deserialize(final String fieldName, final Object defaultValue, final JsonParser parser, final DeserializationContext context, final JsonGenerator generator) throws IOException { generator.writeFieldName(fieldName); Object value; try { value = deserializeValue(defaultValue); } catch (RuntimeException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw e; } if (nonNull(value) || parser.currentTokenId() == ID_NULL) { generator.writeObject(value); } return value; }  Object deserialize(final String fieldName,
                            final Object defaultValue,
                            final JsonParser parser,
                            final DeserializationContext context,
                            final JsonGenerator generator); }
NpmFieldDeserializer { public Object deserialize(final String fieldName, final Object defaultValue, final JsonParser parser, final DeserializationContext context, final JsonGenerator generator) throws IOException { generator.writeFieldName(fieldName); Object value; try { value = deserializeValue(defaultValue); } catch (RuntimeException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw e; } if (nonNull(value) || parser.currentTokenId() == ID_NULL) { generator.writeObject(value); } return value; }  Object deserialize(final String fieldName,
                            final Object defaultValue,
                            final JsonParser parser,
                            final DeserializationContext context,
                            final JsonGenerator generator);  }