@Test public void testCreateLink_NoMatch() throws Exception { mockRequest.setRequestURI("/vpr/trend/urn:va:lab:F484:8:CH;6879469.819787;690"); Result result = new Result(); when(genericPatientObjectDaoMock.findByUID(Result.class, "urn:va:lab:F484:8:CH;6879469.819787;690")).thenReturn(result); when(linkServiceMock.getLinks(result)).thenReturn(new ArrayList<Link>(Arrays.asList(new Link()))); try { tc.createLink(mockRequest); Assert.assertTrue(false); } catch (NotFoundException nfe) { assertEquals("No trend found for item with uid=urn:va:lab:F484:8:CH;6879469.819787;690", nfe.getMessage()); } }
Link createLink(HttpServletRequest request) { String uid = getUidFromUrl(request.getRequestURI()); IPOMObject item = genericPatientObjectDao.findByUID(UidUtils.getDomainClassByUid(uid), uid); if (item == null) throw new UidNotFoundException(UidUtils.getDomainClassByUid(uid), uid); List<Link> links = linkService.getLinks(item); Link link = findTrendLink(links); if (link == null) throw new NotFoundException("No trend found for item with uid=" + uid); return link; }
TrendController { Link createLink(HttpServletRequest request) { String uid = getUidFromUrl(request.getRequestURI()); IPOMObject item = genericPatientObjectDao.findByUID(UidUtils.getDomainClassByUid(uid), uid); if (item == null) throw new UidNotFoundException(UidUtils.getDomainClassByUid(uid), uid); List<Link> links = linkService.getLinks(item); Link link = findTrendLink(links); if (link == null) throw new NotFoundException("No trend found for item with uid=" + uid); return link; } }
TrendController { Link createLink(HttpServletRequest request) { String uid = getUidFromUrl(request.getRequestURI()); IPOMObject item = genericPatientObjectDao.findByUID(UidUtils.getDomainClassByUid(uid), uid); if (item == null) throw new UidNotFoundException(UidUtils.getDomainClassByUid(uid), uid); List<Link> links = linkService.getLinks(item); Link link = findTrendLink(links); if (link == null) throw new NotFoundException("No trend found for item with uid=" + uid); return link; }  }
TrendController { Link createLink(HttpServletRequest request) { String uid = getUidFromUrl(request.getRequestURI()); IPOMObject item = genericPatientObjectDao.findByUID(UidUtils.getDomainClassByUid(uid), uid); if (item == null) throw new UidNotFoundException(UidUtils.getDomainClassByUid(uid), uid); List<Link> links = linkService.getLinks(item); Link link = findTrendLink(links); if (link == null) throw new NotFoundException("No trend found for item with uid=" + uid); return link; }  @Autowired void setLinkService(ILinkService linkService); @Autowired void setGenericPatientObjectDao(IGenericPatientObjectDAO genericPatientObjectDao); @RequestMapping(value = "/vpr/trend/**", method = RequestMethod.GET, params = "format=xml") String renderXml(HttpServletRequest request); @RequestMapping(value = "/vpr/trend/**", method = RequestMethod.GET, params = "format=json") ModelAndView renderJson(HttpServletRequest request); @RequestMapping(value = "/vpr/trend/**", method = RequestMethod.GET, params = "format=extjs") @ResponseBody String renderExtJs(@RequestParam("format") String format, HttpServletRequest request); }
TrendController { Link createLink(HttpServletRequest request) { String uid = getUidFromUrl(request.getRequestURI()); IPOMObject item = genericPatientObjectDao.findByUID(UidUtils.getDomainClassByUid(uid), uid); if (item == null) throw new UidNotFoundException(UidUtils.getDomainClassByUid(uid), uid); List<Link> links = linkService.getLinks(item); Link link = findTrendLink(links); if (link == null) throw new NotFoundException("No trend found for item with uid=" + uid); return link; }  @Autowired void setLinkService(ILinkService linkService); @Autowired void setGenericPatientObjectDao(IGenericPatientObjectDAO genericPatientObjectDao); @RequestMapping(value = "/vpr/trend/**", method = RequestMethod.GET, params = "format=xml") String renderXml(HttpServletRequest request); @RequestMapping(value = "/vpr/trend/**", method = RequestMethod.GET, params = "format=json") ModelAndView renderJson(HttpServletRequest request); @RequestMapping(value = "/vpr/trend/**", method = RequestMethod.GET, params = "format=extjs") @ResponseBody String renderExtJs(@RequestParam("format") String format, HttpServletRequest request); static final String LAB_INDEX; static final String VITAL_INDEX; }