### Question:
UserSettingsMapper implements DataMapper<UserSettings, UserSettingsDto> { @Override public UserSettingsDto mapEntityToDto(UserSettings entity) { UserSettingsDto dto = new UserSettingsDto(); dto.setId(entity.getId()); if (entity.getDefaultOkrCompany() != null) { dto.setDefaultCompanyId(entity.getDefaultOkrCompany().getId()); } if (entity.getDefaultTeam() != null) { dto.setDefaultTeamId(entity.getDefaultTeam().getId()); } return dto; }  @Override UserSettings mapDtoToEntity(UserSettingsDto dto); @Override UserSettingsDto mapEntityToDto(UserSettings entity); @Override Collection<UserSettings> mapDtosToEntities(Collection<UserSettingsDto> input); @Override Collection<UserSettingsDto> mapEntitiesToDtos(Collection<UserSettings> input);  }### Answer:
@Test public void test_mapEntityToDto_ExpectIdIsMapped() { Long id = 42L; this.entity.setId(id); this.dto = this.mapper.mapEntityToDto(entity); Assert.assertEquals(id, this.dto.getId()); }
@Test public void test_mapEntityToDto_ExpectDefaultCompanyIsMapped() { Long companyId = 40L; OkrCompany okrCompany = new OkrCompany(); okrCompany.setId(companyId); this.entity.setDefaultOkrCompany(okrCompany); this.dto = this.mapper.mapEntityToDto(entity); Assert.assertEquals(companyId, this.dto.getDefaultCompanyId()); }
@Test public void test_mapEntityToDto_ExpectDefaultTeamIsMapped() { Long defaultTeamId = 100L; OkrDepartment defaultTeam = new OkrDepartment(); defaultTeam.setId(defaultTeamId); this.entity.setDefaultTeam(defaultTeam); this.dto = this.mapper.mapEntityToDto(entity); Assert.assertEquals(defaultTeamId, this.dto.getDefaultTeamId()); }