void () { PsiClass aClass = myJavaFacade.findClass("pack.MyClass2", GlobalSearchScope.allScope(myProject)); assertNotNull(aClass); ApplicationManager.getApplication().runWriteAction(() -> { aClass.getNameIdentifier().replace(myJavaFacade.getElementFactory().createIdentifier("NewName")); }); assertEquals("pack.NewName", aClass.getQualifiedName()); }