void (@NotNull String code, @NotNull VariableKind kind, String @NotNull ... expected) { assert EditorTestUtil.getCaretPosition(code) >= 0 : "No <caret> specified"; PsiFile file = myFixture.configureByText("Test.java", code); PsiElement element = PsiUtilCore.getElementAtOffset(file, myFixture.getCaretOffset()); PsiExpression expression = PsiTreeUtil.getParentOfType(element, PsiExpression.class, false); SuggestedNameInfo nameInfo = JavaCodeStyleManager.getInstance(getProject()) .suggestVariableName(kind, null, expression, expression.getType()); Assert.assertArrayEquals('"' + StringUtil.join(nameInfo.names, "\", \"") + '"', expected, nameInfo.names); }