@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 testPrepare() { FirebirdUser user = FirebirdUserFactory.getInstance().create(); Organization annualRegistrationSponsor = OrganizationFactory.getInstance().create(); Organization verifiedSponsor = OrganizationFactory.getInstance().create(); Organization unverifiedSponsor = OrganizationFactory.getInstance().create(); SponsorRole verifiedRole = user.addSponsorRepresentativeRole(verifiedSponsor); SponsorRole unverifiedRole = user.addSponsorRepresentativeRole(unverifiedSponsor); user.addSponsorRepresentativeRole(annualRegistrationSponsor); FirebirdWebTestUtility.setCurrentUser(action, user); UserSessionInformation userSessionInformation = UserSessionInformationFactory.getInstance() .create(user.getUsername(), verifiedRole.getVerifiedSponsorGroupName()); FirebirdWebTestUtility.setUpGridSessionInformation(action, userSessionInformation); when(mockSponsorService.getSponsorOrganizationWithAnnualRegistrations()) .thenReturn(annualRegistrationSponsor); action.prepare(); assertEquals(1, action.getUnverifiedSponsorRoles().size()); assertEquals(unverifiedRole, action.getUnverifiedSponsorRoles().get(0)); }