RaxaDrugController extends BaseRestController { @RequestMapping(method = RequestMethod.GET) @WSDoc("Get All Unretired Drug in the system") @ResponseBody() public String getAllDrugs(HttpServletRequest request, HttpServletResponse response) throws ResponseException { initDrugController(); List<Drug> allDrug = service.getAllDrugs(false); ArrayList results = new ArrayList(); for (Drug drug : allDrug) { results.add(getDrugAsSimpleObject(drug)); } return gson.toJson(new SimpleObject().add("results", results)); }  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 getAllDrugs_shouldGetDrugs() throws Exception { String allDrugs = controller.getAllDrugs(request, response); Assert.assertEquals(2, ((ArrayList) SimpleObject.parseJson(allDrugs).get("results")).size()); }