TargetGeneralHandler extends AbstractTargetTabHandler { public TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTabID, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { Target aTarget = getEditorContext(req).getTarget(); TargetGeneralCommand command = TargetGeneralCommand.buildFromModel(aTarget); int[] nextStates = targetManager.getNextStates(aTarget); List users = agencyUserManager.getPossibleOwners(aTarget); User user = org.webcurator.core.util.AuthUtil.getRemoteUserObject(); Agency agency = user.getAgency(); List rejectionReasons = agencyUserManager.getValidRejReasonsForTargets(agency.getOid()); TabbedModelAndView tmav = tc.new TabbedModelAndView(); tmav.addObject(Constants.GBL_CMD_DATA, command); tmav.addObject("allUsers", users); tmav.addObject("originalState", aTarget.getOriginalState()); if(autoQAUrl != null && autoQAUrl.length() > 0) { tmav.addObject("showAQAOption", 1); } else { tmav.addObject("showAQAOption", 0); } tmav.addObject(TargetGeneralCommand.MDL_NEXT_STATES, nextStates); tmav.addObject(TargetGeneralCommand.MDL_REJ_REASONS, rejectionReasons); return tmav; }  void setUserRoleDao(UserRoleDAO aUserRoleDao); 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); void setTargetManager(TargetManager targetManager); void setAgencyUserManager(AgencyUserManager agencyUserManager); void setAuthorityManager(AuthorityManager authorityManager); void setAutoQAUrl(String autoQAUrl); String getAutoQAUrl();  }
@Test public final void testPreProcessNextTab() { String name = "A test & target"; HttpServletRequest aReq = new MockHttpServletRequest(); TargetManager targetManager = new MockTargetManager(testFile); testInstance.setAuthorityManager(new AuthorityManagerImpl()); testInstance.setTargetManager(targetManager); testInstance.setAgencyUserManager(new MockAgencyUserManagerImpl(testFile)); testInstance.setUserRoleDao(new MockUserRoleDAO(testFile)); Target target = targetManager.load(4000L); target.setName(name); TargetEditorContext targetEditorContext = new TargetEditorContext(targetManager,target,true); aReq.getSession().setAttribute(TabbedTargetController.EDITOR_CONTEXT, targetEditorContext); HttpServletResponse aResp = new MockHttpServletResponse(); TargetGeneralCommand aCmd = TargetGeneralCommand.buildFromModel(target); assertEquals(aCmd.getName(), name); assertEquals(aCmd.getEncodedName(), getEncodedString(name)); 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(0); target.setRunOnApproval(true); BindException aErrors = new BindException(aCmd, "TargetGeneralCommand"); ModelAndView mav = testInstance.preProcessNextTab(tc, currentTab, aReq, aResp, aCmd, aErrors); assertNotNull(mav); }