void (@NotNull PsiElement element) { final PsiMethodCallExpression call = (PsiMethodCallExpression)element; final PsiReferenceExpression methodExpression = call.getMethodExpression(); @NonNls final String fromMethodName = methodExpression.getReferenceName(); @NonNls final String toMethodName = getOppositeAssertMethodName(fromMethodName); final CommentTracker tracker = new CommentTracker(); @NonNls final StringBuilder newCall = new StringBuilder(); final PsiElement qualifier = methodExpression.getQualifier(); if (qualifier == null) { final PsiMethod method = call.resolveMethod(); assert method != null; final PsiClass aClass = method.getContainingClass(); assert aClass != null; final String qualifiedName = aClass.getQualifiedName(); assert qualifiedName != null; final PsiClass containingClass = PsiTreeUtil.getParentOfType(element, PsiClass.class); if (!InheritanceUtil.isInheritor(containingClass, "junit.framework.Assert") && !ImportUtils.addStaticImport(qualifiedName, toMethodName, element)) { newCall.append(qualifiedName).append('.'); } } else { newCall.append(tracker.text(qualifier)).append('.'); } newCall.append(toMethodName).append('('); final PsiExpressionList argumentList = call.getArgumentList(); final PsiExpression[] arguments = argumentList.getExpressions(); if (arguments.length == 1) { newCall.append(BoolUtils.getNegatedExpressionText(arguments[0], tracker)); } else { newCall.append(tracker.text(arguments[0])).append(','); newCall.append(BoolUtils.getNegatedExpressionText(arguments[1], tracker)); } newCall.append(')'); PsiReplacementUtil.replaceExpressionAndShorten(call, newCall.toString(), tracker); }