void () { final Project project = myProjectFixture.getProject(); final PsiClass psiClass = findTestClass(project); final TestNGConfiguration configuration = createConfiguration(project); configuration.beClassConfiguration(psiClass); final String newName = "Testt1"; final RenameRefactoring renameClass = RefactoringFactory.getInstance(project).createRename(psiClass, newName); renameClass.setSearchInComments(false); renameClass.setSearchInNonJavaFiles(false); WriteCommandAction.runWriteCommandAction(project, () -> renameClass.run()); Assert.assertEquals(newName, configuration.getPersistantData().getMainClassName()); final PsiMethod notATestMethod = findNotATestMethod(psiClass); final RenameRefactoring renameNotATestMethod = RefactoringFactory.getInstance(project).createRename(notATestMethod, "aaaa"); renameNotATestMethod.setSearchInComments(false); renameNotATestMethod.setSearchInNonJavaFiles(false); WriteCommandAction.runWriteCommandAction(project, () -> renameNotATestMethod.run()); Assert.assertEquals(configuration.getPersistantData().getMainClassName(), newName); Assert.assertEquals(configuration.getPersistantData().getMethodName(), ""); Assert.assertEquals(configuration.getPersistantData().TEST_OBJECT, TestType.CLASS.getType()); }