### Question:
OkrCompanyMapper implements DataMapper<OkrCompany, OkrCompanyDto> { @Override public OkrCompany mapDtoToEntity(OkrCompanyDto okrCompanyDto) { OkrCompany okrCompany = new OkrCompany(); okrCompany.setId(okrCompanyDto.getOkrUnitId()); okrCompany.setName(okrCompanyDto.getUnitName()); okrCompany.setLabel(okrCompanyDto.getLabel()); okrCompany.setOkrChildUnits(new ArrayList<>()); okrCompany.setObjectives(new ArrayList<>()); Cycle cycle = null; if (okrCompanyDto.getCycleId() != null) { cycle = new Cycle(); cycle.setId(okrCompanyDto.getCycleId()); } okrCompany.setCycle(cycle); OkrCompanyHistory history = null; if (okrCompanyDto.getHistoryId() != null) { history = new OkrCompanyHistory(); history.setId(okrCompanyDto.getHistoryId()); } okrCompany.setHistory(history); logger.info("Mapped OkrCompanyDto (id:" + okrCompanyDto.getOkrUnitId() + ") to OkrCompany."); return okrCompany; }  @Override OkrCompany mapDtoToEntity(OkrCompanyDto okrCompanyDto); @Override OkrCompanyDto mapEntityToDto(OkrCompany okrCompany); @Override Collection<OkrCompany> mapDtosToEntities(Collection<OkrCompanyDto> input); @Override Collection<OkrCompanyDto> mapEntitiesToDtos(Collection<OkrCompany> companies);  }### Answer:
@Test public void test_mapDtoToEntity_expects_idIsMapped() { Long expected = 5L; okrCompanyDto.setOkrUnitId(expected); okrCompany = okrCompanyMapper.mapDtoToEntity(okrCompanyDto); Assert.assertEquals(expected, okrCompany.getId()); }
@Test public void test_mapDtoToEntity_expects_nameIsMapped() { String expected = "test"; okrCompanyDto.setUnitName(expected); okrCompany = okrCompanyMapper.mapDtoToEntity(okrCompanyDto); Assert.assertEquals(expected, okrCompany.getName()); }
@Test public void test_mapDtoToEntity_expects_labelIsMapped() { String expected = "test2503"; okrCompanyDto.setLabel(expected); okrCompany = okrCompanyMapper.mapDtoToEntity(okrCompanyDto); Assert.assertEquals(expected, okrCompany.getLabel()); }
@Test public void test_mapDtoToEntity_expects_departmentsNotNull() { okrCompany = okrCompanyMapper.mapDtoToEntity(okrCompanyDto); Assert.assertNotNull(okrCompany.getOkrChildUnits()); }
@Test public void test_mapDtoToEntity_expects_objectivesNotNull() { okrCompany = okrCompanyMapper.mapDtoToEntity(okrCompanyDto); Assert.assertNotNull(okrCompany.getObjectives()); }
@Test public void test_mapDtoToEntity_expects_CycleIdIsMapped_NotNull() { Long expected = 14L; okrCompanyDto.setCycleId(expected); okrCompany = okrCompanyMapper.mapDtoToEntity(okrCompanyDto); Assert.assertEquals(expected, okrCompany.getCycle().getId()); }
@Test public void test_mapDtoToEntity_expects_CycleIdIsMapped_Null() { okrCompanyDto.setCycleId(null); okrCompany = okrCompanyMapper.mapDtoToEntity(okrCompanyDto); Assert.assertNull(okrCompany.getCycle()); }
@Test public void test_mapDtoToEntity_expects_HistoryIdIsMapped_NotNull() { Long expected = 24L; okrCompanyDto.setHistoryId(expected); okrCompany = okrCompanyMapper.mapDtoToEntity(okrCompanyDto); Assert.assertEquals(expected, okrCompany.getHistory().getId()); }
@Test public void test_mapDtoToEntity_expects_HistoryIdIsMapped_Null() { okrCompanyDto.setHistoryId(null); okrCompany = okrCompanyMapper.mapDtoToEntity(okrCompanyDto); Assert.assertNull(okrCompany.getHistory()); }