GroupSearchController extends AbstractFormController { @SuppressWarnings("unchecked") public ModelAndView prepareSearchView(HttpServletRequest request, HttpServletResponse response, BindException errors) { SearchCommand command = (SearchCommand) request.getSession().getAttribute("groupsSearchCommand"); if(command == null) { command = getDefaultCommand(); } command.setSelectedPageSize(CookieUtils.getPageSize(request)); return prepareSearchView(request, response, command, errors); } GroupSearchController(); @Override void initBinder(HttpServletRequest request, ServletRequestDataBinder binder); SearchCommand getDefaultCommand(); @SuppressWarnings("unchecked") ModelAndView prepareSearchView(HttpServletRequest request, 
			                              HttpServletResponse response,
			                              BindException errors); @SuppressWarnings("unchecked") ModelAndView prepareSearchView(HttpServletRequest request, 
			                              HttpServletResponse response,
			                              SearchCommand command,
			                              BindException errors); void setTargetManager(TargetManager targetManager); void setAgencyUserManager(AgencyUserManager agencyUserManager); void setMessageSource(MessageSource messageSource); void setDefaultSearchOnAgencyOnly(boolean defaultSearchOnAgencyOnly); boolean getDefaultSearchOnAgencyOnly(); void setGroupTypesList(WCTTreeSet groupTypesList); void setSubGroupType(String subGroupType); void setSubGroupSeparator(String subGroupSeparator);  }
@Test public final void testPrepareSearchView() { MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); this.testSetAgencyUserManager(); this.testSetTargetManager(); this.testSetMessageSource(); this.testSetGroupTypesList(); SearchCommand command = testInstance.getDefaultCommand(); command.setSelectedPageSize("10"); request.getSession().setAttribute("groupsSearchCommand", command); BindException errors = new BindException(command, command.getActionCmd()); ModelAndView mav = testInstance.prepareSearchView(request, response, (SearchCommand)command, errors); assertTrue(mav != null); assertTrue(mav.getViewName().equals("groups-search")); SearchCommand mavCommand = (SearchCommand)mav.getModel().get("command"); List<Agency> mavAgencies = (List<Agency>)mav.getModel().get("agencies"); List<UserDTO> mavOwners = (List<UserDTO>)mav.getModel().get("owners"); WCTTreeSet mavGroupTypesList = (WCTTreeSet)mav.getModel().get("groupTypesList"); Pagination mavResults = (Pagination)mav.getModel().get("page"); assertTrue(mavCommand != null); assertTrue(mavAgencies != null); assertTrue(mavAgencies.size() > 0); assertTrue(mavOwners != null); assertTrue(mavOwners.size() > 0); assertTrue(mavGroupTypesList != null); assertTrue(mavResults != null); assertTrue(mavResults.getList() != null); assertTrue(mavResults.getList().size() > 0); }