ClinicalDocumentController implements InitializingBean { @RequestMapping("/clinicaldocuments.html") public String showSecureClinicalDocuments( Model model, @RequestParam(value = "notify", required = false) String notification) { AuthenticatedUser currentUser = userContext.getCurrentUser(); String username = currentUser.getUsername(); PatientProfileDto patientDto = patientService .findPatientProfileByUsername(username); String captchaString = recaptchaUtil.createSecureRecaptchaHtml(); List<ClinicalDocumentDto> clinicaldocumentDtos = clinicalDocumentService .findDtoByPatientDto(patientDto); accessReferenceMapper.setupAccessReferenceMap(clinicaldocumentDtos); List<LookupDto> allDocumentTypeCodes = clinicalDocumentTypeCodeService .findAllClinicalDocumentTypeCodes(); model.addAttribute("clinicaldocumentDtos", clinicaldocumentDtos); model.addAttribute("allDocumentTypeCodes", allDocumentTypeCodes); model.addAttribute("notification", notification); model.addAttribute("captcha", captchaString); return "views/clinicaldocuments/secureClinicalDocuments"; } ClinicalDocumentController(
			ClinicalDocumentService clinicalDocumentService,
			PatientService patientService,
			ClinicalDocumentTypeCodeService clinicalDocumentTypeCodeService,
			UserContext userContext,
			AccessReferenceMapper accessReferenceMapper,
			ClamAVService clamAVUtil, RecaptchaService recaptchaUtil,
			EventService eventService, XmlValidation xmlValidator); @SuppressWarnings("unused") private  ClinicalDocumentController(); @RequestMapping("/medicalinfo.html") String documentHome(Model model); @RequestMapping("/clinicaldocuments.html") String showSecureClinicalDocuments(
			Model model,
			@RequestParam(value = "notify", required = false) String notification); @RequestMapping(value = "/clinicaldocuments.html", method = RequestMethod.POST) String uploadClinicalDocumentsSecurely(
			HttpServletRequest request,
			@ModelAttribute("document") ClinicalDocumentDto clinicalDocumentDto,
			@RequestParam("file") MultipartFile file,
			@RequestParam("name") String documentName,
			@RequestParam("description") String description,
			@RequestParam("documentType") String documentTypeCode); @RequestMapping(value = "/downloaddoc.html", method = RequestMethod.POST) String download(HttpServletRequest request,
			HttpServletResponse response,
			@RequestParam("download_id") String documentId); @RequestMapping(value = "/deletedoc.html", method = RequestMethod.POST) String remove(@RequestParam("delete_id") String documentId); @Override void afterPropertiesSet(); static final String C32_CDA_XSD_PATH; static final String C32_CDA_XSD_NAME; }
@Test public void testShowSecureClinicalDocuments() throws Exception { PatientProfileDto patientProfileDto = mock(PatientProfileDto.class); List<ClinicalDocumentDto> clinicaldocumentDtos = new ArrayList<ClinicalDocumentDto>(); ClinicalDocumentDto notNullClinicalDocumentDto=mock(ClinicalDocumentDto.class); LookupDto lookupDto=mock(LookupDto.class); when(notNullClinicalDocumentDto.getClinicalDocumentTypeCode()).thenReturn(lookupDto); clinicaldocumentDtos.add(notNullClinicalDocumentDto); for (int i = 0; i < 3; i++) { ClinicalDocumentDto clinicalDocumentDto = mock(ClinicalDocumentDto.class); clinicaldocumentDtos.add(clinicalDocumentDto); } List<LookupDto> allDocumentTypeCodes = new ArrayList<LookupDto>(); for (int i = 0; i < 3; i++) { LookupDto clinicalDocumentTypeCode = mock(LookupDto.class); allDocumentTypeCodes.add(clinicalDocumentTypeCode); } when(patientService.findPatientProfileByUsername(anyString())) .thenReturn(patientProfileDto); when(clinicalDocumentService.findDtoByPatientDto(patientProfileDto)) .thenReturn(clinicaldocumentDtos); when(clinicalDocumentTypeCodeService.findAllClinicalDocumentTypeCodes()) .thenReturn(allDocumentTypeCodes); mockMvc.perform(get("/patients/clinicaldocuments.html")).andExpect( view().name("views/clinicaldocuments/secureClinicalDocuments")); }