TargetInstanceDisplayHandler extends TabHandler { public void processTab(TabbedController tc, Tab currentTab, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TargetInstanceCommand cmd = null; if (comm instanceof TargetInstanceCommand) { cmd = (TargetInstanceCommand) comm; TargetInstance ti = (TargetInstance) req.getSession().getAttribute(TargetInstanceCommand.SESSION_TI); if(cmd.getCmd().equals(TargetInstanceCommand.ACTION_EDIT)) { ti.setDisplay(cmd.getDisplay()); ti.setDisplayNote(cmd.getDisplayNote()); ti.setDisplayChangeReason(cmd.getDisplayChangeReason()); } } }  void initBinder(HttpServletRequest request, ServletRequestDataBinder binder); void processTab(TabbedController tc, Tab currentTab,
            HttpServletRequest req, HttpServletResponse res, Object comm,
            BindException errors); @SuppressWarnings("unchecked") 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 setTargetInstanceManager(TargetInstanceManager targetInstanceManager);  }
@Test public final void testProcessTab() { HttpServletRequest aReq = new MockHttpServletRequest(); TargetInstanceManager targetInstanceManager = new MockTargetInstanceManager(testFile); testInstance.setTargetInstanceManager(targetInstanceManager); TargetInstance targetInstance = targetInstanceManager.getTargetInstance(5001L); aReq.getSession().setAttribute(TargetInstanceCommand.SESSION_TI, targetInstance); aReq.getSession().setAttribute(TargetInstanceCommand.SESSION_MODE, true); HttpServletResponse aResp = new MockHttpServletResponse(); TargetInstanceCommand aCmd = new TargetInstanceCommand(targetInstance); TabbedController tc = new TabbedTargetInstanceController(); TabConfig tabConfig = new TabConfig(); tabConfig.setViewName("targetInstance"); List<Tab> tabs = getTabList(targetInstanceManager); tabConfig.setTabs(tabs); tc.setTabConfig(tabConfig); tc.setDefaultCommandClass(org.webcurator.ui.target.command.TargetInstanceCommand.class); boolean newDisplay = false; String newNote = "This is a new test note"; Tab currentTab = tabs.get(1); aCmd.setCmd(TargetInstanceCommand.ACTION_EDIT); aCmd.setDisplay(newDisplay); aCmd.setDisplayNote(newNote); BindException aErrors = new BindException(aCmd, aCmd.getCmd()); testInstance.processTab(tc, currentTab, aReq, aResp, aCmd, aErrors); assertTrue(targetInstance.getDisplay() == newDisplay); assertTrue(targetInstance.getDisplayNote().equals(newNote)); newDisplay = true; newNote = "This is another new test note"; currentTab = tabs.get(1); aCmd.setCmd(TargetInstanceCommand.ACTION_EDIT); aCmd.setDisplay(newDisplay); aCmd.setDisplayNote(newNote); aErrors = new BindException(aCmd, aCmd.getCmd()); testInstance.processTab(tc, currentTab, aReq, aResp, aCmd, aErrors); assertTrue(targetInstance.getDisplay() == newDisplay); assertTrue(targetInstance.getDisplayNote().equals(newNote)); }