DrugInventoryController extends BaseRestController { @RequestMapping(method = RequestMethod.GET) @WSDoc("Get All Unretired Drug Inventories in the system") @ResponseBody() public String getAllDrugInventories(HttpServletRequest request, HttpServletResponse response) throws ResponseException { initDrugInventoryController(); List<DrugInventory> allDIs = service.getAllDrugInventories(); ArrayList results = new ArrayList(); for (DrugInventory di : allDIs) { results.add(getFieldsFromDrugInventory(di)); } return gson.toJson(new SimpleObject().add("results", results)); }  void initDrugInventoryController(); @RequestMapping(method = RequestMethod.POST) @WSDoc("Save DrugInventory") @ResponseBody Object saveDrugInventory(@RequestBody SimpleObject post, HttpServletRequest request, HttpServletResponse response); DrugInventory setPostFields(SimpleObject post, DrugInventory drugInventory); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET) @WSDoc("Gets drug inventory for the uuid path") @ResponseBody() String getDrugInventoryByUuid(@PathVariable("uuid") String uuid, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.POST) @WSDoc("Updates an existing drug inventory") @ResponseBody Object updateDrugInventory(@PathVariable("uuid") String uuid, @RequestBody SimpleObject post,
	        HttpServletRequest request, HttpServletResponse response); @RequestMapping(method = RequestMethod.GET) @WSDoc("Get All Unretired Drug Inventories in the system") @ResponseBody() String getAllDrugInventories(HttpServletRequest request, HttpServletResponse response); @RequestMapping(method = RequestMethod.GET, params = "location") @WSDoc("Fetch all non-retired inventories according to location") @ResponseBody() String searchByLocation(@RequestParam("location") String location, HttpServletRequest request);  }
@Test public void shouldGetAll() throws Exception { String allDIs = controller.getAllDrugInventories(request, response); Assert.assertEquals(1, ((ArrayList) SimpleObject.parseJson(allDIs).get("results")).size()); }