private SubInvestigatorRegistration createSubInvestigatorRegistration(RegistrationStatus status) { InvestigatorRegistration investigatorRegistration = RegistrationFactory.getInstanceWithId().createInvestigatorRegistration(profile); SubInvestigatorRegistration registration = RegistrationFactory.getInstanceWithId() .createSubinvestigatorRegistration(investigatorRegistration, subInvestigatorProfile); investigatorRegistration.setStatus(status); return registration; }
@Test public void testGenerateTasks_AcceptedRegistrationWithUnAcceptedSubinvestigatorRegistration() throws Exception { InvestigatorRegistration registration = RegistrationFactory.getInstance().createInvestigatorRegistration(ACCEPTED); RegistrationFactory.getInstance().createSubinvestigatorRegistration(registration); setUpMockRegistrationServiceToReturnRegistration(registration); registration.getProtocol().setSponsor(sponsorOrganization); List<Task> tasks = generator.generateTasks(sponsor, groupNames); assertTrue(tasks.isEmpty()); }
@Test public void testGenerateTasks_InReviewRegistration() throws Exception { InvestigatorRegistration registration = RegistrationFactory.getInstance().createInvestigatorRegistration(IN_REVIEW); setUpMockRegistrationServiceToReturnRegistration(registration); List<Task> tasks = generator.generateTasks(sponsor, groupNames); checkForOnlyTask(tasks, REGISTRATION_IN_REVIEW_TASK_TITLE, registration); }
@Test public void testGenerateTasks_AcceptedSubinvestigatorRegistration() throws Exception { SubInvestigatorRegistration subinvestigatorRegistration = RegistrationFactory.getInstance().createSubinvestigatorRegistration(); subinvestigatorRegistration.setStatus(ACCEPTED); setUpMockRegistrationServiceToReturnRegistration(subinvestigatorRegistration); List<Task> tasks = generator.generateTasks(sponsor, groupNames); assertTrue(tasks.isEmpty()); }
@Test public void testGenerateTasks_RegistrationReadyForApproval() throws Exception { InvestigatorRegistration registration = RegistrationFactory.getInstance().createInvestigatorRegistration(ACCEPTED); setUpMockRegistrationServiceToReturnRegistration(registration); registration.getProtocol().setSponsor(sponsorOrganization); List<Task> tasks = generator.generateTasks(sponsor, groupNames); checkForOnlyTask(tasks, REGISTRATION_PACKET_AWAITING_APPROVAL_TITLE, registration); }
@Test public void testGenerateTasks_RevisedRegistrationReadyForApproval() throws Exception { RevisedInvestigatorRegistration registration = RegistrationFactory.getInstance().createRevisedInvestigatorRegistration(); registration.setStatus(ACCEPTED); setUpMockRegistrationServiceToReturnRegistration(registration); registration.getProtocol().setSponsor(sponsorOrganization); List<Task> tasks = generator.generateTasks(sponsor, groupNames); assertTrue(tasks.isEmpty()); }
@Test public void testGenerateTasks_RegistrationReadyForApproval_NotSponsorRepresentativeForProtocolSponsor() throws Exception { sponsor.getSponsorRoles().clear(); groupNames.clear(); SponsorRole sponsorDelegateRole = sponsor.addSponsorDelegateRole(sponsorOrganization); groupNames.add(sponsorDelegateRole.getVerifiedSponsorGroupName()); InvestigatorRegistration registration = RegistrationFactory.getInstance().createInvestigatorRegistration(ACCEPTED); setUpMockRegistrationServiceToReturnRegistration(registration); registration.getProtocol().setSponsor(sponsorOrganization); List<Task> tasks = generator.generateTasks(sponsor, groupNames); assertTrue(tasks.isEmpty()); }