### Question:
SourceTransformer { SourceDTO toDto(Source source) { SourceDTO result = new SourceDTO(); if (null != source) { result.setCode(source.getCode()); result.setName(source.getName()); result.setLetter(String.valueOf(source.getLetter())); result.setTechnology(source.getTechnology()); result.setVcsUrl(source.getVcsUrl()); result.setDefaultBranch(source.getDefaultBranch()); result.setPostmanCountryRootFolders(source.isPostmanCountryRootFolders()); } return result; }    }### Answer:
@Test public void toDto_should_transform_the_object() { Source value = new Source(1L, 22L, "code", "name", 'c', Technology.POSTMAN, "vcsUrl", "defaultBranch", true); SourceDTO result = cut.toDto(value); Assertions.assertThat(result).isNotNull(); Assertions.assertThat(result.getCode()).isEqualTo("code"); Assertions.assertThat(result.getName()).isEqualTo("name"); Assertions.assertThat(result.getLetter()).isEqualTo("c"); Assertions.assertThat(result.getTechnology()).isEqualTo(Technology.POSTMAN); Assertions.assertThat(result.getVcsUrl()).isEqualTo("vcsUrl"); Assertions.assertThat(result.getDefaultBranch()).isEqualTo("defaultBranch"); Assertions.assertThat(result.isPostmanCountryRootFolders()).isTrue(); }
@Test public void toDto_should_return_empty_object_on_null() { SourceDTO result = cut.toDto(null); Assertions.assertThat(result).isNotNull(); Assertions.assertThat(result.getCode()).isNull(); Assertions.assertThat(result.getName()).isNull(); Assertions.assertThat(result.getLetter()).isNull(); Assertions.assertThat(result.getTechnology()).isNull(); Assertions.assertThat(result.getVcsUrl()).isNull(); Assertions.assertThat(result.getDefaultBranch()).isNull(); Assertions.assertThat(result.isPostmanCountryRootFolders()).isFalse(); }