ListFilesController extends ListDirectoryContentsController { @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 ModelAndView modelAndView = super.svnHandle(connection, command, headRevision, userRepositoryContext, request, response, exception); final Map<String, Object> model = modelAndView.getModel(); final List<DirEntry> entries = (List<DirEntry>) model.get("dirEntries"); final DirEntryKindFilter entryFilter = new DirEntryKindFilter(DirEntry.Kind.FILE); final int rowNumber = ServletRequestUtils.getRequiredIntParameter(request, "rowNumber"); logger.debug("Adding data to model"); model.put("dirEntries", entryFilter.filter(entries)); model.put("rowNumber", rowNumber); modelAndView.setViewName(getViewName()); return modelAndView; }    }
@Test public void testSvnHandle() throws Exception { final RepositoryService mockService = EasyMock.createMock(RepositoryService.class); final MockHttpServletRequest request = new MockHttpServletRequest(); request.setParameter("rowNumber", "12"); final List<DirEntry> entries = TestUtils.getFileEntriesDirectoryList(); final BaseCommand command = new BaseCommand(); command.setName(new RepositoryName("test")); command.setRevision(Revision.create(12)); final ListFilesController ctrl = new ListFilesController(); ctrl.setRepositoryService(mockService); expect(mockService.list(null, command.getPath(), command.getRevisionNumber())).andStubReturn( new DirList(entries, new Properties())); replay(mockService); final ModelAndView modelAndView = ctrl.svnHandle(null, command, 100, null, request, null, null); final Map model = modelAndView.getModel(); verify(mockService); assertEquals(3, model.size()); assertEquals(12, model.get("rowNumber")); assertEquals(entries.get(0), ((List<DirEntry>) model.get("dirEntries")).get(0)); }