### Question:
BaseSearchResult implements Serializable { @Override public String toString() { try { return GenieObjectMapper.getMapper().writeValueAsString(this); } catch (final JsonProcessingException ioe) { return ioe.getLocalizedMessage(); } } @JsonCreator  BaseSearchResult(
        @NotBlank @JsonProperty(value = "id", required = true) final String id,
        @NotBlank @JsonProperty(value = "name", required = true) final String name,
        @NotBlank @JsonProperty(value = "user", required = true) final String user
    ); @Override String toString();  }### Answer:
@Test void canConstruct() { final String id = UUID.randomUUID().toString(); final String name = UUID.randomUUID().toString(); final String user = UUID.randomUUID().toString(); final BaseSearchResult searchResult = new BaseSearchResult(id, name, user); Assertions.assertThat(searchResult.getId()).isEqualTo(id); Assertions.assertThat(searchResult.getName()).isEqualTo(name); Assertions.assertThat(searchResult.getUser()).isEqualTo(user); }
@Test void canFindEquality() { final String id = UUID.randomUUID().toString(); final BaseSearchResult searchResult1 = new BaseSearchResult(id, UUID.randomUUID().toString(), UUID.randomUUID().toString()); final BaseSearchResult searchResult2 = new BaseSearchResult(id, UUID.randomUUID().toString(), UUID.randomUUID().toString()); final BaseSearchResult searchResult3 = new BaseSearchResult( UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString() ); Assertions.assertThat(searchResult1).isEqualTo(searchResult2); Assertions.assertThat(searchResult1).isNotEqualTo(searchResult3); Assertions.assertThat(searchResult1.hashCode()).isEqualTo(searchResult2.hashCode()); Assertions.assertThat(searchResult1.hashCode()).isNotEqualTo(searchResult3.hashCode()); }
@Test void canCreateValidJsonString() { final BaseSearchResult searchResult = new BaseSearchResult( UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString() ); final String json = searchResult.toString(); Assertions.assertThatCode(() -> GenieObjectMapper.getMapper().readTree(json)).doesNotThrowAnyException(); }