void () { configureByText(JavaFileType.INSTANCE, "class X { int f() { int gg<caret> = 11; return 0;} }"); AtomicBoolean run = new AtomicBoolean(); final int SLEEP = 2_000; ExternalAnnotator<Integer, Integer> annotator = new ExternalAnnotator<>() { @Override public Integer collectInformation(@NotNull PsiFile file) { return 0; } @Override public Integer doAnnotate(Integer collectedInfo) { TimeoutUtil.sleep(SLEEP); return 0; } @Override public void apply(@NotNull PsiFile file, Integer annotationResult, @NotNull AnnotationHolder holder) { run.set(true); } }; ExternalLanguageAnnotators.INSTANCE.addExplicitExtension(JavaLanguage.INSTANCE, annotator, getTestRootDisposable()); long start = System.currentTimeMillis(); List<HighlightInfo> errors = filter(CodeInsightTestFixtureImpl.instantiateAndRun(getFile(), getEditor(), new int[0], false), HighlightSeverity.ERROR); long elapsed = System.currentTimeMillis() - start; assertEquals(0, errors.size()); if (!run.get()) { fail(ThreadDumper.dumpThreadsToString()); } assertTrue("Elapsed: "+elapsed, elapsed >= SLEEP); }