void () { configureByText(JavaFileType.INSTANCE, "class S { void foo() { boolean <selection>var; if (va<caret>r</selection>) {}} }"); ((EditorImpl)myEditor).getScrollPane().getViewport().setSize(1000, 1000); UIUtil.markAsFocused(getEditor().getContentComponent(), true); // to make ShowIntentionPass call its collectInformation() Set<LightweightHint> visibleHints = new ReferenceOpenHashSet<>(); getProject().getMessageBus().connect(getTestRootDisposable()).subscribe(EditorHintListener.TOPIC, new EditorHintListener() { @Override public void hintShown(@NotNull Editor editor, @NotNull LightweightHint hint, int flags, @NotNull HintHint hintInfo) { visibleHints.add(hint); hint.addHintListener(new HintListener() { @Override public void hintHidden(@NotNull EventObject event) { visibleHints.remove(hint); hint.removeHintListener(this); } }); } }); assertNotEmpty(highlightErrors()); UIUtil.dispatchAllInvocationEvents(); IntentionHintComponent lastHintBeforeDeletion = myDaemonCodeAnalyzer.getLastIntentionHint(); assertNotNull(lastHintBeforeDeletion); assertTrue(lastHintBeforeDeletion.getCachedIntentions().toString(), ContainerUtil.exists(lastHintBeforeDeletion.getCachedIntentions().getErrorFixes(), e -> e.getText().equals("Initialize variable 'var'"))); delete(myEditor); assertNotEmpty(highlightErrors()); UIUtil.dispatchAllInvocationEvents(); IntentionHintComponent lastHintAfterDeletion = myDaemonCodeAnalyzer.getLastIntentionHint(); // it must be either hidden or not have that error anymore if (lastHintAfterDeletion == null) { assertEmpty(visibleHints); } else { IntentionContainer after = lastHintAfterDeletion.getCachedIntentions(); assertFalse(after.toString(), ContainerUtil.exists(after.getErrorFixes(), e -> e.getText().equals("Initialize variable 'var'"))); } }