void () { PsiClass aClass = myJavaFacade.findClass("Foo"); assertNotNull(aClass); PsiMethod toString = assertOneElement(aClass.findMethodsByName("toString", false)); JavaFindUsagesHandlerFactory factory = JavaFindUsagesHandlerFactory.getInstance(myProject); int[] count = {0}; factory.createFindUsagesHandler(toString, false).processElementUsages(toString, info -> { count[0]++; return true; }, factory.getFindMethodOptions()); assertEquals(1, count[0]); }