DaemonAnalyzerTestCase.findAndInvokeIntentionAction: lazily calculate error message

to workaround invalid unrelated PSI access in JSIntentionPerformanceTest
This commit is contained in:
peter
2017-03-04 13:11:04 +01:00
parent 6cad2fe22c
commit 72603d3931
@@ -355,12 +355,13 @@ public abstract class DaemonAnalyzerTestCase extends CodeInsightTestCase {
List<IntentionAction> actions = getIntentionActions(infos, editor, file);
IntentionAction intentionAction = LightQuickFixTestCase.findActionWithText(actions, intentionActionName);
String message = String.format("Could not find action by name %s.\n" +
"Actions: [%s]\n" +
"HighlightInfos: [%s]", intentionActionName,
StringUtil.join(ContainerUtil.map(actions, c -> c.getText()), ", "),
StringUtil.join(infos, ", "));
assertNotNull(message, intentionAction);
if (intentionAction == null) {
fail(String.format("Could not find action by name %s.\n" +
"Actions: [%s]\n" +
"HighlightInfos: [%s]", intentionActionName,
StringUtil.join(ContainerUtil.map(actions, c -> c.getText()), ", "),
StringUtil.join(infos, ", ")));
}
CodeInsightTestFixtureImpl.invokeIntention(intentionAction, file, editor, intentionActionName);
}