AdminController extends AbstractController { @RequestMapping(value = "adminPatientViewRevokeConsent.html", method = RequestMethod.POST) public String signConsentRevokation( @RequestParam("consentId") long consentId, @RequestParam("revokationType") String revokationType, @RequestParam("patientId") long patientId) { consentService.addUnsignedConsentRevokationPdf(consentId, revokationType); ConsentRevokationPdfDto consentRevokationPdfDto = consentService .findConsentRevokationPdfDto(consentId); consentRevokationPdfDto.setRevokationType(revokationType); if (consentService.isConsentBelongToThisUser(consentId, patientId)) { consentService.signConsentRevokation(consentRevokationPdfDto); return "redirect:adminPatientView.html?notify=revokepatientconsent&status=success&id=" + patientId; } return "redirect:adminPatientView.html?notify=revokepatientconsent&status=fail&id=" + patientId; }  @RequestMapping(value = "adminHome.html") String adminHome(Model model, HttpServletRequest request,
			BasicPatientAccountDto basicPatientAccountDto); @RequestMapping(value = "adminPatientView.html") String adminPatientViewByPatientId(
			Model model,
			@RequestParam(value = "id", required = false, defaultValue = "-1") long patientId,
			@RequestParam(value = "username", required = false) String userName,
			@RequestParam(value = "notify", required = false) String notify,
			@RequestParam(value = "status", required = false) String status,
			@RequestParam(value = "duplicateconsent", required = false) String duplicateConsent); @RequestMapping(value = "adminPatientViewSubmitConsent.html", method = RequestMethod.POST) String adminPatientViewSubmitConsent(
			@RequestParam(value = "consentId") long consentId,
			@RequestParam(value = "patientId") long patientId); @RequestMapping(value = "adminPatientViewDeleteConsent", method = RequestMethod.POST) String adminPatientViewDeleteConsent(
			@RequestParam(value = "consentId") long consentId,
			@RequestParam(value = "patientId") long patientId); @RequestMapping(value = "adminEditPatientProfile.html", method = RequestMethod.POST) String adminEditPatientProfile(
			@Valid PatientProfileDto patientProfileDto,
			BindingResult bindingResult, Model model); @RequestMapping(value = "adminPatientViewCreateConsent.html") String adminPatientViewCreateConsent(
			@RequestParam(value = "id", defaultValue = "-1") long patientId,
			Model model); @RequestMapping(value = "adminPatientViewCreateConsent.html", method = RequestMethod.POST) @ResponseBody String adminPatientViewCreateConsent(
			@Valid ConsentDto consentDto,
			@RequestParam("patientId") long patientId,
			BindingResult bindingResult,
			Model model,
			@RequestParam(value = "ICD9", required = false) HashSet<String> icd9,
			@RequestParam(value = "isAddConsent") boolean isAddConsent); @RequestMapping(value = "adminPatientViewRevokeConsent.html", method = RequestMethod.POST) String signConsentRevokation(
			@RequestParam("consentId") long consentId,
			@RequestParam("revokationType") String revokationType,
			@RequestParam("patientId") long patientId); @RequestMapping(value = "adminPatientViewEditConsent.html") String adminPatientViewEditConsent(
			@RequestParam(value = "consentId", defaultValue = "-1") long consentId,
			@RequestParam("patientId") long patientId, Model model); @RequestMapping(value = "editAdminProfile.html") String editAdminProfile(Model model); @RequestMapping(value = "editAdminProfile.html", method = RequestMethod.POST) String profile(@Valid AdminProfileDto adminProfileDto,
			BindingResult bindingResult, Model model); @RequestMapping(value = "/downloadPdf.html", method = RequestMethod.GET) String downloadConsentPdfFile(HttpServletRequest request,
			HttpServletResponse response,
			@RequestParam("consentId") long consentId); @RequestMapping(value = "adminCreatePatientAccount.html", method = RequestMethod.POST) String adminCreatePatientAccount(
			@Valid BasicPatientAccountDto basicPatientAccountDto,
			BindingResult result, RedirectAttributes redirectAttributes,
			Model model); @RequestMapping(value = "sendLoginInformation.html", method = RequestMethod.GET) @ResponseBody String adminSendLoginInfoEmail(
			@RequestParam("patientId") long patientId,
			HttpServletRequest request); @RequestMapping("/patientlookup/query") @ResponseStatus(HttpStatus.OK) @ResponseBody List<PatientAdminDto> getByFirstAndLastName(
			@RequestParam(value = "token", required = true) String token); @RequestMapping(value = "connectionProviderAdd.html", method = RequestMethod.POST) @ResponseBody String addProvider(
			@RequestParam("npi") String npi,
			@RequestParam(value = "patientusername", defaultValue = "") String patientUserName,
			@RequestParam("patientId") String patientId); @RequestMapping(value = "/deleteIndividualProvider", method = RequestMethod.POST) @ResponseBody String deleteIndividualProvider(
			@RequestParam("individualProviderid") long individualProviderid,
			@RequestParam("patientId") String patientId, Model model); @RequestMapping(value = "/deleteOrganizationalProvider", method = RequestMethod.POST) @ResponseBody String deleteOrganizationalProvider(
			@RequestParam("organizationalProviderid") long organizationalProviderid,
			@RequestParam("patientId") String patientId, Model model); @RequestMapping(value = "/addStaffFavoriteIndividualProvider", method = RequestMethod.POST) @ResponseBody String addStaffFavoriteIndividualProvider(
			@RequestParam("providerid") long providerId); @RequestMapping(value = "/isStaffFavoriteIndividualProvider", method = RequestMethod.GET) @ResponseBody String isStaffFavoriteIndividualProvider(
			@RequestParam("providerid") long providerId); @RequestMapping(value = "/isStaffFavoriteOrganizationalProvider", method = RequestMethod.GET) @ResponseBody String isStaffFavoriteOrganizationalProvider(
			@RequestParam("providerid") long providerId); @RequestMapping(value = "/addStaffFavoriteOrganizationalProvider", method = RequestMethod.POST) @ResponseBody String addStaffFavoriteOrganizationalProvider(
			@RequestParam("providerid") long providerId); @RequestMapping(value = "providerSearch.html", method = RequestMethod.GET) String ajaxProviderSearch(HttpServletRequest request,
			HttpServletResponse response); HashMap<String, String> deserializeResult(String providerDtoJSON); static final int NPI_LENGTH; }
@Test public void testSignConsentRevokation_when_authentication_fails() throws Exception { ConsentRevokationPdfDto consentRevokationPdfDto = mock(ConsentRevokationPdfDto.class); when(consentService.findConsentRevokationPdfDto(anyLong())).thenReturn( consentRevokationPdfDto); when(consentService.isConsentBelongToThisUser(anyLong(), anyLong())) .thenReturn(false); mockMvc.perform( post("/Administrator/adminPatientViewRevokeConsent.html") .param("patientId", "1").param("consentId", "1") .param("revokationType", "NO NEVER")) .andExpect( view().name( "redirect:adminPatientView.html?notify=revokepatientconsent&status=fail&id=1")); verify(consentService, never()).signConsentRevokation( consentRevokationPdfDto); }