From 72603d39314106eae1407ab0214568247ae95973 Mon Sep 17 00:00:00 2001 From: peter Date: Sat, 4 Mar 2017 13:11:04 +0100 Subject: [PATCH] DaemonAnalyzerTestCase.findAndInvokeIntentionAction: lazily calculate error message to workaround invalid unrelated PSI access in JSIntentionPerformanceTest --- .../codeInsight/daemon/DaemonAnalyzerTestCase.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java b/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java index e111d22d42a5..0913d54f14f7 100644 --- a/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java +++ b/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java @@ -355,12 +355,13 @@ public abstract class DaemonAnalyzerTestCase extends CodeInsightTestCase { List 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); }