separate create field from usage tests

This commit is contained in:
peter
2011-06-15 16:30:27 +02:00
parent 5ab252bb58
commit 3a48c86cf1
4 changed files with 50 additions and 5 deletions
@@ -0,0 +1,14 @@
// "Create Field 'field'" "true"
class A {
private MyCloserMap field;
void bar() {
field.put("a", "b");
}
}
class MyCloserMap {
void put(String a, String b) {}
}
@@ -0,0 +1,12 @@
// "Create Field 'field'" "true"
class A {
void bar() {
f<caret>ield.put("a", "b");
}
}
class MyCloserMap {
void put(String a, String b) {}
}
@@ -5,7 +5,19 @@ package com.intellij.codeInsight.daemon.quickFix;
*/
public class CreateFieldFromUsageTest extends LightQuickFixTestCase{
public void test() throws Exception { doAllTests(); }
public void testAnonymousClass() throws Exception { doSingleTest(); }
public void testExpectedTypes() throws Exception { doSingleTest(); }
public void testInterface() throws Exception { doSingleTest(); }
public void testMultipleTypes() throws Exception { doSingleTest(); }
public void testMultipleTypes2() throws Exception { doSingleTest(); }
public void testParametericMethod() throws Exception { doSingleTest(); }
public void testQualifyInner() throws Exception { doSingleTest(); }
public void testSortByRelevance() throws Exception { doSingleTest(); }
public void testTypeArgsFormatted() throws Exception { doSingleTest(); }
protected void doSingleTest() {
doSingleTest(getTestName(false) + ".java");
}
@Override
protected String getBasePath() {
@@ -30,7 +30,6 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.psi.PsiFile;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.intellij.testFramework.LightCodeInsightTestCase;
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.ui.UIUtil;
@@ -90,7 +89,6 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase
}
}
}, "", "");
System.out.println(testFile.getPath());
}
protected void afterActionCompleted(final String testName, final String contents) {
@@ -196,12 +194,21 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase
for (File file : files) {
final String testName = file.getName().substring(BEFORE_PREFIX.length());
doTestFor(testName, testCase);
System.out.println(file.getPath());
}
assertTrue("Test files not found in "+testDirPath,files.length != 0);
}
protected void doSingleTest(String fileSuffix) {
doTestFor(fileSuffix, createWrapper());
}
protected void doAllTests() throws Exception {
doAllTests(new QuickFixTestCase() {
doAllTests(createWrapper());
}
private QuickFixTestCase createWrapper() {
return new QuickFixTestCase() {
@Override
public String getBasePath() {
return LightQuickFixTestCase.this.getBasePath();
@@ -281,7 +288,7 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase
public void bringRealEditorBack() {
LightQuickFixTestCase.bringRealEditorBack();
}
});
};
}
protected List<IntentionAction> getAvailableActions() {