### Question:
TodoController { @GetMapping("/users/{name}/todos") public List<Todo> retrieveTodos(@PathVariable String name) { return todoService.retrieveTodos(name); }  @GetMapping("/users/{name}/todos") List<Todo> retrieveTodos(@PathVariable String name); @GetMapping(path = "/users/{name}/todos/{id}") Todo retrieveTodo(@PathVariable String name, @PathVariable int id);  }### Answer:
@Test public void retrieveTodos() throws Exception { List<Todo> mockList = Arrays.asList(new Todo(1, "Jack", "Learn Spring MVC", new Date(), false), new Todo(2, "Jack", "Learn Struts", new Date(), false)); when(service.retrieveTodos(anyString())).thenReturn(mockList); MvcResult result = mvc .perform(MockMvcRequestBuilders.get("/users/Jack/todos").accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()).andReturn(); String expected = "[" + "{id:1,user:Jack,desc:\"Learn Spring MVC\",done:false}" + "," + "{id:2,user:Jack,desc:\"Learn Struts\",done:false}" + "]"; JSONAssert.assertEquals(expected, result.getResponse().getContentAsString(), false); }