void (@NotNull Project project, @NotNull PsiElement startElement, @NotNull ModPsiUpdater updater) { final PsiMethodCallExpression call = PsiTreeUtil.getParentOfType(startElement, PsiMethodCallExpression.class); if (call == null) { return; } final PsiClass newAssertClass = JavaPsiFacade.getInstance(project).findClass(JUnitCommonClassNames.ORG_JUNIT_ASSERT, GlobalSearchScope.allScope(project)); final PsiClass oldAssertClass = JavaPsiFacade.getInstance(project).findClass(JUnitCommonClassNames.JUNIT_FRAMEWORK_ASSERT, GlobalSearchScope.allScope(project)); if (newAssertClass == null) { return; } final PsiReferenceExpression methodExpression = call.getMethodExpression(); final PsiExpression qualifierExpression = methodExpression.getQualifierExpression(); final PsiElement usedImport = qualifierExpression instanceof PsiReferenceExpression ? ((PsiReferenceExpression)qualifierExpression).advancedResolve(true).getCurrentFileResolveScope() : methodExpression.advancedResolve(true).getCurrentFileResolveScope(); final PsiMethod psiMethod = call.resolveMethod(); final boolean isImportUnused = isImportBecomeUnused(call, usedImport, psiMethod); PsiImportStaticStatement staticStatement = null; if (qualifierExpression == null) { staticStatement = staticallyImported(oldAssertClass, methodExpression); } final JavaCodeStyleManager styleManager = JavaCodeStyleManager.getInstance(project); if (staticStatement == null) { methodExpression.setQualifierExpression(JavaPsiFacade.getElementFactory(project).createReferenceExpression(newAssertClass)); if (isImportUnused && usedImport instanceof PsiImportStatementBase) { usedImport.delete(); } styleManager.shortenClassReferences(methodExpression); } else { if (isImportUnused) { final PsiJavaCodeReferenceElement importReference = staticStatement.getImportReference(); if (importReference != null) { if (staticStatement.isOnDemand()) { importReference.bindToElement(newAssertClass); } else { final PsiElement importQExpression = importReference.getQualifier(); if (importQExpression instanceof PsiJavaCodeReferenceElement) { ((PsiJavaCodeReferenceElement)importQExpression).bindToElement(newAssertClass); } } } } else { methodExpression .setQualifierExpression(JavaPsiFacade.getElementFactory(project).createReferenceExpression(newAssertClass)); styleManager.shortenClassReferences(methodExpression); } } PsiMethod newTarget = call.resolveMethod(); if (newTarget != null && newTarget.isDeprecated()) { PsiParameter[] parameters = newTarget.getParameterList().getParameters(); if (parameters.length > 0) { PsiType paramType = parameters[parameters.length - 1].getType(); if (PsiTypes.doubleType().equals(paramType) || PsiTypes.floatType().equals(paramType)) { call.getArgumentList().add(JavaPsiFacade.getElementFactory(project).createExpressionFromText("0.0", call)); } } } /* //refs can be optimized now but should we really? if (isImportUnused) { for (PsiReference reference : ReferencesSearch.search(newAssertClass, new LocalSearchScope(methodCallExpression.getContainingFile()))) { final PsiElement element = reference.getElement(); styleManager.shortenClassReferences(element); } }*/ }