void () { AtomicReference<Throwable> reported = new AtomicReference<>(); getProject().getMessageBus().connect(getTestRootDisposable()).subscribe(DaemonCodeAnalyzer.DAEMON_EVENT_TOPIC, new DaemonCodeAnalyzer.DaemonListener() { @Override public void daemonAnnotatorStatisticsGenerated(@NotNull AnnotationSession session, @NotNull Collection<? extends AnnotatorStatistics> statistics, @NotNull PsiFile file) { AnnotatorStatistics stat = assertOneElement(ContainerUtil.filter(statistics, stat1 -> stat1.annotator instanceof MyInfoAnnotator)); Throwable old = reported.getAndSet(new Throwable()); assertNull(old==null?null:ExceptionUtil.getMessage(old), old); assertEquals("Annotation(message='comment', severity='INFORMATION', toolTip='<html>comment</html>')", stat.firstAnnotation.toString()); assertSame(stat.firstAnnotation, stat.lastAnnotation); assertTrue(stat.annotatorStartStamp > 0); assertTrue(stat.firstAnnotationStamp >= stat.annotatorStartStamp); assertTrue(stat.lastAnnotationStamp >= stat.firstAnnotationStamp); assertTrue(stat.annotatorFinishStamp >= stat.lastAnnotationStamp); } }); @Language("JAVA") String text = """ class X /* */ { // comment } """; configureByText(JavaFileType.INSTANCE, text); doHighlighting(); assertNotNull(reported.get()); }