### Question:
ToDoController { @RequestMapping(value="/items", method = RequestMethod.GET) public @ResponseBody String getAll(ModelMap model) { List<ToDoItem> items = toDoItemDao.getAll(); return gson.toJson(items); }  @RequestMapping(value="/items", method = RequestMethod.GET) @ResponseBody String getAll(ModelMap model); @RequestMapping(value="/items", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody ToDoItem addItem(@RequestBody final ToDoItem item); @RequestMapping(value="/items/{id}", method = RequestMethod.DELETE) ResponseEntity<String> deleteItem(@PathVariable("id") long id); @RequestMapping(value="/items", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody ToDoItem updateItem(@RequestBody final ToDoItem item); void setToDoItemDao(ToDoItemDao toDoItemDao);  }### Answer:
@Test public void getAll() { List<ToDoItem> items = new ArrayList<>(); ToDoItem item = new ToDoItem(); item.setDone(false); item.setDescription("Item description"); item.setName("Item name"); items.add(item); when(dao.getAll()).thenReturn(items); JsonArray expectedArray = new JsonArray(); JsonObject object = new JsonObject(); object.addProperty("done", false); object.addProperty("name", "Item name"); object.addProperty("description", "Item description"); object.addProperty("id", 0); expectedArray.add(object); String str = controller.getAll(new ModelMap()); JsonElement actualJson = parseJson(str); assertEquals(expectedArray, actualJson); }