private static boolean isAllowed(@NotNull PsiFile file, @NotNull Predicate<? super PsiFile> predicate) {
    if (ApplicationManager.getApplication().isUnitTestMode()) return true;  // always run in tests

    VirtualFile vFile = file.getVirtualFile();
    if (vFile == null) return false;
    if (TestSourcesFilter.isTestSources(vFile, file.getProject())) return false;

    if (IntelliJProjectUtil.isIntelliJPlatformProject(file.getProject())) {
      return predicate.test(file);
    }

    return isInPluginModule(file);
  }
private static boolean isAllowed(@NotNull PsiFile file, @NotNull Predicate<? super PsiFile> predicate)