PsiJavaFile (String testName, String type) { final String fileName = testName.replace('$', '/') + ".java"; final String filePath = type + "/" + fileName; final PsiFile psiFile = loadToPsiFile(filePath); if (!(psiFile instanceof PsiJavaFile)) { fail("The test file type is not supported"); } return (PsiJavaFile)psiFile; }