TargetAccessHandler extends AbstractTargetTabHandler { public TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTabID, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { Target aTarget = getEditorContext(req).getTarget(); TargetAccessCommand command = TargetAccessCommand.buildFromModel(aTarget); command.setTabType(TargetAccessCommand.TARGET_TYPE); TabbedModelAndView tmav = tc.new TabbedModelAndView(); tmav.addObject(Constants.GBL_CMD_DATA, command); tmav.addObject("ownable", aTarget); tmav.addObject("privleges", Privilege.MODIFY_TARGET + ";" + Privilege.CREATE_TARGET); tmav.addObject("editMode", getEditorContext(req).isEditMode()); tmav.addObject("displayTarget", aTarget.isDisplayTarget()); tmav.addObject("accessZone", aTarget.getAccessZone()); tmav.addObject("displayNote", aTarget.getDisplayNote()); tmav.addObject("displayChangeReason", aTarget.getDisplayChangeReason()); return tmav; }  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 setAuthorityManager(AuthorityManager authorityManager);  }
@Test public final void testPreProcessNextTab() { HttpServletRequest aReq = new MockHttpServletRequest(); TargetManager targetManager = new MockTargetManager(testFile); testInstance.setAuthorityManager(new AuthorityManagerImpl()); Target target = targetManager.load(4000L); TargetEditorContext targetEditorContext = new TargetEditorContext(targetManager,target,true); aReq.getSession().setAttribute(TabbedTargetController.EDITOR_CONTEXT, targetEditorContext); HttpServletResponse aResp = new MockHttpServletResponse(); TargetAccessCommand aCmd = new TargetAccessCommand(); 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); aCmd.setAccessZone(0); aCmd.setDisplayNote("Some notes"); aCmd.setDisplayChangeReason("Some reason"); aCmd.setDisplayTarget(true); BindException aErrors = new BindException(aCmd, "TargetAccessCommand"); ModelAndView mav = testInstance.preProcessNextTab(tc, currentTab, aReq, aResp, aCmd, aErrors); assertTrue(((TargetAccessCommand)mav.getModel().get("command")).getAccessZone() == target.getAccessZone()); assertTrue(((TargetAccessCommand)mav.getModel().get("command")).getDisplayNote().equals(target.getDisplayNote())); assertTrue(((TargetAccessCommand)mav.getModel().get("command")).getDisplayChangeReason().equals(target.getDisplayChangeReason())); assertTrue(((TargetAccessCommand)mav.getModel().get("command")).isDisplayTarget() == target.isDisplayTarget()); }