PatientListController extends BaseRestController { @RequestMapping(method = RequestMethod.GET) @WSDoc("Get All Unretired Patient Lists in the system") @ResponseBody() public String getAllPatientLists(HttpServletRequest request, HttpServletResponse response) throws ResponseException { initPatientListController(); List<PatientList> allPatientList = service.getAllPatientList(false); ArrayList results = new ArrayList(); for (PatientList patientList : allPatientList) { SimpleObject obj = new SimpleObject(); obj.add("uuid", patientList.getUuid()); obj.add("name", patientList.getName()); obj.add("description", patientList.getDescription()); results.add(obj); } return gson.toJson(new SimpleObject().add("results", results)); }  void initPatientListController(); @RequestMapping(method = RequestMethod.POST) @WSDoc("Save New PatientList") @ResponseBody Object createNewPatientList(@RequestBody SimpleObject post, HttpServletRequest request,
	        HttpServletResponse response); @RequestMapping(value = "/{uuid}", method = RequestMethod.POST) @WSDoc("Updates an existing patient list") @ResponseBody Object updatePatientList(@PathVariable("uuid") String uuid, @RequestBody SimpleObject post,
	        HttpServletRequest request, HttpServletResponse response); @RequestMapping(method = RequestMethod.GET) @WSDoc("Get All Unretired Patient Lists in the system") @ResponseBody() String getAllPatientLists(HttpServletRequest request, HttpServletResponse response); @RequestMapping(method = RequestMethod.GET, params = "q") @WSDoc("Gets Patient Lists by name") @ResponseBody() String getPatientListsByName(@RequestParam("q") String query, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET) @WSDoc("Gets Patient Lists for the uuid path") @ResponseBody() String getAllPatientListByUuid(@PathVariable("uuid") String uuid, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET, params = "v") @WSDoc("Gets Full representation of Patient Lists for the uuid path") @ResponseBody() String getAllPatientListByUuidFull(@PathVariable("uuid") String uuid, @RequestParam("v") String rep,
	        HttpServletRequest request); @RequestMapping(method = RequestMethod.GET, params = "encounterType") @WSDoc("Gets Patients Without Saving the Patient list") @ResponseBody() String getPatientsInPatientList(@RequestParam Map<String, String> params, HttpServletRequest request); @RequestMapping(value = "/optimized", method = RequestMethod.GET, params = "encounterType") @WSDoc("Gets Patients Without Saving the Patient list") @ResponseBody() String getPatientsInPatientListV2(@RequestParam Map<String, String> params, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "!purge") @WSDoc("Retires the Patient List") @ResponseBody Object retirePatientList(@PathVariable("uuid") String uuid,
	        @RequestParam(value = "reason", defaultValue = "web service call") String reason, HttpServletRequest request,
	        HttpServletResponse response); @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "purge") @ResponseBody Object purgePatientList(@PathVariable("uuid") String uuid, HttpServletRequest request,
	        HttpServletResponse response);  }
@Test public void shouldGetAll() throws Exception { String allPatientLists = controller.getAllPatientLists(request, response); Assert.assertEquals(2, ((ArrayList) SimpleObject.parseJson(allPatientLists).get("results")).size()); }