AccountServiceImpl extends
		gov.samhsa.consent2share.service.account.AccountServiceImpl { @Override @Transactional public void signup(SignupDto signupDto, String linkUrl) throws MessagingException, UsernameNotExistException, EmailAddressNotExistException { final String mrn = generateMrn(); if (!StringUtils.hasText(linkUrl)) { throw new IllegalArgumentException("Email link is required."); } String encodedPassword = passwordEncoder .encode(signupDto.getPassword()); Patient patient = new Patient(); patient.setMedicalRecordNumber(mrn); setPatientFieldsWithSignupDto(signupDto, patient); patientRepository.save(patient); PatientDto patientDto = spiritQueryService.addPatient(TypeConverter .signupDtoToPixPatientDto(signupDto, null)); if (patientDto == null) throw new SpiritClientNotAvailableException( "Error when creating patient by PDQ. Spirit service not available."); if (isDuplicatPatientByEid(patientDto.getPatientId())) throw new PatientExistingException("Patient already exists."); Set<GrantedAuthority> authorities = UsersAuthorityUtils .createAuthoritySet("ROLE_USER"); String username = signupDto.getUsername(); Users user = new Users(username, encodedPassword, false, true, true, authorities); usersRepository.createUser(user); userContext.setCurrentUser(signupDto.getUsername()); String token = createEmailToken(signupDto.getUsername(), signupDto.getEmail()); emailSender.sendMessage( signupDto.getFirstName() + " " + signupDto.getLastName(), signupDto.getEmail(), EmailType.SIGNUP_VERIFICATION, linkUrl, token); } AccountServiceImpl(
			Integer accountVerificationTokenExpireInHours,
			PatientRepository patientRepository,
			AdministrativeGenderCodeRepository administrativeGenderCodeRepository,
			PasswordEncoder passwordEncoder,
			UserContext userContext,
			EmailSender emailSender,
			TokenGenerator tokenGenerator,
			EmailTokenRepository emailTokenRepository,
			UsersRepository usersRepository,
			SpiritQueryService spiritQueryService,
			DtoToDomainEntityMapper<PatientDto, Patient> patientDtoToPatientMapper,
			MrnService mrnService, PixService pixService); @Override @Transactional void signup(SignupDto signupDto, String linkUrl);  }
@Test(expected = IllegalArgumentException.class) public void testSignup_Throws_Exception_Given_Link_Url_Has_Whitespaces_Only() throws MessagingException, UsernameNotExistException, EmailAddressNotExistException, Hl7v3TransformerException, SpiritClientNotAvailableException, PatientExistingException { SignupDto signupDto = mock(SignupDto.class); sut.signup(signupDto, " "); }