FileFilter { public boolean isUnderContentRoot(VirtualFile f) { if (!(f.getFileSystem() instanceof LocalFileSystem)) return false; return myFileIndex.isInContent(f); } FileFilter(FileIndex fi, FileTypeManager tm); boolean isAllowedAndUnderContentRoot(VirtualFile f); boolean isUnderContentRoot(VirtualFile f); boolean isAllowed(VirtualFile f); static final long MAX_FILE_SIZE; }
@Test public void testFilteringFileNotUnderContentRoot() { expect(fi.isInContent(f1)).andReturn(true); expect(fi.isInContent(f2)).andReturn(false); replay(fi); FileFilter f = new FileFilter(fi, tm); assertTrue(f.isUnderContentRoot(f1)); assertFalse(f.isUnderContentRoot(f2)); }
@Test public void testFilteringFileNotUnderLocalFileSystemButUnderContentRoot() { TestVirtualFile file = new TestVirtualFile("file") { @Override @NotNull public VirtualFileSystem getFileSystem() { return createMock(VirtualFileSystem.class); } }; expect(fi.isInContent(file)).andReturn(true); replay(fi); FileFilter f = new FileFilter(fi, tm); assertFalse(f.isUnderContentRoot(file)); }