Notification implements Comparable<Notification> { @Override public String toString() { return new StringJoiner(", ", Notification.class.getSimpleName() + "{", "}") .add("id=" + id) .add("category=" + category) .add("message=" + message) .add("createdAt=" + createdAt) .add("unseen=" + unseen) .add("properties=" + properties) .add("notifications=" + notifications) .toString(); } @JsonCreator private  Notification(
      @JsonProperty("category") final String category,
      @JsonProperty("message") final String message); private  Notification(final Builder builder); static Builder builder(final String category, final String message); static Builder builder(final String category); static Builder builder(); static Builder builder(final Notification other); static Notification create(final String id); @JsonProperty Optional<String> getId(); @JsonIgnore String getId(final String value); @JsonProperty String getCategory(); @JsonProperty String getMessage(); @JsonProperty ZonedDateTime getCreatedAt(); @JsonProperty Optional<Boolean> getUnseen(); @JsonProperty Map<String, String> getProperties(); @JsonProperty Collection<Notification> getNotifications(); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString(); @Override int compareTo(final Notification that); static final int CATEGORY_MIN_LENGTH; static final int CATEGORY_MAX_LENGTH; static final int MESSAGE_MIN_LENGTH; static final int MESSAGE_MAX_LENGTH; }
@Test public void testToString() throws Exception { final ZonedDateTime now = ZonedDateTime.parse("2015-08-14T21:25:19.533Z"); final Notification n1 = Notification.builder("test-category", "").withId("1").withCreatedAt(now).build(); assertThat(n1.toString()) .isEqualTo( "Notification{id=Optional[1]," + " category=test-category, message=," + " createdAt=2015-08-14T21:25:19.533Z, unseen=Optional.empty," + " properties={}, notifications=[]}"); }