@Test public void testMap_Given_Null_Username_And_Null_Admin_Id() { AdminProfileDto adminProfileDto = mock(AdminProfileDto.class); when(adminProfileDto.getUsername()).thenReturn(null); when(adminProfileDto.getId()).thenReturn(null); final String firstName = "Firstname"; when(adminProfileDto.getFirstName()).thenReturn(firstName); Staff administrator = sut.map(adminProfileDto); assertEquals(firstName, administrator.getFirstName()); }
public Staff map(AdminProfileDto adminProfileDto) { Staff administrator = null; if (adminProfileDto.getUsername() == null) { if (adminProfileDto.getId() != null) { administrator = providerAdminRepository.findOne(adminProfileDto .getId()); } else { administrator = new Staff(); } } else { administrator = providerAdminRepository .findByUsername(adminProfileDto.getUsername()); } administrator.setFirstName(adminProfileDto.getFirstName()); administrator.setLastName(adminProfileDto.getLastName()); administrator.setEmail(adminProfileDto.getEmail()); administrator.setEmployeeID(adminProfileDto.getEmployeeId()); if (StringUtils.hasText(adminProfileDto.getAdministrativeGenderCode())) { AdministrativeGenderCode administrativeGenderCode = administrativeGenderCodeRepository .findByCode(adminProfileDto.getAdministrativeGenderCode()); administrator.setAdministrativeGenderCode(administrativeGenderCode); } else { administrator.setAdministrativeGenderCode(null); } return administrator; }
AdminProfileDtoToAdministratorMapper { public Staff map(AdminProfileDto adminProfileDto) { Staff administrator = null; if (adminProfileDto.getUsername() == null) { if (adminProfileDto.getId() != null) { administrator = providerAdminRepository.findOne(adminProfileDto .getId()); } else { administrator = new Staff(); } } else { administrator = providerAdminRepository .findByUsername(adminProfileDto.getUsername()); } administrator.setFirstName(adminProfileDto.getFirstName()); administrator.setLastName(adminProfileDto.getLastName()); administrator.setEmail(adminProfileDto.getEmail()); administrator.setEmployeeID(adminProfileDto.getEmployeeId()); if (StringUtils.hasText(adminProfileDto.getAdministrativeGenderCode())) { AdministrativeGenderCode administrativeGenderCode = administrativeGenderCodeRepository .findByCode(adminProfileDto.getAdministrativeGenderCode()); administrator.setAdministrativeGenderCode(administrativeGenderCode); } else { administrator.setAdministrativeGenderCode(null); } return administrator; } }
AdminProfileDtoToAdministratorMapper { public Staff map(AdminProfileDto adminProfileDto) { Staff administrator = null; if (adminProfileDto.getUsername() == null) { if (adminProfileDto.getId() != null) { administrator = providerAdminRepository.findOne(adminProfileDto .getId()); } else { administrator = new Staff(); } } else { administrator = providerAdminRepository .findByUsername(adminProfileDto.getUsername()); } administrator.setFirstName(adminProfileDto.getFirstName()); administrator.setLastName(adminProfileDto.getLastName()); administrator.setEmail(adminProfileDto.getEmail()); administrator.setEmployeeID(adminProfileDto.getEmployeeId()); if (StringUtils.hasText(adminProfileDto.getAdministrativeGenderCode())) { AdministrativeGenderCode administrativeGenderCode = administrativeGenderCodeRepository .findByCode(adminProfileDto.getAdministrativeGenderCode()); administrator.setAdministrativeGenderCode(administrativeGenderCode); } else { administrator.setAdministrativeGenderCode(null); } return administrator; } AdminProfileDtoToAdministratorMapper(
			StaffRepository providerAdminRepository,
			AdministrativeGenderCodeRepository administrativeGenderCodeRepository); }
AdminProfileDtoToAdministratorMapper { public Staff map(AdminProfileDto adminProfileDto) { Staff administrator = null; if (adminProfileDto.getUsername() == null) { if (adminProfileDto.getId() != null) { administrator = providerAdminRepository.findOne(adminProfileDto .getId()); } else { administrator = new Staff(); } } else { administrator = providerAdminRepository .findByUsername(adminProfileDto.getUsername()); } administrator.setFirstName(adminProfileDto.getFirstName()); administrator.setLastName(adminProfileDto.getLastName()); administrator.setEmail(adminProfileDto.getEmail()); administrator.setEmployeeID(adminProfileDto.getEmployeeId()); if (StringUtils.hasText(adminProfileDto.getAdministrativeGenderCode())) { AdministrativeGenderCode administrativeGenderCode = administrativeGenderCodeRepository .findByCode(adminProfileDto.getAdministrativeGenderCode()); administrator.setAdministrativeGenderCode(administrativeGenderCode); } else { administrator.setAdministrativeGenderCode(null); } return administrator; } AdminProfileDtoToAdministratorMapper(
			StaffRepository providerAdminRepository,
			AdministrativeGenderCodeRepository administrativeGenderCodeRepository); Staff map(AdminProfileDto adminProfileDto); }
AdminProfileDtoToAdministratorMapper { public Staff map(AdminProfileDto adminProfileDto) { Staff administrator = null; if (adminProfileDto.getUsername() == null) { if (adminProfileDto.getId() != null) { administrator = providerAdminRepository.findOne(adminProfileDto .getId()); } else { administrator = new Staff(); } } else { administrator = providerAdminRepository .findByUsername(adminProfileDto.getUsername()); } administrator.setFirstName(adminProfileDto.getFirstName()); administrator.setLastName(adminProfileDto.getLastName()); administrator.setEmail(adminProfileDto.getEmail()); administrator.setEmployeeID(adminProfileDto.getEmployeeId()); if (StringUtils.hasText(adminProfileDto.getAdministrativeGenderCode())) { AdministrativeGenderCode administrativeGenderCode = administrativeGenderCodeRepository .findByCode(adminProfileDto.getAdministrativeGenderCode()); administrator.setAdministrativeGenderCode(administrativeGenderCode); } else { administrator.setAdministrativeGenderCode(null); } return administrator; } AdminProfileDtoToAdministratorMapper(
			StaffRepository providerAdminRepository,
			AdministrativeGenderCodeRepository administrativeGenderCodeRepository); Staff map(AdminProfileDto adminProfileDto);  }