@Override
 public void setUp() {
   super.setUp();
   generator =
       new DcpSponsorTasksGenerator(templateService, mockRegistrationService, mockSponsorService);
   SponsorRole sponsorRole = sponsor.addSponsorRepresentativeRole(sponsorOrganization);
   groupNames.add(sponsorRole.getVerifiedSponsorGroupName());
   List<AbstractProtocolRegistration> emptyList = Collections.emptyList();
   when(mockRegistrationService.getByStatusForUser(
           any(RegistrationStatus.class), eq(sponsor), anySetOf(String.class)))
       .thenReturn(emptyList);
 }
 @Test
 public void testGetSubinvestigatorRegistrationsJson() throws JSONException {
   SubInvestigatorRegistration inProgressReg =
       createSubInvestigatorRegistration(RegistrationStatus.IN_PROGRESS);
   SubInvestigatorRegistration returnedReg =
       createSubInvestigatorRegistration(RegistrationStatus.RETURNED);
   SubInvestigatorRegistration submittedReg =
       createSubInvestigatorRegistration(RegistrationStatus.SUBMITTED);
   when(mockRegistrationService.getSubinvestigatorRegistrations(profile, person))
       .thenReturn(Lists.newArrayList(inProgressReg, returnedReg, submittedReg));
   String json = action.getSubinvestigatorRegistrationsJson();
   checkRegistrationInJson(inProgressReg, json);
   checkRegistrationInJson(returnedReg, json);
   checkRegistrationInJson(submittedReg, json);
 }
 private void setUpMockRegistrationServiceToReturnRegistration(
     AbstractProtocolRegistration registration) {
   when(mockRegistrationService.getByStatusForUser(registration.getStatus(), sponsor, groupNames))
       .thenReturn(Lists.newArrayList(registration));
 }