void () { DependenciesBuilder builder = new ForwardDependenciesBuilder(getProject(), new AnalysisScope(getProject())); builder.analyze(); Set<PsiFile> searchIn = new HashSet<>(); PsiClass aClass = myFixture.findClass("A"); searchIn.add(aClass.getContainingFile()); Set<PsiFile> searchFor = new HashSet<>(); PsiClass stringClass = myFixture.findClass("java.lang.String"); searchFor.add((PsiFile)stringClass.getContainingFile().getNavigationElement()); UsageInfo[] usagesInfos = FindDependencyUtil.findDependencies(builder, searchIn, searchFor); UsageInfo2UsageAdapter[] usages = UsageInfo2UsageAdapter.convert(usagesInfos); String[] psiUsages = new String[usagesInfos.length]; for (int i = 0; i < usagesInfos.length; i++) { psiUsages[i] = toString(usages[i]); } checkResult(new String[]{"2 String myName;"}, psiUsages); }