### Question:
AddLinkController { @RequestMapping(method = RequestMethod.GET) public void setupForm(ModelMap modelMap, HttpServletRequest request) { String sessionId = request.getParameter("sessionId"); Session session = sessionDao.getSessionById(sessionId); LinkFormData linkFormData = new LinkFormData(); modelMap.put("linkFormData", linkFormData); modelMap.put("sessionTitle", session.getTitle()); }  @RequestMapping(method = RequestMethod.GET) void setupForm(ModelMap modelMap, HttpServletRequest request); @RequestMapping(method = RequestMethod.POST) ModelAndView processSubmit(final HttpServletRequest request, ModelMap modelMap, final @ModelAttribute("linkFormData") LinkFormData form, BindingResult result);  }### Answer:
@Test public void testSetupForm() throws Exception { String title = "title"; String sessionId = "42"; Session session = new Session("date", "startTime", "location", title, "author", "description"); when(sessionDao.getSessionById(sessionId)).thenReturn(session); mockMvc.perform(get("/addLink").param("sessionId", sessionId)).andExpect(status().isOk()).andExpect(model().attributeExists("linkFormData")) .andExpect(model().attribute("sessionTitle", containsString(title))).andExpect(view().name("addLink")); }