### Question:
HeroController { @GetMapping("/hero/new") public String newHero(Model model) { model.addAttribute("newHero", new NewHeroModel()); model.addAttribute("repos", heroService.getHeroRepositoryNames()); return "hero/hero.new.html"; } HeroController(HeroService heroService); @GetMapping("/hero") String viewAllHeros(Model model); @GetMapping("/hero/new") String newHero(Model model); @PostMapping("/hero/new") String addNewHero(@ModelAttribute("newHero") NewHeroModel newHeroModel);  }### Answer:
@Test public void newHero() { Model model = mock(Model.class); String view = subjectUnderTest.newHero(model); assertThat(view).isEqualTo("hero/hero.new.html"); verify(model).addAttribute(eq("newHero"), any(NewHeroModel.class)); verify(model).addAttribute(eq("repos"), anySet()); verify(heroService).getHeroRepositoryNames(); }