TargetAnnotationHandler extends AbstractTargetTabHandler { public void processTab(TabbedController tc, Tab currentTab, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TargetEditorContext ctx = getEditorContext(req); Target target = ctx.getTarget(); if (ctx.isEditMode()) { updateModel((TargetAnnotationCommand) comm, target); } TargetAnnotationCommand cmd = (TargetAnnotationCommand) comm; if (cmd.isAction(TargetAnnotationCommand.ACTION_ADD_NOTE)) { addAnnotation(cmd, target); } }  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 setTargetManager(TargetManager targetManager); void setSelectionTypesList(WCTTreeSet selectionTypesList); void setHarvestTypesList(WCTTreeSet harvestTypesList);  }
@Test public final void testProcessTab() throws Exception { HttpServletRequest aReq = new MockHttpServletRequest(); TargetManager targetManager = new MockTargetManager(testFile); testInstance.setTargetManager(targetManager); Target target = targetManager.load(4000L); List<Annotation> list = createAnnotationList(); assertFalse(checkSortedList(list)); target.setAnnotations(list); TargetEditorContext ctx = new TargetEditorContext(targetManager, target, true); aReq.getSession().setAttribute(TabbedTargetController.EDITOR_CONTEXT, ctx); HttpServletResponse aResp = new MockHttpServletResponse(); TargetAnnotationCommand aCmd = new TargetAnnotationCommand(); 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.setActionCmd(TargetAnnotationCommand.ACTION_ADD_NOTE); aCmd.setNote("A note"); BindException aErrors = new BindException(aCmd, aCmd.getActionCmd()); List<Annotation> resultAnnotations = target.getAnnotations(); int numAnnotations = resultAnnotations.size(); testInstance.processTab(tc, currentTab, aReq, aResp, aCmd, aErrors); assertEquals(resultAnnotations.size(), numAnnotations+1); Annotation resultAnnotation = resultAnnotations.get(resultAnnotations.size()-1); assertEquals("A note", resultAnnotation.getNote()); }