void (@NotNull PsiElement element) { final PsiExpressionStatement statement = (PsiExpressionStatement)element; final PsiExpression expression = statement.getExpression(); final String newStatement; if (BoolUtils.isNegation(expression)) { newStatement = buildNewStatement("assertFalse", element, BoolUtils.getNegatedExpressionText(expression)); } else if (ComparisonUtils.isNullComparison(expression)) { final PsiBinaryExpression binaryExpression = (PsiBinaryExpression)expression; final PsiExpression comparedExpression = ExpressionUtils.getValueComparedWithNull(binaryExpression); assert comparedExpression != null; if (JavaTokenType.EQEQ.equals(binaryExpression.getOperationTokenType())) { newStatement = buildNewStatement("assertNull", element, comparedExpression.getText()); } else { newStatement = buildNewStatement("assertNotNull", element, comparedExpression.getText()); } } else if (isEqualityComparison(expression)) { final PsiBinaryExpression binaryExpression = (PsiBinaryExpression)expression; final PsiExpression lhs = binaryExpression.getLOperand(); final PsiExpression rhs = binaryExpression.getROperand(); final PsiExpression comparedExpression; final PsiExpression comparingExpression; if (rhs instanceof PsiLiteralExpression) { comparedExpression = rhs; comparingExpression = lhs; } else { comparedExpression = lhs; comparingExpression = rhs; } assert comparingExpression != null; final PsiType type = lhs.getType(); if (PsiTypes.doubleType().equals(type) || PsiTypes.floatType().equals(type)) { newStatement = buildNewStatement("assertEquals", element, comparedExpression.getText(), comparingExpression.getText(), "0.0"); } else if (type instanceof PsiPrimitiveType) { newStatement = buildNewStatement("assertEquals", element, comparedExpression.getText(), comparingExpression.getText()); } else { newStatement = buildNewStatement("assertSame", element, comparedExpression.getText(), comparingExpression.getText()); } } else if (isEqualsExpression(expression)) { final PsiMethodCallExpression call = (PsiMethodCallExpression)expression; final PsiReferenceExpression methodExpression = call.getMethodExpression(); final PsiExpression comparedExpression = methodExpression.getQualifierExpression(); assert comparedExpression != null; final PsiExpressionList argList = call.getArgumentList(); final PsiExpression comparingExpression = argList.getExpressions()[0]; if (comparingExpression instanceof PsiLiteralExpression) { newStatement = buildNewStatement("assertEquals", element, comparingExpression.getText(), comparedExpression.getText()); } else { newStatement = buildNewStatement("assertEquals", element, comparedExpression.getText(), comparingExpression.getText()); } } else { newStatement = buildNewStatement("assertTrue", element, expression.getText()); } PsiReplacementUtil.replaceStatementAndShortenClassNames(statement, newStatement); }