@Test public void givenLocalDate_shouldSerialize() throws ParseException { String expectedJson = "{\"year\":2017,\"month\":12,\"day\":25}"; String actualJson = new GsonBuilder().create().toJson(new AllDateTypes().getLocalDate()); assertThat(actualJson).isEqualTo(expectedJson); }
public LocalDate getLocalDate() { return localDate; }
AllDateTypes { public LocalDate getLocalDate() { return localDate; } }
AllDateTypes { public LocalDate getLocalDate() { return localDate; } AllDateTypes(); }
AllDateTypes { public LocalDate getLocalDate() { return localDate; } AllDateTypes(); Date getDate(); void setDate(Date date); LocalDate getLocalDate(); void setLocalDate(LocalDate localDate); LocalDateTime getLocalDateTime(); void setLocalDateTime(LocalDateTime localDateTime); DayOfWeek getDayOfWeek(); void setDayOfWeek(DayOfWeek dayOfWeek); LocalTime getSixThirty(); void setSixThirty(LocalTime sixThirty); ZoneId getZoneId(); void setZoneId(ZoneId zoneId); ZonedDateTime getZonedDateTime(); void setZonedDateTime(ZonedDateTime zonedDateTime); ZoneOffset getOffset(); void setOffset(ZoneOffset offset); OffsetDateTime getOffsetDateTime(); void setOffsetDateTime(OffsetDateTime offsetDateTime); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
AllDateTypes { public LocalDate getLocalDate() { return localDate; } AllDateTypes(); Date getDate(); void setDate(Date date); LocalDate getLocalDate(); void setLocalDate(LocalDate localDate); LocalDateTime getLocalDateTime(); void setLocalDateTime(LocalDateTime localDateTime); DayOfWeek getDayOfWeek(); void setDayOfWeek(DayOfWeek dayOfWeek); LocalTime getSixThirty(); void setSixThirty(LocalTime sixThirty); ZoneId getZoneId(); void setZoneId(ZoneId zoneId); ZonedDateTime getZonedDateTime(); void setZonedDateTime(ZonedDateTime zonedDateTime); ZoneOffset getOffset(); void setOffset(ZoneOffset offset); OffsetDateTime getOffsetDateTime(); void setOffsetDateTime(OffsetDateTime offsetDateTime); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }