SiteGeneralHandler extends AbstractSiteHandler { public void processTab(TabbedController tc, Tab currentTab, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { SiteCommand sc = (SiteCommand) comm; if (getEditorContext(req).isEditMode()) { sc.updateBusinessModel(getEditorContext(req).getSite()); } if(sc.isAction(SiteCommand.ACTION_ADD_NOTE) && !"".equals(sc.getAnnotation())) { Annotation a = new Annotation(new Date(), sc.getAnnotation()); a.setUser(AuthUtil.getRemoteUserObject()); SiteEditorContext ctx = getEditorContext(req); Site site = ctx.getSite(); site.addAnnotation(a); } }  void processTab(TabbedController tc, Tab currentTab, HttpServletRequest req,
			HttpServletResponse res, Object comm, BindException errors); TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTab,
			HttpServletRequest req, HttpServletResponse res, Object comm,
			BindException errors); ModelAndView processOther(TabbedController tc, Tab currentTab, HttpServletRequest req,
			HttpServletResponse res, Object comm, BindException errors); void bindEditorContext(HttpServletRequest req, SiteEditorContext context); void setSiteManager(SiteManager siteManager);  }
@Test public final void testProcessTab() throws Exception { HttpServletRequest aReq = new MockHttpServletRequest(); SiteManager siteManager = new MockSiteManagerImpl(testFile); testInstance.setSiteManager(siteManager); Site site = siteManager.getSite(9000L, true); List<Annotation> list = createAnnotationList(); assertFalse(checkSortedList(list)); site.setAnnotations(list); SiteEditorContext ctx = new SiteEditorContext(site); aReq.getSession().setAttribute(SiteController.EDITOR_CONTEXT, ctx); HttpServletResponse aResp = new MockHttpServletResponse(); SiteCommand aCmd = new SiteCommand(); TabbedController tc = new SiteController(); TabConfig tabConfig = new TabConfig(); tabConfig.setViewName("site"); List<Tab> tabs = getTabList(siteManager); tabConfig.setTabs(tabs); tc.setTabConfig(tabConfig); Tab currentTab = tabs.get(0); aCmd.setCmdAction(SiteCommand.ACTION_ADD_NOTE); aCmd.setAnnotation("A note"); BindException aErrors = new BindException(aCmd, aCmd.getCmdAction()); List<Annotation> resultAnnotations = site.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()); }