PreviewDTO { @VisibleForTesting public static PreviewDTO of(String value) { return new PreviewDTO(value); } private  PreviewDTO(String value); static PreviewDTO from(Optional<Preview> preview); @VisibleForTesting static PreviewDTO of(String value); @JsonValue String getValue(); @Override final boolean equals(Object o); @Override final int hashCode(); @Override String toString(); static final PreviewDTO NO_BODY; }
@Test void ofShouldReturnPreviewWithTheValue() { assertThat(PreviewDTO.of(SAMPLE_PREVIEW_VALUE)) .isEqualTo(PreviewDTO.of(SAMPLE_PREVIEW_VALUE)); }
@Test void ofShouldReturnNoBodyWhenPreviewOfEmptyString() { assertThat(PreviewDTO.of("")) .isEqualTo(PreviewDTO.of(EMPTY_PREVIEW)); }