void () { String text = """ class LQF { int f; public void me() { <caret> } }"""; configureFromFileText("x.java", text); final AtomicInteger startedCount = new AtomicInteger(); final AtomicInteger finishedCount = new AtomicInteger(); final Key<Object> KEY = Key.create("just key"); LocalInspectionTool tool = new LocalInspectionTool() { @Nls @NotNull @Override public String getGroupDisplayName() { return "fegna"; } @Nls @NotNull @Override public String getDisplayName() { return getGroupDisplayName(); } @NotNull @Override public String getShortName() { return getGroupDisplayName(); } @NotNull @Override public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) { return new PsiElementVisitor() { }; } @Override public void inspectionStarted(@NotNull LocalInspectionToolSession session, boolean isOnTheFly) { startedCount.incrementAndGet(); session.putUserData(KEY, session); } @Override public void inspectionFinished(@NotNull LocalInspectionToolSession session, @NotNull ProblemsHolder problemsHolder) { finishedCount.incrementAndGet(); assertEmpty(problemsHolder.getResults()); assertSame(session, session.getUserData(KEY)); } }; enableInspectionTool(tool); List<HighlightInfo> infos = highlightErrors(); assertEmpty(infos); assertEquals(1, startedCount.get()); assertEquals(1, finishedCount.get()); }