@Test public void testGenerateTasks_SponsorRoleNeedsVerification() throws Exception { Set<String> groupNames = Sets.newHashSet(); List<Task> tasks = generator.generateTasks(sponsor, groupNames); checkForOnlyTask(tasks, SPONSOR_ROLE_AWAITING_VERIFICATION_TASK_TITLE); }
@Test public void testGenerateTasks_NotASponsor() throws Exception { FirebirdUser coordinator = FirebirdUserFactory.getInstance().createRegistrationCoordinator(); List<Task> tasks = generator.generateTasks(coordinator, null); 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_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_CtepSponsor() throws Exception { Set<String> groupNames = Sets.newHashSet(); sponsor.getSponsorRoles().clear(); Organization ctepSponsor = new Organization(); sponsor.addSponsorRepresentativeRole(ctepSponsor); when(mockSponsorService.getSponsorOrganizationWithAnnualRegistrations()) .thenReturn(ctepSponsor); 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()); }