@Test(dataProvider = "serializeDP") public void serialize(Date date, String expectedOutput) { assertEquals(testling.serialize(date, Date.class, jsonSerializationContext).toString(), expectedOutput); verify(jsonSerializationContext, times(date != null ? 1 : 0)).serialize(any(), eq(DateTime.class)); }
@Override public JsonElement serialize(final Date src, final Type typeOfSrc, final JsonSerializationContext context) { return src == null ? new JsonPrimitive(StringUtils.EMPTY) : context.serialize(new DateTime(src.getTime()), DateTime.class); }
DateSerializer implements JsonSerializer<Date> { @Override public JsonElement serialize(final Date src, final Type typeOfSrc, final JsonSerializationContext context) { return src == null ? new JsonPrimitive(StringUtils.EMPTY) : context.serialize(new DateTime(src.getTime()), DateTime.class); } }
DateSerializer implements JsonSerializer<Date> { @Override public JsonElement serialize(final Date src, final Type typeOfSrc, final JsonSerializationContext context) { return src == null ? new JsonPrimitive(StringUtils.EMPTY) : context.serialize(new DateTime(src.getTime()), DateTime.class); }  }
DateSerializer implements JsonSerializer<Date> { @Override public JsonElement serialize(final Date src, final Type typeOfSrc, final JsonSerializationContext context) { return src == null ? new JsonPrimitive(StringUtils.EMPTY) : context.serialize(new DateTime(src.getTime()), DateTime.class); }  @Override JsonElement serialize(final Date src, final Type typeOfSrc, final JsonSerializationContext context); }
DateSerializer implements JsonSerializer<Date> { @Override public JsonElement serialize(final Date src, final Type typeOfSrc, final JsonSerializationContext context) { return src == null ? new JsonPrimitive(StringUtils.EMPTY) : context.serialize(new DateTime(src.getTime()), DateTime.class); }  @Override JsonElement serialize(final Date src, final Type typeOfSrc, final JsonSerializationContext context);  }