From fafb9d1efe7befb154d2b9748306be0b49006cea Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 17 Oct 2016 14:55:45 +0300 Subject: [PATCH] notnull --- .../quickFix/LightQuickFixTestCase.java | 24 +++++++++++-------- .../daemon/quickFix/QuickFixTestCase.java | 15 ++++++------ 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/LightQuickFixTestCase.java b/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/LightQuickFixTestCase.java index 8c9619b112b5..19ec879a4f35 100644 --- a/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/LightQuickFixTestCase.java +++ b/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/LightQuickFixTestCase.java @@ -60,7 +60,7 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase return ActionHint.parse(file, contents); } - private static void doTestFor(final String testName, final QuickFixTestCase quickFixTestCase) { + private static void doTestFor(@NotNull String testName, @NotNull QuickFixTestCase quickFixTestCase) { final String relativePath = ObjectUtils.notNull(quickFixTestCase.getBasePath(), "") + "/" + BEFORE_PREFIX + testName; final String testFullPath = quickFixTestCase.getTestDataPath().replace(File.separatorChar, '/') + relativePath; final File testFile = new File(testFullPath); @@ -204,7 +204,7 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase return files; } - protected void doSingleTest(String fileSuffix) { + protected void doSingleTest(@NotNull String fileSuffix) { doTestFor(fileSuffix, createWrapper()); } @@ -212,10 +212,12 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase doTestFor(fileSuffix, createWrapper(testDataPath)); } + @NotNull protected QuickFixTestCase createWrapper() { return createWrapper(null); } + @NotNull protected QuickFixTestCase createWrapper(final String testDataPath) { return new QuickFixTestCase() { public String myTestDataPath = testDataPath; @@ -225,6 +227,7 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase return LightQuickFixTestCase.this.getBasePath(); } + @NotNull @Override public String getTestDataPath() { if (myTestDataPath == null) { @@ -240,27 +243,27 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase } @Override - public void beforeActionStarted(String testName, String contents) { + public void beforeActionStarted(@NotNull String testName, @NotNull String contents) { LightQuickFixTestCase.this.beforeActionStarted(testName, contents); } @Override - public void afterActionCompleted(String testName, String contents) { + public void afterActionCompleted(@NotNull String testName, @NotNull String contents) { LightQuickFixTestCase.this.afterActionCompleted(testName, contents); } @Override - public void doAction(ActionHint actionHint, String testFullPath, String testName) throws Exception { + public void doAction(@NotNull ActionHint actionHint, @NotNull String testFullPath, @NotNull String testName) throws Exception { LightQuickFixTestCase.this.doAction(actionHint, testFullPath, testName); } @Override - public void checkResultByFile(String s, @NotNull String expectedFilePath, boolean b) throws Exception { - LightQuickFixTestCase.this.checkResultByFile(s, expectedFilePath, b); + public void checkResultByFile(@NotNull String message, @NotNull String expectedFilePath, boolean ignoreTrailingSpaces) throws Exception { + LightQuickFixTestCase.this.checkResultByFile(message, expectedFilePath, ignoreTrailingSpaces); } @Override - public IntentionAction findActionWithText(String text) { + public IntentionAction findActionWithText(@NotNull String text) { return LightQuickFixTestCase.this.findActionWithText(text); } @@ -270,7 +273,7 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase } @Override - public void invoke(IntentionAction action) { + public void invoke(@NotNull IntentionAction action) { LightQuickFixTestCase.invoke(action); } @@ -287,7 +290,7 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase } @Override - public void configureFromFileText(String name, String contents) throws IOException { + public void configureFromFileText(@NotNull String name, @NotNull String contents) throws IOException { LightPlatformCodeInsightTestCase.configureFromFileText(name, contents, true); } @@ -313,6 +316,7 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase return getAvailableActions(getEditor(), getFile()); } + @NotNull public static List getAvailableActions(@NotNull Editor editor, @NotNull PsiFile file) { return CodeInsightTestFixtureImpl.getAvailableIntentions(editor, file); } diff --git a/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/QuickFixTestCase.java b/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/QuickFixTestCase.java index 8c00ae4149dc..e69b636fecd6 100644 --- a/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/QuickFixTestCase.java +++ b/java/testFramework/src/com/intellij/codeInsight/daemon/quickFix/QuickFixTestCase.java @@ -31,24 +31,25 @@ import java.util.List; public interface QuickFixTestCase { String getBasePath(); + @NotNull String getTestDataPath(); @NotNull ActionHint parseActionHintImpl(@NotNull PsiFile file, @NotNull String contents); - void beforeActionStarted(String testName, String contents); + void beforeActionStarted(@NotNull String testName, @NotNull String contents); - void afterActionCompleted(String testName, String contents); + void afterActionCompleted(@NotNull String testName, @NotNull String contents); - void doAction(ActionHint actionHint, String testFullPath, String testName) throws Exception; + void doAction(@NotNull ActionHint actionHint, @NotNull String testFullPath, @NotNull String testName) throws Exception; - void checkResultByFile(String s, @NotNull String expectedFilePath, boolean b) throws Exception; + void checkResultByFile(@NotNull String message, @NotNull String expectedFilePath, boolean ignoreTrailingSpaces) throws Exception; - IntentionAction findActionWithText(String text); + IntentionAction findActionWithText(@NotNull String text); boolean shouldBeAvailableAfterExecution(); - void invoke(IntentionAction action); + void invoke(@NotNull IntentionAction action); @NotNull List doHighlighting(); @@ -58,7 +59,7 @@ public interface QuickFixTestCase { void bringRealEditorBack(); - void configureFromFileText(String name, String contents) throws Throwable; + void configureFromFileText(@NotNull String name, @NotNull String contents) throws Throwable; PsiFile getFile();