test++
authorDmitry Jemerov <yole@intellij.com>
Fri, 11 Sep 2009 14:08:20 +0000 (18:08 +0400)
committerDmitry Jemerov <yole@intellij.com>
Fri, 11 Sep 2009 14:08:20 +0000 (18:08 +0400)
17 files changed:
java/java-tests/testData/refactoring/replaceConstructorWithFactory/after01.java [moved from testData/refactoring/replaceConstructorWithFactory/after01.java with 100% similarity]
java/java-tests/testData/refactoring/replaceConstructorWithFactory/after02.java [moved from testData/refactoring/replaceConstructorWithFactory/after02.java with 100% similarity]
java/java-tests/testData/refactoring/replaceConstructorWithFactory/after03.java [moved from testData/refactoring/replaceConstructorWithFactory/after03.java with 100% similarity]
java/java-tests/testData/refactoring/replaceConstructorWithFactory/after04.java [moved from testData/refactoring/replaceConstructorWithFactory/after04.java with 100% similarity]
java/java-tests/testData/refactoring/replaceConstructorWithFactory/after05.java [moved from testData/refactoring/replaceConstructorWithFactory/after05.java with 100% similarity]
java/java-tests/testData/refactoring/replaceConstructorWithFactory/after06.java [moved from testData/refactoring/replaceConstructorWithFactory/after06.java with 100% similarity]
java/java-tests/testData/refactoring/replaceConstructorWithFactory/after07.java [moved from testData/refactoring/replaceConstructorWithFactory/after07.java with 100% similarity]
java/java-tests/testData/refactoring/replaceConstructorWithFactory/after08.java [moved from testData/refactoring/replaceConstructorWithFactory/after08.java with 100% similarity]
java/java-tests/testData/refactoring/replaceConstructorWithFactory/before01.java [moved from testData/refactoring/replaceConstructorWithFactory/before01.java with 100% similarity]
java/java-tests/testData/refactoring/replaceConstructorWithFactory/before02.java [moved from testData/refactoring/replaceConstructorWithFactory/before02.java with 100% similarity]
java/java-tests/testData/refactoring/replaceConstructorWithFactory/before03.java [moved from testData/refactoring/replaceConstructorWithFactory/before03.java with 100% similarity]
java/java-tests/testData/refactoring/replaceConstructorWithFactory/before04.java [moved from testData/refactoring/replaceConstructorWithFactory/before04.java with 100% similarity]
java/java-tests/testData/refactoring/replaceConstructorWithFactory/before05.java [moved from testData/refactoring/replaceConstructorWithFactory/before05.java with 100% similarity]
java/java-tests/testData/refactoring/replaceConstructorWithFactory/before06.java [moved from testData/refactoring/replaceConstructorWithFactory/before06.java with 100% similarity]
java/java-tests/testData/refactoring/replaceConstructorWithFactory/before07.java [moved from testData/refactoring/replaceConstructorWithFactory/before07.java with 100% similarity]
java/java-tests/testData/refactoring/replaceConstructorWithFactory/before08.java [moved from testData/refactoring/replaceConstructorWithFactory/before08.java with 100% similarity]
java/java-tests/testSrc/com/intellij/refactoring/ReplaceConstructorWithFactoryTest.java [moved from refactoring/tests/com/intellij/refactoring/ReplaceConstructorWithFactoryTest.java with 68% similarity]

similarity index 68%
rename from refactoring/tests/com/intellij/refactoring/ReplaceConstructorWithFactoryTest.java
rename to java/java-tests/testSrc/com/intellij/refactoring/ReplaceConstructorWithFactoryTest.java
index 1759594978183e30e3731e39e7d87413851485ce..aea34ac22f8eef9b61ffbcc16191924dd522961f 100644 (file)
@@ -1,21 +1,20 @@
 package com.intellij.refactoring;
 
-import com.intellij.codeInsight.CodeInsightTestCase;
-import com.intellij.openapi.roots.LanguageLevelProjectExtension;
-import com.intellij.pom.java.LanguageLevel;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiMethod;
+import com.intellij.JavaTestUtil;
+import com.intellij.psi.*;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.refactoring.replaceConstructorWithFactory.ReplaceConstructorWithFactoryProcessor;
+import com.intellij.testFramework.LightCodeInsightTestCase;
 import org.jetbrains.annotations.NonNls;
 
 /**
  * @author dsl
  */
-public class ReplaceConstructorWithFactoryTest extends CodeInsightTestCase {
-  private LanguageLevel myPrevLanguageLevel;
+public class ReplaceConstructorWithFactoryTest extends LightCodeInsightTestCase {
+  @Override
+  protected String getTestDataPath() {
+    return JavaTestUtil.getJavaTestDataPath();
+  }
 
   public void testEmptyConstructor() throws Exception { runTest("01", null); }
 
@@ -64,7 +63,7 @@ public class ReplaceConstructorWithFactoryTest extends CodeInsightTestCase {
     }
     PsiClass targetClass = null;
     if (targetClassName != null) {
-      targetClass = myJavaFacade.findClass(targetClassName, GlobalSearchScope.allScope(getProject()));
+      targetClass = JavaPsiFacade.getInstance(getProject()).findClass(targetClassName, GlobalSearchScope.allScope(getProject()));
       assertTrue(targetClass != null);
     }
 
@@ -74,28 +73,15 @@ public class ReplaceConstructorWithFactoryTest extends CodeInsightTestCase {
         targetClass = constructor.getContainingClass();
       }
       replaceConstructorWithFactoryProcessor = new ReplaceConstructorWithFactoryProcessor(
-        myProject, constructor, constructor.getContainingClass(), targetClass, "new" + constructor.getName());
+        getProject(), constructor, constructor.getContainingClass(), targetClass, "new" + constructor.getName());
     }
     else {
       if (targetClass == null) {
         targetClass = aClass;
       }
       replaceConstructorWithFactoryProcessor = new ReplaceConstructorWithFactoryProcessor(
-        myProject, null, aClass, targetClass, "new" + aClass.getName());
+        getProject(), null, aClass, targetClass, "new" + aClass.getName());
     }
     replaceConstructorWithFactoryProcessor.run();
   }
-
-
-  protected void setUp() throws Exception {
-    super.setUp();
-    myPrevLanguageLevel = LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).getLanguageLevel();
-    LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
-  }
-
-
-  protected void tearDown() throws Exception {
-    LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).setLanguageLevel(myPrevLanguageLevel);
-    super.tearDown();
-  }
 }