@Test
public void shouldSerializeAndDeserializeWithObjectMapper() throws IOException {

    // given
    final ErrorHalRepresentation errorHalRepresentation = ErrorHalRepresentation.builder()
            .withErrorMessage("some error message")
            .withError("field", "key", "message", "rejected")
            .build();
    final ObjectMapper objectMapper = new ObjectMapper();
    // when
    final String json = objectMapper.writeValueAsString(errorHalRepresentation);
    final ErrorHalRepresentation deserialized = objectMapper.readValue(json, ErrorHalRepresentation.class);
    // then
    assertThat(deserialized, is(errorHalRepresentation));
}