Source:
public void createParticipant() { STUDY.setExternalIdValidationEnabled(true); STUDY.setEmailVerificationEnabled(true); mockHealthCodeAndAccountRetrieval(); when(externalIdService.getExternalId(STUDY.getStudyIdentifier(), EXTERNAL_ID)) .thenReturn(new DynamoExternalIdentifier()); IdentifierHolder idHolder = participantService.createParticipant(STUDY, CALLER_ROLES, PARTICIPANT, true); assertEquals(ID, idHolder.getIdentifier()); verify(externalIdService).assignExternalId(STUDY, EXTERNAL_ID, HEALTH_CODE); verify(externalIdService).getExternalId(STUDY.getStudyIdentifier(), EXTERNAL_ID); verify(accountDao).createAccount(eq(STUDY), accountCaptor.capture()); verify(accountWorkflowService).sendEmailVerificationToken(STUDY, ID, EMAIL); Account account = accountCaptor.getValue(); assertEquals(FIRST_NAME, account.getFirstName()); assertEquals(LAST_NAME, account.getLastName()); assertEquals("true", account.getAttribute("can_be_recontacted")); assertEquals(USER_ROLES, account.getRoles()); assertEquals(TestUtils.getClientData(), account.getClientData()); assertEquals(AccountStatus.UNVERIFIED, account.getStatus()); assertNull(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(TestUtils.newLinkedHashSet("de","fr"), account.getLanguages()); verify(cacheProvider, never()).removeSessionByUserId(ID); }

Target:
public void createParticipant() { STUDY.setExternalIdValidationEnabled(true); STUDY.setEmailVerificationEnabled(true); mockHealthCodeAndAccountRetrieval(); when(externalIdService.getExternalId(STUDY.getStudyIdentifier(), EXTERNAL_ID)).thenReturn(EXT_ID); IdentifierHolder idHolder = participantService.createParticipant(STUDY, CALLER_ROLES, PARTICIPANT, true); assertEquals(ID, idHolder.getIdentifier()); verify(accountDao).constructAccount(STUDY, EMAIL, PHONE, EXTERNAL_ID, PASSWORD); verify(externalIdService).assignExternalId(STUDY, EXTERNAL_ID, HEALTH_CODE); verify(externalIdService).getExternalId(STUDY.getStudyIdentifier(), EXTERNAL_ID); verify(accountDao).createAccount(eq(STUDY), accountCaptor.capture()); verify(accountWorkflowService).sendEmailVerificationToken(STUDY, ID, EMAIL); Account account = accountCaptor.getValue(); assertEquals(FIRST_NAME, account.getFirstName()); assertEquals(LAST_NAME, account.getLastName()); assertEquals("true", account.getAttribute("can_be_recontacted")); assertEquals(USER_ROLES, account.getRoles()); assertEquals(TestUtils.getClientData(), account.getClientData()); assertEquals(AccountStatus.UNVERIFIED, account.getStatus()); assertNull(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(TestUtils.newLinkedHashSet("de","fr"), account.getLanguages()); verify(cacheProvider, never()).removeSessionByUserId(ID); }