RaxaDrugController extends BaseRestController { @RequestMapping(value = "/{uuid}", method = RequestMethod.GET, params = "v") @WSDoc("Gets Full representation of Drug for the uuid path") @ResponseBody() public String getDrugByUuidFull(@PathVariable("uuid") String uuid, @RequestParam("v") String rep, HttpServletRequest request) throws ResponseException { initDrugController(); Drug drug = service.getDrugByUuid(uuid); SimpleObject obj = getDrugAsSimpleObject(drug); if (rep.equals("full")) { obj.add("retired", drug.getRetired()); if (drug.getRetired()) { obj.add("retiredBy", drug.getRetiredBy().getUuid()); obj.add("retireReason", drug.getRetireReason()); } SimpleObject auditInfo = new SimpleObject(); auditInfo.add("creator", drug.getCreator().getUuid()); auditInfo.add("dateCreated", df.format(drug.getDateCreated())); if (drug.getChangedBy() != null) { auditInfo.add("changedBy", drug.getChangedBy().getUuid()); auditInfo.add("dateChanged", df.format(drug.getDateChanged())); } obj.add("auditInfo", auditInfo); } obj.add("resourceVersion", getResourceVersion()); return gson.toJson(obj); }  void initDrugController(); @RequestMapping(method = RequestMethod.POST) @WSDoc("Save New Drug") @ResponseBody Object createNewDrug(@RequestBody SimpleObject post, HttpServletRequest request, HttpServletResponse response); @RequestMapping(value = "/{uuid}", method = RequestMethod.POST) @WSDoc("Updates an existing drug") @ResponseBody Object updateDrug(@PathVariable("uuid") String uuid, @RequestBody SimpleObject post, HttpServletRequest request,
	        HttpServletResponse response); @RequestMapping(method = RequestMethod.GET) @WSDoc("Get All Unretired Drug in the system") @ResponseBody() String getAllDrugs(HttpServletRequest request, HttpServletResponse response); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET) @WSDoc("Gets Drug for the uuid path") @ResponseBody() String getDrugByUuid(@PathVariable("uuid") String uuid, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET, params = "v") @WSDoc("Gets Full representation of Drug for the uuid path") @ResponseBody() String getDrugByUuidFull(@PathVariable("uuid") String uuid, @RequestParam("v") String rep,
	        HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "!purge") @WSDoc("Retires the Drug") @ResponseBody Object retireDrug(@PathVariable("uuid") String uuid,
	        @RequestParam(value = "reason", defaultValue = "web service call") String reason, HttpServletRequest request,
	        HttpServletResponse response);  }
@Test public void getDrugByUuidFull_shouldGetFullDrug() throws Exception { String result = controller.getDrugByUuidFull(getUuid(), "full", request); SimpleObject drug = SimpleObject.parseJson(result); Assert.assertNotNull(result); Assert.assertEquals(getUuid(), drug.get("uuid")); Assert.assertEquals(false, drug.get("retired")); }