@NotNull
  protected Collection<HighlightInfo> checkHighlighting(
      @NotNull final ExpectedHighlightingData data) {
    data.init();
    PsiDocumentManager.getInstance(myProject).commitAllDocuments();

    // to load text
    ApplicationManager.getApplication()
        .runWriteAction(
            new Runnable() {
              @Override
              public void run() {
                TreeUtil.clearCaches((TreeElement) myFile.getNode());
              }
            });

    // to initialize caches
    if (!DumbService.isDumb(getProject())) {
      CacheManager.SERVICE
          .getInstance(myProject)
          .getFilesWithWord(
              "XXX", UsageSearchContext.IN_COMMENTS, GlobalSearchScope.allScope(myProject), true);
    }
    final JavaPsiFacadeEx facade = getJavaFacade();
    if (facade != null) {
      facade.setAssertOnFileLoadingFilter(
          myFileTreeAccessFilter, myTestRootDisposable); // check repository work
    }

    try {
      Collection<HighlightInfo> infos = doHighlighting();

      String text = myEditor.getDocument().getText();
      data.checkLineMarkers(
          DaemonCodeAnalyzerImpl.getLineMarkers(getDocument(getFile()), getProject()), text);
      data.checkResult(infos, text);
      return infos;
    } finally {
      if (facade != null) {
        facade.setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, myTestRootDisposable);
      }
    }
  }