GetLogMessageController extends AbstractTemplateController { @Override protected ModelAndView svnHandle(final SVNConnection connection, final BaseCommand command, final long headRevision, final UserRepositoryContext userRepositoryContext, final HttpServletRequest request, final HttpServletResponse response, final BindException exception) throws Exception { final Map<String, Object> model = new HashMap<String, Object>(); final long revisionNumber = command.getRevisionNumber(); logger.debug("Getting log message from revision [" + revisionNumber + "]"); final LogEntry logEntry = getRepositoryService().getLogEntry(connection, command.getName(), revisionNumber); final LogMessageSearchItem searchItem = new LogMessageSearchItem(logEntry); model.put("logEntry", searchItem); return new ModelAndView(getViewName(), model); }    }
@Test public void testSvnHandle() throws Exception { final RepositoryService mockService = EasyMock.createMock(RepositoryService.class); final BaseCommand command = new BaseCommand(); command.setName(new RepositoryName("test")); command.setRevision(Revision.create(12)); final LogEntry svnLogEntry = TestUtils.getLogEntryStub(command.getRevisionNumber()); final GetLogMessageController ctrl = new GetLogMessageController(); ctrl.setRepositoryService(mockService); expect(mockService.getLogEntry(null, command.getName(), command.getRevisionNumber())).andStubReturn(svnLogEntry); replay(mockService); final ModelAndView modelAndView = ctrl.svnHandle(null, command, 100, null, null, null, null); final Map model = modelAndView.getModel(); verify(mockService); assertEquals(1, model.size()); final LogMessageSearchItem logEntry = (LogMessageSearchItem) model.get("logEntry"); assertEquals(logEntry.getMessage(), logEntry.getMessage()); assertEquals(command.getRevisionNumber(), logEntry.getRevision()); }