mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Better diagnostics
This commit is contained in:
+13
-8
@@ -127,11 +127,18 @@ import java.util.*;
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
*/
|
||||
@SuppressWarnings({"TestMethodWithIncorrectSignature"})
|
||||
@SuppressWarnings({"TestMethodWithIncorrectSignature", "JUnitTestCaseWithNoTests", "JUnitTestClassNamingConvention"})
|
||||
public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsightTestFixture {
|
||||
|
||||
@NonNls private static final String PROFILE = "Configurable";
|
||||
|
||||
private static final Function<IntentionAction,String> INTENTION_NAME_FUN = new Function<IntentionAction, String>() {
|
||||
@Override
|
||||
public String fun(final IntentionAction intentionAction) {
|
||||
return "\"" + intentionAction.getText() + "\"";
|
||||
}
|
||||
};
|
||||
|
||||
private PsiManagerImpl myPsiManager;
|
||||
private PsiFile myFile;
|
||||
private Editor myEditor;
|
||||
@@ -480,13 +487,11 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
@Override
|
||||
public IntentionAction findSingleIntention(@NotNull final String hint) {
|
||||
final List<IntentionAction> list = filterAvailableIntentions(hint);
|
||||
if (list.size() != 1) {
|
||||
Assert.fail(StringUtil.join(getAvailableIntentions(), new Function<IntentionAction, String>() {
|
||||
@Override
|
||||
public String fun(final IntentionAction intentionAction) {
|
||||
return intentionAction.getText();
|
||||
}
|
||||
}, ", "));
|
||||
if (list.size() == 0) {
|
||||
Assert.fail("\"" + hint + "\" not in [" + StringUtil.join(getAvailableIntentions(), INTENTION_NAME_FUN, ", ") + "]");
|
||||
}
|
||||
else if (list.size() > 1) {
|
||||
Assert.fail("Too many intention found for \"" + hint + "\": [" + StringUtil.join(list, INTENTION_NAME_FUN, ", ") + "]");
|
||||
}
|
||||
return UsefulTestCase.assertOneElement(list);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user