ShowFileController extends AbstractTemplateController { protected boolean isArchiveFileExtension(final BaseCommand command) { return FilenameUtils.getExtension(command.getPath()).toLowerCase().matches(archiveFileExtensionPattern); } ShowFileController(final FileTypeMap mimeFileTypeMap); void setColorer(final Colorer colorer); void setTextFileExtensionPattern(final String fileExtensionPattern); void setBinaryFileExtensionPattern(final String fileExtensionPattern); void setArchiveFileExtensionPattern(final String fileExtensionPattern);  }
@Test public void testIsArchiveFileExtension() throws Exception { final BaseCommand command = new BaseCommand(); command.setPath("/file.zip"); assertTrue(ctrl.isArchiveFileExtension(command)); command.setPath("/file.jar"); assertTrue(ctrl.isArchiveFileExtension(command)); command.setPath("/file.war"); assertTrue(ctrl.isArchiveFileExtension(command)); command.setPath("/file.ear"); assertTrue(ctrl.isArchiveFileExtension(command)); command.setPath("/file.EAR"); assertTrue(ctrl.isArchiveFileExtension(command)); command.setPath("/file"); assertFalse(ctrl.isArchiveFileExtension(command)); command.setPath("/filezip"); assertFalse(ctrl.isArchiveFileExtension(command)); command.setPath(""); assertFalse(ctrl.isArchiveFileExtension(command)); }