PsiClass (@NotNull Editor editor, @NotNull PsiFile file) { int offset = editor.getCaretModel().getOffset(); PsiElement element = file.findElementAt(offset); PsiClass containingClass = PsiTreeUtil.getParentOfType(element, PsiClass.class, false); if (containingClass == null) { return null; } final List<TestFramework> frameworks = TestIntegrationUtils.findSuitableFrameworks(containingClass); for (TestFramework framework : frameworks) { if (framework instanceof JavaTestFramework && ((JavaTestFramework)framework).acceptNestedClasses()) { return containingClass; } } return TestIntegrationUtils.findOuterClass(element); }