void () { FindModel model = new FindModel(); final PsiClass aClass = myJavaFacade.findClass("x.X"); assertNotNull(aClass); String classDirPath = aClass.getContainingFile().getContainingDirectory().getVirtualFile().getPath(); String sourceDirPath = ((PsiFile)aClass.getContainingFile().getNavigationElement()).getContainingDirectory().getVirtualFile().getPath(); assertNotEquals(classDirPath, sourceDirPath); model.setDirectoryName(sourceDirPath); model.setCaseSensitive(true); model.setCustomScope(false); model.setStringToFind("xxx"); model.setProjectScope(false); List<UsageInfo> usages = Collections.synchronizedList(new ArrayList<>()); CommonProcessors.CollectProcessor<UsageInfo> consumer = new CommonProcessors.CollectProcessor<>(usages); FindUsagesProcessPresentation presentation = FindInProjectUtil.setupProcessPresentation(false, FindInProjectUtil.setupViewPresentation(false, model)); FindInProjectUtil.findUsages(model, getProject(), consumer, presentation); UsageInfo info = assertOneElement(usages); assertEquals("X.java", info.getFile().getName()); }