Source:
<code>public void createParticipant() { STUDY.setExternalIdValidationEnabled(true); STUDY.setEmailVerificationEnabled(true); mockHealthCodeAndAccountRetrieval(); when(externalIdService.getExternalId(STUDY.getStudyIdentifier(), EXTERNAL_ID)).thenReturn(Optional.of(extId)); IdentifierHolder idHolder = participantService.createParticipant(STUDY, PARTICIPANT, true); assertEquals(ID, idHolder.getIdentifier()); verify(externalIdService).commitAssignExternalId(extId); verify(accountDao).createAccount(eq(STUDY), accountCaptor.capture(), any()); verify(accountWorkflowService).sendEmailVerificationToken(STUDY, ID, EMAIL); Account account = accountCaptor.getValue(); assertEquals(STUDY.getIdentifier(), account.getStudyId()); assertEquals(EMAIL, account.getEmail()); assertEquals(PHONE, account.getPhone()); assertEquals(EXTERNAL_ID, account.getExternalId()); assertNotNull(account.getPasswordHash()); assertEquals(PasswordAlgorithm.DEFAULT_PASSWORD_ALGORITHM, account.getPasswordAlgorithm()); <START> assertNotEquals(PASSWORD, account.getPasswordHash()); <END> assertEquals(FIRST_NAME, account.getFirstName()); assertEquals(LAST_NAME, account.getLastName()); assertEquals("true", account.getAttributes().get("can_be_recontacted")); assertEquals(DEV_CALLER_ROLES, account.getRoles()); assertEquals(TestUtils.getClientData(), account.getClientData()); assertEquals(AccountStatus.UNVERIFIED, account.getStatus()); assertFalse(account.getEmailVerified()); assertEquals(SharingScope.ALL_QUALIFIED_RESEARCHERS, account.getSharingScope()); assertEquals(Boolean.TRUE, account.getNotifyByEmail()); assertEquals(EXTERNAL_ID, account.getExternalId()); assertNull(account.getTimeZone()); assertEquals(Sets.newHashSet("group1","group2"), account.getDataGroups()); assertEquals(ImmutableList.of("de","fr"), account.getLanguages()); Mockito.verifyNoMoreInteractions(cacheProvider); }</code><technical_language>check for attributes: id, phoneVerified, healthCode</technical_language>

Target:
public void createParticipant() { STUDY.setExternalIdValidationEnabled(true); STUDY.setEmailVerificationEnabled(true); mockHealthCodeAndAccountRetrieval(); when(externalIdService.getExternalId(STUDY.getStudyIdentifier(), EXTERNAL_ID)).thenReturn(Optional.of(extId)); IdentifierHolder idHolder = participantService.createParticipant(STUDY, PARTICIPANT, true); assertEquals(ID, idHolder.getIdentifier()); verify(externalIdService).commitAssignExternalId(extId); verify(accountDao).createAccount(eq(STUDY), accountCaptor.capture(), any()); verify(accountWorkflowService).sendEmailVerificationToken(STUDY, ID, EMAIL); Account account = accountCaptor.getValue(); assertEquals(ID, account.getId()); assertEquals(STUDY.getIdentifier(), account.getStudyId()); assertEquals(ID, account.getHealthCode()); assertEquals(EMAIL, account.getEmail()); assertFalse(account.getEmailVerified()); assertEquals(PHONE, account.getPhone()); assertFalse(account.getPhoneVerified()); assertEquals(EXTERNAL_ID, account.getExternalId()); assertNotNull(account.getPasswordHash()); assertEquals(PasswordAlgorithm.DEFAULT_PASSWORD_ALGORITHM, account.getPasswordAlgorithm()); assertNotEquals(PASSWORD, account.getPasswordHash()); assertEquals(FIRST_NAME, account.getFirstName()); assertEquals(LAST_NAME, account.getLastName()); assertEquals("true", account.getAttributes().get("can_be_recontacted")); assertEquals(DEV_CALLER_ROLES, account.getRoles()); assertEquals(TestUtils.getClientData(), account.getClientData()); assertEquals(AccountStatus.UNVERIFIED, account.getStatus()); assertEquals(SharingScope.ALL_QUALIFIED_RESEARCHERS, account.getSharingScope()); assertEquals(Boolean.TRUE, account.getNotifyByEmail()); assertEquals(EXTERNAL_ID, account.getExternalId()); assertNull(account.getTimeZone()); assertEquals(Sets.newHashSet("group1","group2"), account.getDataGroups()); assertEquals(ImmutableList.of("de","fr"), account.getLanguages()); Mockito.verifyNoMoreInteractions(cacheProvider); }