### Question:
RootCauseTransformer { RootCauseDTO toDto(RootCause rootCause) { RootCauseDTO result = new RootCauseDTO(); result.setId(0L); if (null != rootCause) { result.setId(rootCause.getId()); result.setName(rootCause.getName()); } return result; }    }### Answer:
@Test public void toDto_should_transform_object() { RootCause value = new RootCause(1L, 23L, "name", null); RootCauseDTO rootCauseDTO = cut.toDto(value); Assertions.assertThat(rootCauseDTO).isNotNull(); Assertions.assertThat(rootCauseDTO.getId()).isEqualTo(1L); Assertions.assertThat(rootCauseDTO.getName()).isEqualTo("name"); }
@Test public void toDto_should_return_empty_object_on_null_value() { RootCauseDTO rootCauseDTO = cut.toDto(null); Assertions.assertThat(rootCauseDTO).isNotNull(); Assertions.assertThat(rootCauseDTO.getId()).isEqualTo(0L); Assertions.assertThat(rootCauseDTO.getName()).isNull(); }