void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiAssertStatement assertStatement = element instanceof PsiKeyword ? (PsiAssertStatement)element.getParent() : (PsiAssertStatement)element; if (!(assertStatement.getParent() instanceof PsiCodeBlock)) { assertStatement = BlockUtils.expandSingleStatementToBlockStatement(assertStatement); } final PsiExpression condition = assertStatement.getAssertCondition(); CommentTracker tracker = new CommentTracker(); final String conditionText = BoolUtils.getNegatedExpressionText(condition, tracker); final PsiExpression description = assertStatement.getAssertDescription(); final String errorText = description != null ? tracker.text(description) : ""; String newStatement = "if(" + conditionText + ") throw new java.lang.AssertionError(" + errorText + ");"; PsiReplacementUtil.replaceStatement(assertStatement, newStatement, tracker); }