### Question:
PersonController { @GetMapping(value = "/list") public String list(Model model) { logger.info("Populating model with list..."); List<Person> persons = personService.findAll(); persons.sort(COMPARATOR_BY_ID); model.addAttribute("persons", persons); return "persons/list"; } PersonController(PersonService personService); @GetMapping(value = "/list") String list(Model model); @RequestMapping(value = "/{id:[\\d]*}", method = RequestMethod.GET) String show(@PathVariable Long id, Model model); @GetMapping(value = "/newPerson") String newPerson(Person person, Model model);  }### Answer:
@SuppressWarnings("unchecked") @Test void testListHandler() { List<Person> list = new ArrayList<>(); Person p = new Person(); p.setId(1L); list.add(p); when(mockService.findAll()).thenReturn(list); ExtendedModelMap model = new ExtendedModelMap(); String viewName = personController.list(model); List<Person> persons = (List<Person>) model.get("persons"); assertAll( () -> assertNotNull(persons), () -> assertEquals(1, persons.size()), () -> assertEquals("persons/list", viewName) ); }