void () { String s = """ import java.io.*; class A { public static void deserialize(File file) throws <caret>IOException, java.lang.RuntimeException, ClassNotFoundException { boolean length = file.createNewFile(); if (length == false) throw new RuntimeException(); file.getCanonicalPath(); if (length == true) throw new ClassNotFoundException(); } }"""; configureByText( JavaFileType.INSTANCE, s); HighlightUsagesHandlerBase<PsiElement> handler = HighlightUsagesHandler.createCustomHandler(getEditor(), getFile()); assertNotNull(handler); List<PsiElement> targets = handler.getTargets(); assertEquals(1, targets.size()); handler.computeUsages(targets); List<TextRange> readUsages = handler.getReadUsages(); List<String> expected = Arrays.asList("IOException", "file.createNewFile", "file.getCanonicalPath"); assertEquals(expected.size(), readUsages.size()); List<String> textUsages = ContainerUtil.map(readUsages, it->getFile().getText().substring(it.getStartOffset(), it.getEndOffset())); assertSameElements(expected, textUsages); }