ShowLocksController 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>(); model.put("currentLocks", getRepositoryService().getLocks(connection, command.getPath(), true).values()); return new ModelAndView(getViewName(), model); }    }
@Test public void testSvnHandle() throws Exception { final RepositoryService serviceMock = mock(RepositoryService.class); final BaseCommand command = new BaseCommand(); command.setPath("trunk/test/"); command.setName(new RepositoryName("test")); command.setRevision(Revision.create(12)); final ShowLocksController ctrl = new ShowLocksController(); ctrl.setRepositoryService(serviceMock); final Map<String, DirEntryLock> result = new HashMap<String, DirEntryLock>(); result.put("/", new DirEntryLock("id", "path", "owner", "comment", new Date(), new Date())); when(serviceMock.getLocks(null, command.getPath(), true)).thenReturn(result); final ModelAndView modelAndView = ctrl.svnHandle(null, command, 100, null, null, null, null); final Map model = modelAndView.getModel(); assertEquals(1, model.size()); final Collection locks = (Collection) model.get("currentLocks"); assertEquals(1, locks.size()); }