String (@NonNls String memberName, PsiElement context, String... argumentTexts) { final PsiElementFactory factory = JavaPsiFacade.getElementFactory(context.getProject()); final StringBuilder builder = new StringBuilder(memberName).append('('); boolean comma = false; for (String argumentText : argumentTexts) { if (comma) { builder.append(','); } else { comma = true; } builder.append(argumentText); } builder.append(')'); final String text = builder.toString(); final String qualifier = isJUnit5(context) ? "org.junit.jupiter.api.Assertions" : "org.junit.Assert"; final PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression)factory.createExpressionFromText(text, context); final PsiMethod method = methodCallExpression.resolveMethod(); if (isJUnitMethod(method) || hasStaticImports(context) && ImportUtils.addStaticImport(qualifier, memberName, context)) { return text + ';'; } else { return qualifier + '.' + text + ';'; } }