TargetSeedsHandler extends AbstractTargetTabHandler { public TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTabID, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TabbedModelAndView tmav = tc.new TabbedModelAndView(); TargetEditorContext ctx = getEditorContext(req); List<Seed> seeds = ctx.getSortedSeeds(); tmav.addObject("seeds", seeds); tmav.addObject("quickPicks", ctx.getQuickPickPermissions()); tmav.addObject("allowMultiplePrimarySeeds", targetManager.getAllowMultiplePrimarySeeds()); return tmav; }  @Override void initBinder(HttpServletRequest request, ServletRequestDataBinder binder); void processTab(TabbedController tc, Tab currentTab,
			HttpServletRequest req, HttpServletResponse res, Object comm,
			BindException errors); TabbedModelAndView preProcessNextTab(TabbedController tc,
			Tab nextTabID, HttpServletRequest req, HttpServletResponse res,
			Object comm, BindException errors); ModelAndView processOther(TabbedController tc, Tab currentTab,
			HttpServletRequest req, HttpServletResponse res, Object comm,
			BindException errors); ModelAndView processLinkSearch(TabbedController tc, Target aTarget, SeedsCommand command, boolean doSearch, BindException errors); void setBusinessObjectFactory(BusinessObjectFactory businessObjectFactory); void setTargetManager(TargetManager targetManager); void setValidator(TargetSeedsValidator validator); void setAuthorityManager(AuthorityManager authorityManager); void setMessageSource(MessageSource messageSource);  }
@Test public final void testPreProcessNextTab() { HttpServletRequest aReq = new MockHttpServletRequest(); TargetManager targetManager = new MockTargetManager(testFile); testInstance.setTargetManager(targetManager); testSetBusinessObjectFactory(); testSetValidator(); testSetAuthorityManager(); testSetMessageSource(); Target target = targetManager.load(4000L); TargetEditorContext targetEditorContext = new TargetEditorContext(targetManager,target,true); aReq.getSession().setAttribute(TabbedTargetController.EDITOR_CONTEXT, targetEditorContext); HttpServletResponse aResp = new MockHttpServletResponse(); SeedsCommand aCmd = new SeedsCommand(); TabbedController tc = new TabbedTargetController(); TabConfig tabConfig = new TabConfig(); tabConfig.setViewName("target"); List<Tab> tabs = getTabList(targetManager); tabConfig.setTabs(tabs); tc.setTabConfig(tabConfig); tc.setDefaultCommandClass(org.webcurator.ui.target.command.TargetDefaultCommand.class); Tab currentTab = tabs.get(1); BindException aErrors = new BindException(aCmd, "SeedsCommand"); ModelAndView mav = testInstance.preProcessNextTab(tc, currentTab, aReq, aResp, aCmd, aErrors); assertNotNull(mav); assertEquals(((List<Seed>)mav.getModel().get("seeds")).size(), target.getSeeds().size()); assertTrue(target.getSeeds().size() > 0); Iterator<Seed> it = target.getSeeds().iterator(); List<Seed> seeds = (List<Seed>)mav.getModel().get("seeds"); while(it.hasNext()) { assertTrue(seeds.contains(it.next())); } assertSame(((List<Permission>)mav.getModel().get("quickPicks")), targetEditorContext.getQuickPickPermissions()); assertEquals(((Boolean)mav.getModel().get("allowMultiplePrimarySeeds")), targetManager.getAllowMultiplePrimarySeeds()); }