void () { final PsiClass aClass = myJavaFacade.findClass("pack.MyInterface1", GlobalSearchScope.allScope(myProject)); final PsiFile psiFile = aClass.getContainingFile(); ((PsiJavaFile) psiFile).getClasses(); psiFile.getText(); assertNotNull(aClass); final VirtualFile newSourceRoot = psiFile.getVirtualFile().getParent(); replaceSourceRoot(newSourceRoot); assertEquals("MyInterface1", aClass.getName()); }