src_fm_fc_ms_ff stringlengths 43 86.8k | target stringlengths 20 276k |
|---|---|
CompetitionSetupStakeholderController { @PreAuthorize("hasPermission(#competitionId, 'org.innovateuk.ifs.competition.resource.CompetitionCompositeId', 'MANAGE_STAKEHOLDERS')") @GetMapping("/{competitionId}/manage-stakeholders") public String manageStakeholders(@PathVariable(COMPETITION_ID_KEY) long competitionId, @Requ... | @Test public void manageStakeholders() throws Exception { String competitionName = "competitionName"; String tab = "add"; CompetitionResource competitionResource = CompetitionResourceBuilder.newCompetitionResource() .withId(COMPETITION_ID) .withName(competitionName) .build(); ManageStakeholderViewModel viewModel = new ... |
CompetitionSetupStakeholderController { @PostMapping(value = "/{competitionId}/manage-stakeholders", params = {"inviteStakeholder"}) public String inviteStakeholder(@PathVariable(COMPETITION_ID_KEY) long competitionId, @RequestParam(value = "tab", defaultValue = DEFAULT_TAB) String tab, Model model, @Valid @ModelAttrib... | @Test public void inviteStakeholderWhenInviteFails() throws Exception { String tab = "add"; String competitionName = "competitionName"; CompetitionResource competitionResource = CompetitionResourceBuilder.newCompetitionResource() .withId(COMPETITION_ID) .withName(competitionName) .build(); ManageStakeholderViewModel vi... |
CompetitionSetupStakeholderController { @PostMapping(value = "/{competitionId}/manage-stakeholders", params = {"addStakeholder"}) public String addStakeholder(@PathVariable(COMPETITION_ID_KEY) long competitionId, @RequestParam("stakeholderUserId") long stakeholderUserId, Model model) { competitionSetupStakeholderRestSe... | @Test public void addStakeholder() throws Exception { long stakeholderUserId = 2L; when(competitionSetupStakeholderRestService.addStakeholder(COMPETITION_ID, stakeholderUserId)).thenReturn(restSuccess()); mockMvc.perform(MockMvcRequestBuilders.post("/competition/setup/{competitionId}/manage-stakeholders?addStakeholder=... |
CompetitionSetupStakeholderController { @PostMapping(value = "/{competitionId}/manage-stakeholders", params = {"removeStakeholder"}) public String removeStakeholder(@PathVariable(COMPETITION_ID_KEY) long competitionId, @RequestParam("stakeholderUserId") long stakeholderUserId, Model model) { competitionSetupStakeholder... | @Test public void removeStakeholder() throws Exception { long stakeholderUserId = 2L; when(competitionSetupStakeholderRestService.removeStakeholder(COMPETITION_ID, stakeholderUserId)).thenReturn(restSuccess()); mockMvc.perform(MockMvcRequestBuilders.post("/competition/setup/{competitionId}/manage-stakeholders?removeSta... |
ManageStakeholderModelPopulator { public ManageStakeholderViewModel populateModel(CompetitionResource competition, String tab) { List<UserResource> availableStakeholders = userRestService.findByUserRole(STAKEHOLDER).getSuccess(); List<UserResource> stakeholdersAssignedToCompetition = competitionSetupStakeholderRestServ... | @Test public void populateModel() { String tab = "add"; String competitionName = "competition1"; CompetitionResource competitionResource = newCompetitionResource() .withId(COMPETITION_ID) .withName(competitionName) .build(); long availableStakeholderUser1 = 14L; long availableStakeholderUser2 = 15L; long stakeholderAss... |
ProjectEligibilityModelPopulator implements CompetitionSetupSectionModelPopulator { @Override public CompetitionSetupSection sectionToPopulateModel() { return CompetitionSetupSection.PROJECT_ELIGIBILITY; } ProjectEligibilityModelPopulator(CategoryRestService categoryRestService,
... | @Test public void testSectionToPopulateModel() { CompetitionSetupSection result = populator.sectionToPopulateModel(); assertEquals(CompetitionSetupSection.PROJECT_ELIGIBILITY, result); } |
CompetitionSetupDocumentController { @GetMapping("/landing-page") public String projectDocumentLandingPage(Model model, @PathVariable(COMPETITION_ID_KEY) long competitionId, @ModelAttribute(LANDING_FORM_ATTR_NAME) LandingPageForm form, UserResource loggedInUser) { Redirect redirect = doViewProjectDocument(model, compet... | @Test public void projectDocumentLandingPage() throws Exception { CompetitionResource competitionResource = newCompetitionResource() .withId(COMPETITION_ID) .withCompetitionStatus(CompetitionStatus.COMPETITION_SETUP) .build(); ProjectDocumentViewModel viewModel = new ProjectDocumentViewModel(null); when(competitionRest... |
CompetitionSetupDocumentController { @GetMapping("/add") public String viewAddProjectDocument(@PathVariable(COMPETITION_ID_KEY) long competitionId, UserResource loggedInUser, Model model) { Redirect redirect = doViewProjectDocument(model, competitionId, loggedInUser); ProjectDocumentForm form = new ProjectDocumentForm(... | @Test public void viewAddProjectDocument() throws Exception { List<CompetitionDocumentResource> projectDocuments = newCompetitionDocumentResource() .withTitle("Title") .withEditable(true) .withEnabled(true) .build(2); CompetitionResource competitionResource = newCompetitionResource() .withId(COMPETITION_ID) .withCompet... |
CompetitionSetupDocumentController { @GetMapping("/{projectDocumentId}/edit") public String viewEditProjectDocument(@PathVariable(COMPETITION_ID_KEY) long competitionId, @PathVariable("projectDocumentId") long projectDocumentId, UserResource loggedInUser, Model model) { Redirect redirect = doViewProjectDocument(model, ... | @Test public void viewEditProjectDocument() throws Exception { long projectDocumentId = 2L; CompetitionResource competitionResource = newCompetitionResource() .withId(COMPETITION_ID) .withCompetitionStatus(CompetitionStatus.COMPETITION_SETUP) .build(); long fileTypeId = 1L; CompetitionDocumentResource competitionDocume... |
CompetitionSetupDocumentController { @PostMapping("/{projectDocumentId}/delete") public String deleteProjectDocument(@PathVariable(COMPETITION_ID_KEY) long competitionId, @PathVariable("projectDocumentId") long projectDocumentId, Model model) { competitionSetupDocumentRestService.delete(projectDocumentId); return forma... | @Test public void deleteProjectDocument() throws Exception { long projectDocumentId = 2L; when(competitionSetupDocumentRestService.delete(projectDocumentId)).thenReturn(restSuccess()); mockMvc.perform(post(URL_PREFIX + "/{projectDocumentId}/delete", projectDocumentId) ) .andExpect(status().is3xxRedirection()) .andExpec... |
ProjectDocumentPopulator implements CompetitionSetupSectionModelPopulator { @Override public CompetitionSetupViewModel populateModel(GeneralSetupViewModel generalViewModel, CompetitionResource competitionResource) { return new ProjectDocumentViewModel(generalViewModel); } @Override CompetitionSetupSection sectionToPop... | @Test public void testPopulateModel() { CompetitionResource competitionResource = newCompetitionResource() .withId(COMPETITION_ID) .withName("name") .build(); GeneralSetupViewModel generalSetupViewModel = getBasicGeneralSetupView(competitionResource); ProjectDocumentViewModel viewModel = (ProjectDocumentViewModel) popu... |
InterviewPermissionRules { @PermissionRule(value = "INTERVIEW", description = "Only project finance or competition admin can see interview panels" + "if the competition is in the correct state.") public boolean interviewPanel(CompetitionCompositeId competitionCompositeId, UserResource loggedInUser) { CompetitionResourc... | @Test public void interviewPanel() { UserResource loggedInUser = compAdminUser(); for (CompetitionStatus competitionStatus : CompetitionStatus.values()) { final CompetitionResource competitionWithInterviewStage = newCompetitionResource() .withCompetitionStatus(competitionStatus) .build(); CompetitionAssessmentConfigRes... |
InterviewPermissionRules { @PermissionRule(value = "INTERVIEW_APPLICATIONS", description = "Only project finance or competition admin can " + "see interview panel applications if the competition is in the correct state.") public boolean interviewPanelApplications(CompetitionCompositeId competitionCompositeId, UserResou... | @Test public void interviewPanelApplications() { UserResource loggedInUser = compAdminUser(); for (CompetitionStatus competitionStatus : CompetitionStatus.values()) { final CompetitionResource competitionWithInterviewStage = newCompetitionResource() .withCompetitionStatus(competitionStatus) .build(); CompetitionAssessm... |
InterviewController { @GetMapping public String interviewPanel(@PathVariable("competitionId") long competitionId, Model model) { model.addAttribute("model", interviewModelPopulator.populateModel(competitionId)); return "competition/manage-interview-panel"; } @GetMapping String interviewPanel(@PathVariable("competition... | @Test public void interviewPanel() throws Exception { long competitionId = 1L; String competitionName = "Competition x"; CompetitionStatus competitionStatus = CLOSED; competitionResource = newCompetitionResource() .with(id(competitionId)) .with(name(competitionName)) .withCompetitionStatus(competitionStatus) .build(); ... |
InterviewAllocationController extends CompetitionManagementCookieController<InterviewAllocationSelectionForm> { @GetMapping("/allocate-assessors") public String overview(Model model, @PathVariable("competitionId") long competitionId, @RequestParam MultiValueMap<String, String> queryParams, @RequestParam(value = "page",... | @Test public void overview() throws Exception { int page = 0; CompetitionResource competition = newCompetitionResource() .withId(1L) .withName("Competition x") .build(); when(competitionRestService.getCompetitionById(competition.getId())).thenReturn(restSuccess(competition)); InterviewAcceptedAssessorsResource intervie... |
InterviewAllocationController extends CompetitionManagementCookieController<InterviewAllocationSelectionForm> { @GetMapping("/unallocated-applications/{assessorId}") public String applications(@ModelAttribute(name = SELECTION_FORM, binding = false) InterviewAllocationSelectionForm selectionForm, Model model, @PathVaria... | @Test public void applications() throws Exception { CompetitionResource competition = newCompetitionResource() .withId(1L) .withName("Competition x") .build(); UserResource user = newUserResource() .withId(1L) .withFirstName("Kieran") .withLastName("Hester") .build(); List<InnovationAreaResource> innovationAreas = newI... |
InterviewAllocationController extends CompetitionManagementCookieController<InterviewAllocationSelectionForm> { @GetMapping("/allocated-applications/{userId}") public String allocated(@ModelAttribute(name = SELECTION_FORM, binding = false) InterviewAllocationSelectionForm selectionForm, Model model, @PathVariable("comp... | @Test public void allocated() throws Exception { CompetitionResource competition = newCompetitionResource() .withId(1L) .withName("Competition x") .build(); UserResource user = newUserResource() .withId(1L) .withFirstName("Kieran") .withLastName("Hester") .build(); InnovationAreaResource innovationArea = newInnovationA... |
InterviewAllocationController extends CompetitionManagementCookieController<InterviewAllocationSelectionForm> { @PostMapping("/allocate-applications/{userId}/addSelected") public String allocateApplications(@PathVariable("competitionId") long competitionId, @PathVariable("userId") long userId) { return redirectToSend(c... | @Test public void allocateApplications() throws Exception { CompetitionResource competition = newCompetitionResource() .withName("Competition") .build(); UserResource user = newUserResource() .withFirstName("Kieran") .withLastName("Hester") .build(); List<Long> selectedApplicationIds = asList(1L); AssessorInvitesToSend... |
InterviewAllocationController extends CompetitionManagementCookieController<InterviewAllocationSelectionForm> { @PostMapping("/allocate-applications/{userId}") public String notifyAssessor(Model model, @ModelAttribute(name = "form") InterviewAllocationNotifyForm form, @PathVariable("competitionId") long competitionId, ... | @Test public void notifyAssessor() throws Exception { CompetitionResource competition = newCompetitionResource() .withName("Competition") .build(); UserResource user = newUserResource() .withFirstName("Kieran") .withLastName("Hester") .build(); List<Long> selectedApplicationIds = asList(1L); InterviewAllocationNotifyFo... |
InterviewApplicationAssignmentController extends CompetitionManagementCookieController<InterviewAssignmentSelectionForm> { @GetMapping("/find") public String find(Model model, @ModelAttribute(name = SELECTION_FORM, binding = false) InterviewAssignmentSelectionForm selectionForm, @SuppressWarnings("unused") BindingResul... | @Test public void find() throws Exception { int page = 2; AvailableApplicationPageResource availableAssessorPageResource = newAvailableApplicationPageResource() .withContent(newAvailableApplicationResource().build(2)) .build(); when(interviewAssignmentRestService.getAvailableApplicationIds(competition.getId())).thenRet... |
InterviewApplicationAssignmentController extends CompetitionManagementCookieController<InterviewAssignmentSelectionForm> { private List<Long> getAvailableApplicationIds(long competitionId) { return interviewAssignmentRestService.getAvailableApplicationIds(competitionId).getSuccess(); } @GetMapping("/find") String find... | @Test public void find_defaultParams() throws Exception { int page = 0; AvailableApplicationPageResource availableAssessorPageResource = newAvailableApplicationPageResource() .withContent(newAvailableApplicationResource().build(2)) .build(); when(interviewAssignmentRestService.getAvailableApplicationIds(competition.get... |
InterviewApplicationAssignmentController extends CompetitionManagementCookieController<InterviewAssignmentSelectionForm> { @GetMapping("/invite") public String invite(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(defaultValue = "0") int page, @RequestParam MultiValueMap<String, String> q... | @Test public void invite() throws Exception { int page = 0; List<InterviewAssignmentStagedApplicationResource> interviewAssignmentStagedApplicationResources = setUpApplicationCreatedInviteResources(); InterviewAssignmentStagedApplicationPageResource interviewAssignmentStagedApplicationPageResource = newInterviewAssignm... |
InterviewApplicationAssignmentController extends CompetitionManagementCookieController<InterviewAssignmentSelectionForm> { @PostMapping(value = "/invite", params = "remove") public String remove(Model model, @PathVariable("competitionId") long competitionId, @RequestParam("remove") long applicationId, @RequestParam(def... | @Test public void remove() throws Exception { int page = 0; long applicationId = 123L; List<InterviewAssignmentStagedApplicationResource> interviewAssignmentStagedApplicationResources = setUpApplicationCreatedInviteResources(); InterviewAssignmentStagedApplicationPageResource interviewAssignmentStagedApplicationPageRes... |
InterviewApplicationAssignmentController extends CompetitionManagementCookieController<InterviewAssignmentSelectionForm> { @PostMapping(value = "/invite", params = "removeAll") public String removeAll(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(defaultValue = "0") int page, @RequestPar... | @Test public void removeAll() throws Exception { when(interviewAssignmentRestService.unstageApplications(competition.getId())).thenReturn(restSuccess()); mockMvc.perform(post("/assessment/interview/competition/{competitionId}/applications/invite", competition.getId()) .param("removeAll", "true")) .andExpect(status().is... |
InterviewApplicationAssignmentController extends CompetitionManagementCookieController<InterviewAssignmentSelectionForm> { @GetMapping("/view-status") public String viewStatus(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(defaultValue = "0") int page) { model.addAttribute("model", interv... | @Test public void viewStatus() throws Exception { int page = 0; List<InterviewAssignmentApplicationResource> interviewAssignmentApplicationResources = newInterviewAssignmentApplicationResource() .withId(1L, 2L) .withApplicationId(3L, 4L) .withApplicationName("App 1", "App 2") .withLeadOrganisationName("Org 1", "Org 2")... |
InterviewAssessorSendInviteController extends CompetitionManagementCookieController<InterviewOverviewSelectionForm> { @PostMapping("/send") public String sendInvites(Model model, @PathVariable("competitionId") long competitionId, @ModelAttribute("form") @Valid SendInviteForm form, BindingResult bindingResult, Validatio... | @Test public void sendInvites() throws Exception { long competitionId = 5L; AssessorInviteSendResource expectedAssessorInviteSendResource = newAssessorInviteSendResource() .withSubject("Subject...") .withContent("Editable content...") .build(); when(interviewInviteRestService.sendAllInvites(competitionId, expectedAsses... |
InterviewAssessorSendInviteController extends CompetitionManagementCookieController<InterviewOverviewSelectionForm> { @PostMapping("/resend") public String resendInvites (Model model, @PathVariable("competitionId") long competitionId, @ModelAttribute("form") @Valid ResendInviteForm form, BindingResult bindingResult, Va... | @Test public void resendInvites() throws Exception { List<Long> inviteIds = asList(1L, 2L); AssessorInvitesToSendResource invite = newAssessorInvitesToSendResource().withCompetitionId(competition.getId()).build(); AssessorInviteSendResource expectedAssessorInviteSendResource = newAssessorInviteSendResource() .withSubje... |
InterviewApplicationSendInviteController { @PostMapping("/send") public String sendInvites(Model model, @PathVariable("competitionId") long competitionId, @ModelAttribute("form") @Valid InterviewApplicationSendForm form, BindingResult bindingResult, ValidationHandler validationHandler) { Supplier<String> failureView = ... | @Test public void sendInvites() throws Exception { long competitionId = 5L; AssessorInviteSendResource expectedAssessorInviteSendResource = newAssessorInviteSendResource() .withSubject("Subject...") .withContent("Editable content...") .build(); when(interviewAssignmentRestService.sendAllInvites(competitionId, expectedA... |
InterviewApplicationSendInviteController { @PostMapping(value = "/send", params = {"attachFeedbackApplicationId"}) public String uploadFeedback(Model model, @PathVariable("competitionId") long competitionId, @ModelAttribute("form") InterviewApplicationSendForm form, BindingResult bindingResult, ValidationHandler valida... | @Test public void uploadFeedback() throws Exception { long competitionId = 1L; long applicationId = 2L; when(interviewAssignmentRestService.uploadFeedback(applicationId, "application/pdf", 11, "testFile.pdf", "My content!".getBytes())) .thenReturn(restFailure(CommonErrors.payloadTooLargeError(1))); MockMultipartFile fi... |
InterviewApplicationSendInviteController { @PostMapping(value = "/send", params = {"removeFeedbackApplicationId"}) public String removeFeedback(Model model, @PathVariable("competitionId") long competitionId, @ModelAttribute("form") InterviewApplicationSendForm form, BindingResult bindingResult, ValidationHandler valida... | @Test public void removeFeedback() throws Exception { long competitionId = 1L; long applicationId = 2L; when(interviewAssignmentRestService.deleteFeedback(applicationId)) .thenReturn(restFailure(new Error("", HttpStatus.NOT_FOUND))); setupMocksForGet(competitionId); mockMvc.perform(post("/assessment/interview/competiti... |
InterviewApplicationSendInviteController { @GetMapping(value = "/{applicationId}/view") public String viewInvite(Model model, @PathVariable("competitionId") long competitionId, @PathVariable("applicationId") long applicationId) { InterviewAssignmentApplicationsSentInviteViewModel viewModel = interviewApplicationSentInv... | @Test public void viewInvite() throws Exception { long applicationId = 1L; ZonedDateTime dateAssigned = ZonedDateTime.now(); setupViewInvite(applicationId, dateAssigned); MvcResult result = mockMvc.perform(get("/assessment/interview/competition/{competitionId}/applications/invite/{applicationId}/view", competition.getI... |
InterviewApplicationSendInviteController { @PostMapping(value = "/{applicationId}/edit") public String resendInvite(Model model, @Valid @ModelAttribute("form") InterviewApplicationResendForm form, BindingResult bindingResult, ValidationHandler validationHandler, @PathVariable("competitionId") long competitionId, @PathV... | @Test public void editInvite_removeFile() throws Exception { long applicationId = 1L; ZonedDateTime dateAssigned = ZonedDateTime.now(); setupViewInvite(applicationId, dateAssigned); when(interviewAssignmentRestService.deleteFeedback(applicationId)).thenReturn(restSuccess()); when(interviewAssignmentRestService.resendIn... |
InterviewAssessorInviteController extends CompetitionManagementCookieController<InterviewSelectionForm> { @GetMapping public String assessors(@PathVariable("competitionId") long competitionId) { return format("redirect:/competition/%s/assessors/interview-find", competitionId); } @Autowired InterviewAssessorInviteContr... | @Test public void assessors() throws Exception { Long competitionId = 1L; mockMvc.perform(get("/assessment/interview/competition/{competitionId}/assessors", competitionId)) .andExpect(status().is3xxRedirection()) .andExpect(redirectedUrl(format("/competition/%s/assessors/interview-find", competitionId))); } |
InterviewAssessorInviteController extends CompetitionManagementCookieController<InterviewSelectionForm> { @GetMapping("/find") public String find(Model model, @ModelAttribute(name = SELECTION_FORM, binding = false) InterviewSelectionForm selectionForm, @SuppressWarnings("unused") BindingResult bindingResult, @PathVaria... | @Test public void find() throws Exception { int page = 2; AvailableAssessorPageResource availableAssessorPageResource = newAvailableAssessorPageResource() .withContent(setUpAvailableAssessorResources()) .build(); when(interviewInviteRestService.getAvailableAssessors(competition.getId(), page)).thenReturn(restSuccess(av... |
InterviewAssessorInviteController extends CompetitionManagementCookieController<InterviewSelectionForm> { @GetMapping("/invite") public String invite(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(defaultValue = "0") int page, @RequestParam MultiValueMap<String, String> queryParams) { mod... | @Test public void invite() throws Exception { int page = 0; List<AssessorCreatedInviteResource> assessorCreatedInviteResources = setUpAssessorCreatedInviteResources(); AssessorCreatedInvitePageResource assessorCreatedInvitePageResource = newAssessorCreatedInvitePageResource() .withContent(assessorCreatedInviteResources... |
InterviewAssessorInviteController extends CompetitionManagementCookieController<InterviewSelectionForm> { @PostMapping(value = "/invite", params = {"remove"}) public String removeInviteFromInviteView(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(name = "remove") String email, @RequestPar... | @Test public void removeInviteFromInviteView() throws Exception { String email = "firstname.lastname@example.com"; when(interviewInviteRestService.deleteInvite(email, competition.getId())).thenReturn(restSuccess()); mockMvc.perform(post("/assessment/interview/competition/{competitionId}/assessors/invite", competition.g... |
InterviewAssessorInviteController extends CompetitionManagementCookieController<InterviewSelectionForm> { private ServiceResult<Void> deleteInvite(String email, long competitionId) { return interviewInviteRestService.deleteInvite(email, competitionId).toServiceResult(); } @Autowired InterviewAssessorInviteController(I... | @Test public void removeInviteFromInviteView_defaultParams() throws Exception { String email = "firstname.lastname@example.com"; when(interviewInviteRestService.deleteInvite(email, competition.getId())).thenReturn(restSuccess()); mockMvc.perform(post("/assessment/interview/competition/{competitionId}/assessors/invite",... |
InterviewAssessorInviteController extends CompetitionManagementCookieController<InterviewSelectionForm> { @PostMapping(value = "/invite", params = {"removeAll"}) public String removeAllInvitesFromInviteView(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(defaultValue = "0") int page, @Supp... | @Test public void removeAllInvitesFromInviteView() throws Exception { when(interviewInviteRestService.deleteAllInvites(competition.getId())).thenReturn(restSuccess()); mockMvc.perform(post("/assessment/interview/competition/{competitionId}/assessors/invite", competition.getId()) .param("removeAll", "")) .andExpect(stat... |
InterviewAssessorInviteController extends CompetitionManagementCookieController<InterviewSelectionForm> { @GetMapping("/accepted") public String accepted(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(defaultValue = "0") int page) { model.addAttribute("model", interviewInviteAssessorsAcce... | @Test public void accepted() throws Exception { int page = 1; List<ParticipantStatusResource> status = Collections.singletonList(ACCEPTED); List<AssessorInviteOverviewResource> assessorInviteOverviewResources = setUpAssessorInviteOverviewResources(); AssessorInviteOverviewPageResource pageResource = newAssessorInviteOv... |
InterviewInviteAssessorsOverviewController extends CompetitionManagementCookieController<InterviewOverviewSelectionForm> { @GetMapping("/pending-and-declined") public String overview(Model model, @ModelAttribute(name = SELECTION_FORM, binding = false) InterviewOverviewSelectionForm selectionForm, @SuppressWarnings("unu... | @Test public void overview() throws Exception { int page = 1; List<Long> inviteIds = asList(1L, 2L); List<AssessorInviteOverviewResource> assessorInviteOverviewResources = setUpAssessorInviteOverviewResources(); AssessorInviteOverviewPageResource pageResource = newAssessorInviteOverviewPageResource() .withContent(asses... |
AssessorManagementController { private boolean hasApplicationsAssigned(long userId) { return assessorRestService.hasApplicationsAssigned(userId).getSuccess(); } @GetMapping String viewUser(@PathVariable long userId,
Model model); @GetMapping("/status") String viewStatus(@ModelAttribute(name ... | @Test public void viewFindExternalUsers() throws Exception { long userId = 1L; long modifiedId = 2L; RoleProfileStatusResource roleProfileStatusResource = newRoleProfileStatusResource().withModifiedBy(modifiedId).build(); UserResource userResource = newUserResource().build(); when(roleProfileStatusRestService.findByUse... |
AssessorManagementController { @GetMapping("/status") public String viewStatus(@ModelAttribute(name = "form") ChangeRoleProfileForm form, @PathVariable long userId, Model model) { RoleProfileStatusResource roleProfileStatus = getRoleProfileViewModel(userId).getRoleProfileStatus(); if (form.getRoleProfileState() == null... | @Test public void viewStatus() throws Exception { long userId = 1L; long modifiedId = 2L; RoleProfileStatusResource roleProfileStatusResource = newRoleProfileStatusResource() .withUserId(userId) .withProfileRole(ASSESSOR) .withRoleProfileState(RoleProfileState.ACTIVE) .withModifiedBy(modifiedId) .build(); UserResource ... |
StakeholderServiceImpl implements StakeholderService { @Override public ServiceResult<Void> createStakeholder(String inviteHash, RegistrationForm form) { StakeholderRegistrationResource stakeholderRegistrationResource = new StakeholderRegistrationResource(); stakeholderRegistrationResource.setPassword(form.getPassword(... | @Test public void createStakeholder() { RegistrationForm registrationForm = new RegistrationForm("Billy", "Ocean", "Passw0rd"); StakeholderRegistrationResource stakeholderRegistrationResource = newStakeholderRegistrationResource() .withFirstName(registrationForm.getFirstName()) .withLastName(registrationForm.getLastNam... |
InternalUserServiceImpl implements InternalUserService { @Override public ServiceResult<Void> createInternalUser(String inviteHash, RegistrationForm registrationForm) { InternalUserRegistrationResource internalUserRegistrationResource = new InternalUserRegistrationResource(); internalUserRegistrationResource.setPasswor... | @Test public void testCreateInternalUser(){ RegistrationForm registrationForm = new RegistrationForm("Arden", "Pimenta", "Passw0rd"); InternalUserRegistrationResource internalUserRegistrationResource = newInternalUserRegistrationResource() .withFirstName(registrationForm.getFirstName()) .withLastName(registrationForm.g... |
InternalUserServiceImpl implements InternalUserService { @Override public ServiceResult<Void> editInternalUser(EditUserResource editUserResource) { return userRestService.editInternalUser(editUserResource).toServiceResult(); } @Override ServiceResult<Void> createInternalUser(String inviteHash, RegistrationForm registr... | @Test public void editInternalUser() throws Exception { EditUserResource editUserResource = new EditUserResource(); when(userRestServiceMock.editInternalUser(editUserResource)).thenReturn(restSuccess()); ServiceResult<Void> result = service.editInternalUser(editUserResource); assertTrue(result.isSuccess()); verify(user... |
StakeholderRegistrationController { @PostMapping("/{inviteHash}/register") public String submitYourDetails(Model model, @PathVariable("inviteHash") String inviteHash, @Valid @ModelAttribute(FORM_ATTR_NAME) RegistrationForm form, BindingResult bindingResult, ValidationHandler validationHandler, UserResource loggedInUser... | @Test public void submitYourDetails() throws Exception { setLoggedInUser(null); RegistrationForm registrationForm = new RegistrationForm("Tyler", "Newall", "Passw0rd"); registrationForm.setEmail("tyler.newall@gmail.com"); StakeholderInviteResource inviteResource = newStakeholderInviteResource() .withStatus(InviteStatus... |
StakeholderRegistrationController { @GetMapping(value = "/{inviteHash}/register/account-created") public String accountCreated(@PathVariable("inviteHash") String inviteHash, UserResource loggedInUser) { boolean userIsLoggedIn = loggedInUser != null; if (userIsLoggedIn) { return "redirect:/"; } return competitionSetupSt... | @Test public void accountCreated() throws Exception { setLoggedInUser(null); StakeholderInviteResource inviteResource = newStakeholderInviteResource() .withStatus(InviteStatus.OPENED) .build(); when(competitionSetupStakeholderRestServiceMock.getStakeholderInvite("hash")).thenReturn(RestResult.restSuccess(inviteResource... |
MonitoringOfficerRegistrationController { @GetMapping("/{inviteHash}/register") public String openInvite(@PathVariable("inviteHash") String inviteHash, Model model, HttpServletRequest request, @ModelAttribute("form") RegistrationForm form, UserResource loggedInUser) { if (loggedInUser != null) { if (!competitionSetupMo... | @Test public void openInvite() throws Exception { setLoggedInUser(null); String hash = "hash"; MonitoringOfficerInviteResource monitoringOfficerInviteResource = newMonitoringOfficerInviteResource() .withEmail("tom@poly.io") .build(); RegistrationViewModel expectedViewModel = RegistrationViewModelBuilder.aRegistrationVi... |
MonitoringOfficerRegistrationController { @PostMapping("/{inviteHash}/register") public String submitDetails(Model model, @PathVariable("inviteHash") String inviteHash, @ModelAttribute(FORM_ATTR_NAME) @Validated({Default.class, PhoneNumberValidationGroup.class}) RegistrationForm monitoringOfficerRegistrationForm, Bindi... | @Test public void submitDetails() throws Exception { setLoggedInUser(null); String hash = "hash"; RegistrationForm registrationForm = new RegistrationForm(); registrationForm.setFirstName("Tom"); registrationForm.setLastName("Baldwin"); registrationForm.setPassword("Passw0rd"); registrationForm.setEmail("tom.baldwin@gm... |
MonitoringOfficerRegistrationController { @GetMapping(value = "/{inviteHash}/register/account-created") public String accountCreated(@PathVariable("inviteHash") String inviteHash, HttpServletRequest request, UserResource loggedInUser) { boolean userIsLoggedIn = loggedInUser != null; if (userIsLoggedIn) { return dashboa... | @Test public void accountCreated() throws Exception { setLoggedInUser(null); String hash = "hash"; MonitoringOfficerInviteResource inviteResource = newMonitoringOfficerInviteResource() .withStatus(InviteStatus.OPENED) .build(); when(competitionSetupMonitoringOfficerRestServiceMock.getMonitoringOfficerInvite(hash)) .the... |
InternalUserRegistrationController { @GetMapping("/{inviteHash}/register") public String yourDetails(Model model, @PathVariable("inviteHash") String inviteHash, @ModelAttribute(name = FORM_ATTR_NAME, binding = false) RegistrationForm form, UserResource loggedInUser) { RoleInviteResource invite = inviteUserRestService.g... | @Test public void testYourDetails() throws Exception { setLoggedInUser(null); when(inviteUserRestServiceMock.getInvite("hash")).thenReturn(restSuccess(newRoleInviteResource().build())); RegistrationViewModel viewModel = aRegistrationViewModel().withPhoneRequired(false).withTermsRequired(false).withInvitee(true).build()... |
InternalUserRegistrationController { @PostMapping("/{inviteHash}/register") public String submitYourDetails(Model model, @PathVariable("inviteHash") String inviteHash, @Valid @ModelAttribute(FORM_ATTR_NAME) RegistrationForm registrationForm, BindingResult bindingResult, ValidationHandler validationHandler, UserResource... | @Test public void testSubmitYourDetails() throws Exception { setLoggedInUser(null); RegistrationForm registrationForm = new RegistrationForm(); registrationForm.setFirstName("Arden"); registrationForm.setLastName("Pimenta"); registrationForm.setPassword("Passw0rd"); registrationForm.setEmail("arden.piment@innovateuk.te... |
InternalUserRegistrationController { @GetMapping(value = "/{inviteHash}/register/account-created") public String accountCreated(@PathVariable("inviteHash") String inviteHash, UserResource loggedInUser) { boolean userIsLoggedIn = loggedInUser != null; if (userIsLoggedIn) { return "redirect:/"; } return inviteUserRestSer... | @Test public void testAccountCreated() throws Exception { setLoggedInUser(null); when(inviteUserRestServiceMock.checkExistingUser("hash")).thenReturn(RestResult.restSuccess(true)); mockMvc.perform(get(URL_PREFIX + "/hash/register/account-created")) .andExpect(status().isOk()) .andExpect(view().name("registration/accoun... |
ReviewPermissionRules { @PermissionRule(value = "REVIEW", description = "Only project finance or competition admin can see review panels" + "if the competition is in the correct state.") public boolean reviewPanel(CompetitionCompositeId competitionCompositeId, UserResource loggedInUser) { CompetitionResource competitio... | @Test public void reviewPanel() { UserResource loggedInUser = compAdminUser(); for (CompetitionStatus competitionStatus : CompetitionStatus.values()) { final CompetitionResource competitionWithInterviewStage = newCompetitionResource() .withCompetitionStatus(competitionStatus) .build(); CompetitionAssessmentConfigResour... |
ReviewPermissionRules { @PermissionRule(value = "REVIEW_APPLICATIONS", description = "Only project finance or competition admin can " + "see review panel applications if the competition is in the correct state.") public boolean reviewPanelApplications(CompetitionCompositeId competitionCompositeId, UserResource loggedIn... | @Test public void reviewPanelApplications() { UserResource loggedInUser = compAdminUser(); for (CompetitionStatus competitionStatus : CompetitionStatus.values()) { final CompetitionResource competitionWithInterviewStage = newCompetitionResource() .withCompetitionStatus(competitionStatus) .build(); CompetitionAssessment... |
ReviewSendInviteController extends CompetitionManagementCookieController<ReviewOverviewSelectionForm> { @PostMapping("/send") public String sendInvites(Model model, @PathVariable("competitionId") long competitionId, @ModelAttribute("form") @Valid SendInviteForm form, BindingResult bindingResult, ValidationHandler valid... | @Test public void sendInvites() throws Exception { long competitionId = 5L; AssessorInviteSendResource expectedAssessorInviteSendResource = newAssessorInviteSendResource() .withSubject("Subject...") .withContent("Editable content...") .build(); when(reviewInviteRestService.sendAllInvites(competitionId, expectedAssessor... |
ReviewSendInviteController extends CompetitionManagementCookieController<ReviewOverviewSelectionForm> { @PostMapping("/resend") public String resendInvites (Model model, @PathVariable("competitionId") long competitionId, @ModelAttribute("form") @Valid ResendInviteForm form, BindingResult bindingResult, ValidationHandle... | @Test public void resendInvites() throws Exception { List<Long> inviteIds = asList(1L, 2L); AssessorInvitesToSendResource invite = newAssessorInvitesToSendResource().withCompetitionId(competition.getId()).build(); AssessorInviteSendResource expectedAssessorInviteSendResource = newAssessorInviteSendResource() .withSubje... |
ReviewManageApplicationsController { @GetMapping("/manage-applications") public String manageApplications(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(value = "page", defaultValue = "0") int page, @RequestParam(value = "filterSearch", defaultValue = "") String filter, @RequestParam(valu... | @Test public void manageApplications() throws Exception { CompetitionResource competitionResource = newCompetitionResource() .withId(1L) .withName("name") .withCompetitionStatus(IN_ASSESSMENT) .build(); List<ApplicationSummaryResource> summaryResources = newApplicationSummaryResource() .withId(1L, 2L) .withName("one", ... |
ReviewInviteAssessorsController extends CompetitionManagementCookieController<ReviewSelectionForm> { @GetMapping public String assessors(@PathVariable("competitionId") long competitionId) { return format("redirect:/competition/%s/assessors/panel-find", competitionId); } @GetMapping String assessors(@PathVariable("comp... | @Test public void assessors() throws Exception { Long competitionId = 1L; mockMvc.perform(get("/assessment/panel/competition/{competitionId}/assessors", competitionId)) .andExpect(status().is3xxRedirection()) .andExpect(redirectedUrl(format("/competition/%s/assessors/panel-find", competitionId))); } |
ReviewInviteAssessorsController extends CompetitionManagementCookieController<ReviewSelectionForm> { @GetMapping("/find") public String find(Model model, @ModelAttribute(name = SELECTION_FORM, binding = false) ReviewSelectionForm selectionForm, @SuppressWarnings("unused") BindingResult bindingResult, @PathVariable("com... | @Test public void find() throws Exception { int page = 2; AvailableAssessorPageResource availableAssessorPageResource = newAvailableAssessorPageResource() .withContent(setUpAvailableAssessorResources()) .build(); when(reviewInviteRestService.getAvailableAssessors(competition.getId(), page)).thenReturn(restSuccess(avail... |
ReviewInviteAssessorsController extends CompetitionManagementCookieController<ReviewSelectionForm> { @GetMapping("/invite") public String invite(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(defaultValue = "0") int page) { model.addAttribute("model", panelInviteAssessorsInviteModelPopula... | @Test public void invite() throws Exception { int page = 0; List<AssessorCreatedInviteResource> assessorCreatedInviteResources = setUpAssessorCreatedInviteResources(); AssessorCreatedInvitePageResource assessorCreatedInvitePageResource = newAssessorCreatedInvitePageResource() .withContent(assessorCreatedInviteResources... |
ReviewInviteAssessorsController extends CompetitionManagementCookieController<ReviewSelectionForm> { @GetMapping("/accepted") public String accepted(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(defaultValue = "0") int page) { model.addAttribute("model", panelInviteAssessorsAcceptedModel... | @Test public void accepted() throws Exception { int page = 1; List<ParticipantStatusResource> status = Collections.singletonList(ACCEPTED); List<AssessorInviteOverviewResource> assessorInviteOverviewResources = setUpAssessorInviteOverviewResources(); AssessorInviteOverviewPageResource pageResource = newAssessorInviteOv... |
ReviewInviteAssessorsController extends CompetitionManagementCookieController<ReviewSelectionForm> { @PostMapping(value = "/invite", params = {"remove"}) public String removeInviteFromInviteView(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(name = "remove") String email, @RequestParam(de... | @Test public void removeInviteFromInviteView() throws Exception { String email = "firstname.lastname@example.com"; when(reviewInviteRestService.deleteInvite(email, competition.getId())).thenReturn(restSuccess()); mockMvc.perform(post("/assessment/panel/competition/{competitionId}/assessors/invite", competition.getId())... |
GoogleAnalyticsDataLayerController { @GetMapping("/application/{applicationId}/competition-name") public RestResult<String> getCompetitionNameForApplication(@PathVariable("applicationId") long applicationId) { return googleAnalyticsDataLayerService.getCompetitionNameByApplicationId(applicationId).toGetResponse(); } @G... | @Test public void getCompetitionNameForApplication() throws Exception { final long applicationId=7L; final String competitionName="Competition Name"; when(googleAnalyticsDataLayerServiceMock.getCompetitionNameByApplicationId(applicationId)) .thenReturn(serviceSuccess(competitionName)); mockMvc.perform(get("/analytics/a... |
ReviewInviteAssessorsController extends CompetitionManagementCookieController<ReviewSelectionForm> { private ServiceResult<Void> deleteInvite(String email, long competitionId) { return reviewInviteRestService.deleteInvite(email, competitionId).toServiceResult(); } @GetMapping String assessors(@PathVariable("competitio... | @Test public void removeInviteFromInviteView_defaultParams() throws Exception { String email = "firstname.lastname@example.com"; when(reviewInviteRestService.deleteInvite(email, competition.getId())).thenReturn(restSuccess()); mockMvc.perform(post("/assessment/panel/competition/{competitionId}/assessors/invite", compet... |
ReviewInviteAssessorsController extends CompetitionManagementCookieController<ReviewSelectionForm> { @PostMapping(value = "/invite", params = {"removeAll"}) public String removeAllInvitesFromInviteView(Model model, @PathVariable("competitionId") long competitionId, @RequestParam(defaultValue = "0") int page, @SuppressW... | @Test public void removeAllInvitesFromInviteView() throws Exception { when(reviewInviteRestService.deleteAllInvites(competition.getId())).thenReturn(restSuccess()); mockMvc.perform(post("/assessment/panel/competition/{competitionId}/assessors/invite", competition.getId()) .param("removeAll", "")) .andExpect(status().is... |
ReviewController { @GetMapping public String assessmentPanel(@PathVariable("competitionId") long competitionId, Model model) { model.addAttribute("model", reviewModelPopulator.populateModel(competitionId)); return "competition/manage-assessment-panel"; } @GetMapping String assessmentPanel(@PathVariable("competitionId"... | @Test public void assessmentPanel() throws Exception { long competitionId = 1L; String competitionName = "Competition x"; CompetitionStatus competitionStatus = CLOSED; int applicationsInPanel = 5; int assessorsAccepted = 2; int assessorsPending = 3; boolean reviewsPending = true; competitionResource = newCompetitionRes... |
ReviewController { @PostMapping("/notify-assessors") public String notifyAssessors(@PathVariable("competitionId") long competitionId) { reviewRestService.notifyAssessors(competitionId).getSuccess(); return format("redirect:/assessment/panel/competition/%d", competitionId); } @GetMapping String assessmentPanel(@PathVar... | @Test public void notifyAssessors() throws Exception { long competitionId = 1L; when(reviewRestService.notifyAssessors(competitionId)).thenReturn(restSuccess()); mockMvc.perform(post("/assessment/panel/competition/{competitionId}/notify-assessors", competitionId)) .andExpect(status().is3xxRedirection()) .andExpect(Mock... |
ReviewInviteAssessorsOverviewController extends CompetitionManagementCookieController<ReviewOverviewSelectionForm> { @GetMapping("/pending-and-declined") public String overview(Model model, @ModelAttribute(name = SELECTION_FORM, binding = false) ReviewOverviewSelectionForm selectionForm, @SuppressWarnings("unused") Bin... | @Test public void overview() throws Exception { int page = 1; List<Long> inviteIds = asList(1L, 2L); List<AssessorInviteOverviewResource> assessorInviteOverviewResources = setUpAssessorInviteOverviewResources(); AssessorInviteOverviewPageResource pageResource = newAssessorInviteOverviewPageResource() .withContent(asses... |
InviteUserServiceImpl implements InviteUserService { @Override public ServiceResult<Void> saveUserInvite (InviteUserResource inviteUserResource) { return inviteUserRestService.saveUserInvite(inviteUserResource).toServiceResult(); } @Override ServiceResult<Void> saveUserInvite(InviteUserResource inviteUserResource); } | @Test public void saveProjectInvite() throws Exception { InviteUserResource inviteUserResource = new InviteUserResource(); when(inviteUserRestService.saveUserInvite(inviteUserResource)).thenReturn(restSuccess()); ServiceResult<Void> result = service.saveUserInvite(inviteUserResource); assertTrue(result.isSuccess()); ve... |
InviteUserController { @PostMapping("/invite-user") public String saveUserInvite(Model model, @Validated({Default.class, Primary.class}) @ModelAttribute(FORM_ATTR_NAME) InviteUserForm form, @SuppressWarnings("unused") BindingResult bindingResult, ValidationHandler validationHandler) { Supplier<String> failureView = () ... | @Test public void saveInternalUserInviteWhenSaveInviteFails() throws Exception { when(inviteUserServiceMock.saveUserInvite(Mockito.any())) .thenReturn(ServiceResult.serviceFailure(CommonFailureKeys.USER_ROLE_INVITE_TARGET_USER_ALREADY_INVITED)); mockMvc.perform(MockMvcRequestBuilders.post("/admin/invite-user"). param("... |
GoogleAnalyticsDataLayerController { @GetMapping("/invite/{inviteHash}/competition-name") public RestResult<String> getCompetitionNameForInvite(@PathVariable("inviteHash") String inviteHash) { return googleAnalyticsDataLayerService.getCompetitionNameByInviteHash(inviteHash).toGetResponse(); } @GetMapping("/application... | @Test public void getCompetitionNameForInvite() throws Exception { final String inviteHash = new UUID(1L, 1L).toString(); final String competitionName="Competition Name"; when(googleAnalyticsDataLayerServiceMock.getCompetitionNameByInviteHash(inviteHash)) .thenReturn(serviceSuccess(competitionName)); mockMvc.perform(ge... |
UsersManagementController extends AsyncAdaptor { private String view(Model model, String activeTab, String filter, int page, int size, boolean adminUser) { final CompletableFuture<ManageUserPageResource> activeUsers; final CompletableFuture<ManageUserPageResource> inactiveUsers; final CompletableFuture<RoleInvitePageRe... | @Test public void viewActive() throws Exception { when(userRestService.getActiveExternalUsers(null, 0, 5)).thenReturn(restSuccess(manageUserPageResource)); when(userRestService.getInactiveExternalUsers(null, 0, 5)).thenReturn(restSuccess(manageUserPageResource)); mockMvc.perform(get("/admin/users/active") .param("page"... |
UsersManagementController extends AsyncAdaptor { @SecuredBySpring(value = "RESEND_INTERNAL_USER_INVITE", description = "Only the IFS Administrators can resend invites to internal users") @PreAuthorize("hasAuthority('ifs_administrator')") @PostMapping("/pending/resend-invite") public String resendInvite(@RequestParam("i... | @Test public void resendInvite() throws Exception { when(inviteUserRestService.resendInternalUserInvite(123L)). thenReturn(restSuccess()); mockMvc.perform(post("/admin/users/pending/resend-invite?inviteId=" + 123L)) .andExpect(status().is3xxRedirection()) .andExpect(view().name("redirect:/admin/users/pending")); verify... |
UserManagementController extends AsyncAdaptor { @PreAuthorize("hasAnyAuthority('ifs_administrator', 'support')") @SecuredBySpring(value = "UserManagementController.viewUser() method", description = "IFS admins and support users can view users.") @GetMapping("/user/{userId}") public String viewUser(@PathVariable long us... | @Test public void viewUser() throws Exception { ZonedDateTime now = ZonedDateTime.now(); UserResource user = newUserResource().withCreatedOn(now).withCreatedBy("abc").withModifiedOn(now).withModifiedBy("abc").build(); when(userRestServiceMock.retrieveUserById(1L)).thenReturn(restSuccess(user)); mockMvc.perform(get("/ad... |
UserManagementController extends AsyncAdaptor { @PreAuthorize("hasAnyAuthority('ifs_administrator', 'support')") @SecuredBySpring(value = "UserManagementController.deactivateUser() method", description = "IFS admins and support users can deactivate users.") @PostMapping(value = "/user/{userId}/active", params = "deacti... | @Test public void deactivateUserSuccess() throws Exception { String email = "asdf@asdf.com"; Role role = IFS_ADMINISTRATOR; UserResource userResource = newUserResource() .withFirstName("first") .withLastName("last") .withEmail(email) .withRolesGlobal(Collections.singletonList(role)) .build(); when(userRestServiceMock.r... |
UserManagementController extends AsyncAdaptor { @PreAuthorize("hasAnyAuthority('ifs_administrator', 'support')") @SecuredBySpring(value = "UserManagementController.reactivateUser() method", description = "IFS admins and support users can reactivate users.") @PostMapping(value = "/user/{userId}/inactive", params = "reac... | @Test public void reactivateUserSuccess() throws Exception { String email = "asdf@asdf.com"; Role role = IFS_ADMINISTRATOR; UserResource userResource = newUserResource() .withFirstName("first") .withLastName("last") .withEmail(email) .withRolesGlobal(Collections.singletonList(role)) .build(); when(userRestServiceMock.r... |
UserManagementController extends AsyncAdaptor { @AsyncMethod @SecuredBySpring(value = "UserManagementController.viewAvailableAssessors() method", description = "Only comp admin and project finance can view active assessors") @PreAuthorize("hasAnyAuthority('comp_admin' , 'project_finance')") @GetMapping("/assessors/avai... | @Test public void viewAvailableAssessors() throws Exception { when(roleProfileStatusRestServiceMock.getAvailableAssessors(null, 0, 5)).thenReturn(restSuccess(userPageResource)); when(roleProfileStatusRestServiceMock.getUnavailableAssessors(null, 0, 5)).thenReturn(restSuccess(userPageResource)); when(roleProfileStatusRe... |
GoogleAnalyticsDataLayerController { @GetMapping("/competition/{competitionId}/competition-name") public RestResult<String> getCompetitionName(@PathVariable("competitionId") long competitionId) { return googleAnalyticsDataLayerService.getCompetitionName(competitionId).toGetResponse(); } @GetMapping("/application/{appl... | @Test public void getCompetitionName() throws Exception { final long competitionId=7L; final String competitionName="Competition Name"; when(googleAnalyticsDataLayerServiceMock.getCompetitionName(competitionId)) .thenReturn(serviceSuccess(competitionName)); mockMvc.perform(get("/analytics/competition/{competitionId}/co... |
UserManagementController extends AsyncAdaptor { @AsyncMethod @SecuredBySpring(value = "UserManagementController.viewAvailableAssessors() method", description = "Only comp admin and project finance can view unavailable assessors") @PreAuthorize("hasAnyAuthority('comp_admin' , 'project_finance')") @GetMapping("/assessors... | @Test public void viewUnavailableAssessors() throws Exception { when(roleProfileStatusRestServiceMock.getAvailableAssessors(null, 0, 5)).thenReturn(restSuccess(userPageResource)); when(roleProfileStatusRestServiceMock.getUnavailableAssessors(null, 0, 5)).thenReturn(restSuccess(userPageResource)); when(roleProfileStatus... |
UserManagementController extends AsyncAdaptor { @AsyncMethod @SecuredBySpring(value = "UserManagementController.viewAvailableAssessors() method", description = "Only comp admin and project finance can view disabled assessors") @PreAuthorize("hasAnyAuthority('comp_admin' , 'project_finance')") @GetMapping("/assessors/di... | @Test public void viewDisabledAssessors() throws Exception { when(roleProfileStatusRestServiceMock.getAvailableAssessors(null, 0, 5)).thenReturn(restSuccess(userPageResource)); when(roleProfileStatusRestServiceMock.getUnavailableAssessors(null, 0, 5)).thenReturn(restSuccess(userPageResource)); when(roleProfileStatusRes... |
ExternalUserManagementController { @SecuredBySpring(value = "FIND_EXTERNAL_USERS", description = "Only the support user or IFS Admin can access external user information") @PreAuthorize("hasAnyAuthority('support', 'ifs_administrator')") @GetMapping(value = "/users") public String viewFindExternalUsers(@ModelAttribute(F... | @Test public void viewFindExternalUsers() throws Exception { mockMvc.perform(get("/admin/external/users")) .andExpect(status().isOk()) .andExpect(view().name("admin/search-external-users")) .andExpect(model().attribute("form", new SearchExternalUsersForm())) .andExpect(model().attribute("tab", "users")) .andExpect(mode... |
ExternalUserManagementController { @SecuredBySpring(value = "FIND_EXTERNAL_INVITES", description = "Only the support user or IFS Admin can access external user invites") @PreAuthorize("hasAnyAuthority('support', 'ifs_administrator')") @GetMapping(value = "/invites") public String viewFindExternalInvites(@ModelAttribute... | @Test public void viewFindExternalInvites() throws Exception { mockMvc.perform(get("/admin/external/invites")) .andExpect(status().isOk()) .andExpect(view().name("admin/search-external-users")) .andExpect(model().attribute("form", new SearchExternalUsersForm())) .andExpect(model().attribute("tab", "invites")) .andExpec... |
ExternalUserManagementController { @SecuredBySpring(value = "FIND_EXTERNAL_USERS", description = "Only the support user or IFS Admin can access external user information") @PreAuthorize("hasAnyAuthority('support', 'ifs_administrator')") @PostMapping({"/users", "/invites"}) public String findExternalUsers(@Valid @ModelA... | @Test public void findExternalUsers() throws Exception { String searchString = "smith"; when(userRestService.findExternalUsers(searchString, SearchCategory.EMAIL)).thenReturn(restSuccess(emptyList())); mockMvc.perform(post("/admin/external/users"). param("searchString", searchString). param("searchCategory", "EMAIL")) ... |
ExternalUserManagementController { private String findExternalInvites(SearchExternalUsersForm form, ValidationHandler validationHandler, Model model) { Supplier<String> failureView = () -> viewFindExternalInvites(form, model); return validationHandler.failNowOrSucceedWith(failureView, () -> { RestResult<List<ExternalIn... | @Test public void findExternalInvites() throws Exception { String searchString = "smith"; when(inviteUserRestService.findExternalInvites(searchString, SearchCategory.ORGANISATION_NAME)).thenReturn(restSuccess(emptyList())); mockMvc.perform(post("/admin/external/users"). param("searchString", searchString). param("searc... |
FinanceChecksQueriesController { private Optional<ProjectUserResource> getFinanceContact(Long projectId, Long organisationId) { List<ProjectUserResource> projectUsers = projectService.getProjectUsersForProject(projectId); return simpleFindFirst(projectUsers, pr -> pr.isFinanceContact() && organisationId.equals(pr.getOr... | @Test public void testGetReadOnlyView() throws Exception { ProjectFinanceResource projectFinanceResource = newProjectFinanceResource().withProject(projectId).withOrganisation(applicantOrganisationId).withId(projectFinanceId).build(); when(projectFinanceService.getProjectFinance(projectId, applicantOrganisationId)).then... |
FinanceChecksQueriesController { @PreAuthorize("hasPermission(#projectId, 'org.innovateuk.ifs.project.resource.ProjectCompositeId', 'ACCESS_FINANCE_CHECKS_QUERIES_SECTION')") @PostMapping("/{queryId}/close") public String closeQuery(@PathVariable Long projectId, @PathVariable Long organisationId, @PathVariable Long que... | @Test public void testCloseQuery() throws Exception { Long queryId = 1L; when(financeCheckServiceMock.closeQuery(queryId)).thenReturn(ServiceResult.serviceSuccess()); mockMvc.perform(post("/project/" + projectId + "/finance-check/organisation/" + applicantOrganisationId + "/query/{queryId}/close", queryId)) .andExpect(... |
GoogleAnalyticsDataLayerController { @GetMapping("/project/{projectId}/competition-name") public RestResult<String> getCompetitionNameForProject(@PathVariable("projectId") long projectId) { return googleAnalyticsDataLayerService.getCompetitionNameByProjectId(projectId).toGetResponse(); } @GetMapping("/application/{app... | @Test public void getCompetitionNameForProject() throws Exception { final long projectId=7L; final String competitionName="Competition Name"; when(googleAnalyticsDataLayerServiceMock.getCompetitionNameByProjectId(projectId)) .thenReturn(serviceSuccess(competitionName)); mockMvc.perform(get("/analytics/project/{projectI... |
FinanceChecksQueriesController { @PreAuthorize("hasPermission(#projectId, 'org.innovateuk.ifs.project.resource.ProjectCompositeId', 'ACCESS_FINANCE_CHECKS_QUERIES_SECTION')") @GetMapping("/{queryId}/new-response") public String viewNewResponse(@P("projectId")@PathVariable Long projectId, @PathVariable Long organisation... | @Test public void testViewNewResponse() throws Exception { ProjectFinanceResource projectFinanceResource = newProjectFinanceResource().withProject(projectId).withOrganisation(applicantOrganisationId).withId(projectFinanceId).build(); when(projectFinanceService.getProjectFinance(projectId, applicantOrganisationId)).then... |
FinanceChecksQueriesController { @PreAuthorize("hasPermission(#projectId, 'org.innovateuk.ifs.project.resource.ProjectCompositeId', 'ACCESS_FINANCE_CHECKS_QUERIES_SECTION')") @PostMapping(value = "/{queryId}/new-response", params = "uploadAttachment") public String saveNewResponseAttachment(Model model, @P("projectId")... | @Test public void testSaveNewResponseAttachment() throws Exception { MockMultipartFile uploadedFile = new MockMultipartFile("attachment", "testFile.pdf", "application/pdf", "My content!".getBytes()); AttachmentResource attachment = new AttachmentResource(1L, "name", "mediaType", 2L, null); when(financeCheckServiceMock.... |
FinanceChecksQueriesController { @PreAuthorize("hasPermission(#projectId, 'org.innovateuk.ifs.project.resource.ProjectCompositeId', 'ACCESS_FINANCE_CHECKS_QUERIES_SECTION')") @PostMapping(value = "/{queryId}/new-response", params = "removeAttachment") public String removeAttachment(@P("projectId")@PathVariable Long pro... | @Test public void testRemoveAttachment() throws Exception { ProjectFinanceResource projectFinanceResource = newProjectFinanceResource().withProject(projectId).withOrganisation(applicantOrganisationId).withId(projectFinanceId).build(); when(projectFinanceService.getProjectFinance(projectId, applicantOrganisationId)).the... |
FinanceReviewerController { @GetMapping public String financeReviewer(@ModelAttribute(value = "form", binding = false) FinanceReviewerForm form, BindingResult bindingResult, @PathVariable long projectId, Model model) { model.addAttribute("model", new FinanceReviewerViewModel(projectRestService.getProjectById(projectId)... | @Test public void financeReviewer() throws Exception { long projectId = 1L; long competitionId = 2L; List<SimpleUserResource> users = newSimpleUserResource().build(1); ProjectResource project = newProjectResource() .withId(projectId) .withCompetition(competitionId) .withName("Project") .build(); when(financeReviewerRes... |
CompetitionStatusController { @SecuredBySpring(value = "TODO", description = "TODO") @GetMapping("/pending-spend-profiles") @PreAuthorize("hasAnyAuthority('project_finance')") public String viewPendingSpendProfiles(Model model, UserResource loggedInUser, @PathVariable Long competitionId) { long openQueryCount = competi... | @Test public void viewPendingSpendProfiles() throws Exception { long competitionId = 123L; setLoggedInUser(newUserResource().withRolesGlobal(singletonList(Role.PROJECT_FINANCE)).build()); SpendProfileStatusResource pendingSpendProfile1 = new SpendProfileStatusResource(11L, 1L, "Project Name 1"); SpendProfileStatusResou... |
CompetitionStatusController { @PreAuthorize("hasAuthority('project_finance')") @SecuredBySpring(value = "EXPORT_BANK_DETAILS", description = "Project finance users should be able export bank details") @GetMapping("/bank-details/export") public void exportBankDetails(Model model, UserResource loggedInUser, @PathVariable... | @Test public void exportBankDetails() throws Exception { Long competitionId = 123L; ByteArrayResource result = new ByteArrayResource("My content!".getBytes()); when(bankDetailsRestServiceMock.downloadByCompetition(competitionId)).thenReturn(restSuccess(result)); DateTimeFormatter formatter = DateTimeFormatter.ofPattern... |
ProjectFinancePartnerFundingLevelViewModel { public boolean isTotalGrantZero() { return (totalGrant.compareTo(BigDecimal.ZERO) == 0); } ProjectFinancePartnerFundingLevelViewModel(long id,
String name,
boolean lea... | @Test public void isTotalGrantZeroWithZeroTotalGrant() { ProjectFinancePartnerFundingLevelViewModel model = new ProjectFinancePartnerFundingLevelViewModel(1L, null, false, 0, null, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, new BigDecimal("0")); assertTrue(model.isTotalGrantZero()); }
@Test public void isTotalG... |
GoogleAnalyticsDataLayerController { @GetMapping("/assessment/{assessmentId}/competition-name") public RestResult<String> getCompetitionNameForAssessment(@PathVariable("assessmentId") long assessmentId) { return googleAnalyticsDataLayerService.getCompetitionNameByAssessmentId(assessmentId).toGetResponse(); } @GetMappi... | @Test public void getCompetitionNameForAssessment() throws Exception { final long assessmentId=7L; final String competitionName="Competition Name"; when(googleAnalyticsDataLayerServiceMock.getCompetitionNameByAssessmentId(assessmentId)) .thenReturn(serviceSuccess(competitionName)); mockMvc.perform(get("/analytics/asses... |
ProjectFinanceFundingLevelController { @GetMapping public String viewFundingLevels(@ModelAttribute(name = "form", binding = false) ProjectFinanceFundingLevelForm form, @PathVariable long projectId, Model model, BindingResult bindingResult) { List<ProjectFinanceResource> projectFinances = projectFinanceRestService.getPr... | @Test public void viewFundingLevels() throws Exception { when(projectFinanceRestService.getProjectFinances(projectId)).thenReturn(restSuccess(asList(industrialFinances, academicFinances))); when(projectRestService.getProjectById(projectId)).thenReturn(restSuccess(project)); when(projectRestService.getLeadOrganisationBy... |
ProjectFinanceFundingSoughtController { @GetMapping public String viewFundingLevels(@ModelAttribute(name = "form", binding = false) ProjectFinanceFundingSoughtForm form, @PathVariable long projectId, Model model) { List<ProjectFinanceResource> finances = projectFinanceRestService.getProjectFinances(projectId).getSucces... | @Test public void viewFundingLevels() throws Exception { when(projectFinanceRestService.getProjectFinances(projectId)).thenReturn(restSuccess(asList(industrialFinances, academicFinances))); when(projectRestService.getProjectById(projectId)).thenReturn(restSuccess(project)); MvcResult result = mockMvc.perform(get("/proj... |
ProjectPartnerController { @GetMapping public String inviteProjectPartnerForm(@ModelAttribute(value = "form", binding = false) ProjectPartnerInviteForm form, BindingResult bindingResult, @PathVariable long projectId, Model model) { ProjectResource project = projectRestService.getProjectById(projectId).getSuccess(); mod... | @Test public void inviteProjectPartnerForm() throws Exception { long projectId = 999L; long competitionId = 888L; long applicationId = 444L; ProjectResource project = newProjectResource() .withId(projectId) .withCompetition(competitionId) .withApplication(applicationId) .withName("project") .build(); when(projectRestSe... |
ProjectPartnerController { @PostMapping public String inviteProjectPartner(@Valid @ModelAttribute(value = "form") ProjectPartnerInviteForm form, BindingResult bindingResult, ValidationHandler validationHandler, @PathVariable long competitionId, @PathVariable long projectId, Model model) { Supplier<String> success = () ... | @Test public void inviteProjectPartner() throws Exception { long projectId = 999L; long competitionId = 888L; SendProjectPartnerInviteResource invite = new SendProjectPartnerInviteResource("org", "name", "blah@gmail.com"); when(projectPartnerInviteRestService.invitePartnerOrganisation(projectId, invite)).thenReturn(res... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.