package com.intellij.refactoring;
import com.intellij.JavaTestUtil;
-import com.intellij.codeInsight.CodeInsightTestCase;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
import com.intellij.refactoring.anonymousToInner.AnonymousToInnerHandler;
+import com.intellij.testFramework.LightCodeInsightTestCase;
/**
* @author yole
*/
-public class AnonymousToInnerTest extends CodeInsightTestCase {
+public class AnonymousToInnerTest extends LightCodeInsightTestCase {
private static final String TEST_ROOT = "/refactoring/anonymousToInner/";
@Override
}
@Override
- protected Sdk getTestProjectJdk() {
+ protected Sdk getProjectJDK() {
return JavaSdkImpl.getMockJdk15("java 1.5");
}
};
- handler.invoke(myProject, myEditor, myFile, null);
+ handler.invoke(getProject(), myEditor, myFile, null);
checkResultByFile(TEST_ROOT + getTestName(true) + "_after.java");
}
}
package com.intellij.refactoring;
-import com.intellij.codeInsight.CodeInsightTestCase;
+import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.TargetElementUtilBase;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.refactoring.changeSignature.ParameterInfoImpl;
import com.intellij.refactoring.changeSignature.ThrownExceptionInfo;
import com.intellij.refactoring.util.CanonicalTypes;
+import com.intellij.testFramework.LightCodeInsightTestCase;
import com.intellij.util.containers.HashSet;
-import com.intellij.JavaTestUtil;
import java.util.Arrays;
import java.util.Set;
/**
* @author ven
*/
-public class ChangeSignaturePropagationTest extends CodeInsightTestCase {
+public class ChangeSignaturePropagationTest extends LightCodeInsightTestCase {
public void testParamSimple() throws Exception {
parameterPropagationTest();
}
private void parameterPropagationTest() throws Exception {
PsiMethod method = getPrimaryMethod();
PsiClass aClass = method.getContainingClass();
- PsiType newParamType = myJavaFacade.getElementFactory().createTypeByFQClassName("java.lang.Class", GlobalSearchScope.allScope(myProject));
+ PsiType newParamType = JavaPsiFacade.getElementFactory(getProject()).createTypeByFQClassName("java.lang.Class", GlobalSearchScope.allScope(getProject()));
final ParameterInfoImpl[] newParameters = new ParameterInfoImpl[]{new ParameterInfoImpl(-1, "clazz", newParamType, "null")};
final Set<PsiMethod> methodsToPropagateParameters = new HashSet<PsiMethod>(Arrays.asList(aClass.getMethods()));
doTest(newParameters, new ThrownExceptionInfo[0], methodsToPropagateParameters, null, method);
private void exceptionPropagationTest() throws Exception {
PsiMethod method = getPrimaryMethod();
PsiClass aClass = method.getContainingClass();
- PsiClassType newExceptionType = myJavaFacade.getElementFactory().createTypeByFQClassName("java.lang.Exception", GlobalSearchScope.allScope(myProject));
+ PsiClassType newExceptionType = JavaPsiFacade.getElementFactory(getProject()).createTypeByFQClassName("java.lang.Exception", GlobalSearchScope.allScope(getProject()));
final ThrownExceptionInfo[] newExceptions = new ThrownExceptionInfo[]{new ThrownExceptionInfo(-1, newExceptionType)};
final Set<PsiMethod> methodsToPropagateExceptions = new HashSet<PsiMethod>(Arrays.asList(aClass.getMethods()));
doTest(new ParameterInfoImpl[0], newExceptions, null, methodsToPropagateExceptions, method);
final String filePath = getBasePath() + getTestName(false) + ".java";
final PsiType returnType = primaryMethod.getReturnType();
final CanonicalTypes.Type type = returnType == null ? null : CanonicalTypes.createTypeWrapper(returnType);
- new ChangeSignatureProcessor(myProject, primaryMethod, false, null,
+ new ChangeSignatureProcessor(getProject(), primaryMethod, false, null,
primaryMethod.getName(),
type,
generateParameterInfos(primaryMethod, newParameters),
return (PsiMethod) targetElement;
}
- private String getBasePath() {
+ private static String getBasePath() {
return "/refactoring/changeSignaturePropagation/";
}
package com.intellij.refactoring;
import com.intellij.JavaTestUtil;
-import com.intellij.codeInsight.CodeInsightTestCase;
import com.intellij.codeInsight.TargetElementUtilBase;
-import com.intellij.openapi.roots.LanguageLevelProjectExtension;
-import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.*;
import com.intellij.refactoring.changeSignature.ChangeSignatureProcessor;
import com.intellij.refactoring.changeSignature.ParameterInfoImpl;
import com.intellij.refactoring.changeSignature.ThrownExceptionInfo;
+import com.intellij.testFramework.LightCodeInsightTestCase;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NonNls;
/**
* @author dsl
*/
-public class ChangeSignatureTest extends CodeInsightTestCase {
+public class ChangeSignatureTest extends LightCodeInsightTestCase {
public void testSimple() throws Exception {
doTest(null, null, null, new ParameterInfoImpl[0], new ThrownExceptionInfo[0], false);
}
doTest(null, new ParameterInfoImpl[]{new ParameterInfoImpl(-1, "i", PsiType.INT, "0")}, false);
}
- protected void setUpJdk() {
- super.setUpJdk();
- LanguageLevelProjectExtension.getInstance(myProject).setLanguageLevel(LanguageLevel.JDK_1_5);
- }
-
private void doTest(String newReturnType, ParameterInfoImpl[] parameterInfos, final boolean generateDelegate) throws Exception {
doTest(null, null, newReturnType, parameterInfos, new ThrownExceptionInfo[0], generateDelegate);
}
*/
package com.intellij.refactoring;
+import com.intellij.JavaTestUtil;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
-import com.intellij.openapi.roots.LanguageLevelProjectExtension;
-import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.LightCodeInsightTestCase;
-import com.intellij.JavaTestUtil;
public class ExtractMethod15Test extends LightCodeInsightTestCase {
- private LanguageLevel myPreviousLanguageLevel;
private static final String BASE_PATH = "/refactoring/extractMethod15/";
@Override
return JavaTestUtil.getJavaTestDataPath();
}
- protected void setUp() throws Exception {
- super.setUp();
- myPreviousLanguageLevel = LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).getLanguageLevel();
- LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
- }
-
- protected void tearDown() throws Exception {
- LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).setLanguageLevel(myPreviousLanguageLevel);
- super.tearDown();
- }
-
public void testCodeDuplicatesWithMultOccurences() throws Exception {
configureByFile(BASE_PATH + getTestName(false) + ".java");
boolean success = ExtractMethodTest.performExtractMethod(true, true, getEditor(), getFile(), getProject());
*/
package com.intellij.refactoring;
-import com.intellij.codeInsight.CodeInsightTestCase;
+import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.TargetElementUtilBase;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMethod;
import com.intellij.refactoring.extractMethodObject.ExtractMethodObjectProcessor;
import com.intellij.refactoring.util.duplicates.DuplicatesImpl;
-import com.intellij.JavaTestUtil;
+import com.intellij.testFramework.LightCodeInsightTestCase;
-public class ExtractMethodObjectTest extends CodeInsightTestCase {
+public class ExtractMethodObjectTest extends LightCodeInsightTestCase {
@Override
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath();
*/
package com.intellij.refactoring;
-import com.intellij.codeInsight.CodeInsightTestCase;
+import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.CodeInsightUtil;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiExpression;
import com.intellij.refactoring.extractMethodObject.ExtractMethodObjectProcessor;
import com.intellij.refactoring.util.duplicates.DuplicatesImpl;
-import com.intellij.JavaTestUtil;
+import com.intellij.testFramework.LightCodeInsightTestCase;
-public class ExtractMethodObjectWithMultipleExitPointsTest extends CodeInsightTestCase {
+public class ExtractMethodObjectWithMultipleExitPointsTest extends LightCodeInsightTestCase {
@Override
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath();
*/
package com.intellij.refactoring;
+import com.intellij.JavaTestUtil;
import com.intellij.analysis.AnalysisScope;
import com.intellij.codeInsight.TargetElementUtilBase;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
-import com.intellij.openapi.roots.LanguageLevelProjectExtension;
-import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMethod;
import com.intellij.refactoring.util.duplicates.MethodDuplicatesHandler;
import com.intellij.testFramework.LightCodeInsightTestCase;
-import com.intellij.JavaTestUtil;
public abstract class FindMethodDuplicatesBaseTest extends LightCodeInsightTestCase {
- private LanguageLevel myPreviousLanguageLevel;
-
@Override
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath();
}
-
-
- protected void setUp() throws Exception {
- super.setUp();
- myPreviousLanguageLevel = LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).getLanguageLevel();
- LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
- }
-
- protected void tearDown() throws Exception {
- LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).setLanguageLevel(myPreviousLanguageLevel);
- super.tearDown();
- }
protected Sdk getProjectJDK() {
return JavaSdkImpl.getMockJdk15("java 1.5");
package com.intellij.refactoring;
+import com.intellij.JavaTestUtil;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
-import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.refactoring.inheritanceToDelegation.InheritanceToDelegationProcessor;
import com.intellij.util.ArrayUtil;
-import com.intellij.JavaTestUtil;
import java.util.ArrayList;
-import java.util.List;
import java.util.Arrays;
+import java.util.List;
/**
* @author dsl
*/
public class InheritanceToDelegationTest extends MultiFileTestCase {
- private LanguageLevel myPreviousLanguageLevel;
-
@Override
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath();
}
-
- protected void setUp() throws Exception {
- super.setUp();
- myPreviousLanguageLevel = LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).getLanguageLevel();
- LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
- }
-
- protected void tearDown() throws Exception {
- LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).setLanguageLevel(myPreviousLanguageLevel);
- super.tearDown();
- }
-
protected Sdk getTestProjectJdk() {
return JavaSdkImpl.getMockJdk15("java 1.5");
}
package com.intellij.refactoring;
import com.intellij.JavaTestUtil;
-import com.intellij.codeInsight.CodeInsightTestCase;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiJavaFile;
import com.intellij.psi.PsiLocalVariable;
import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.testFramework.LightCodeInsightTestCase;
import junit.framework.Assert;
import org.jetbrains.annotations.NonNls;
/**
* @author ven
*/
-public class IntroduceConstantTest extends CodeInsightTestCase {
+public class IntroduceConstantTest extends LightCodeInsightTestCase {
@NonNls private static final String BASE_PATH = "/refactoring/introduceConstant/";
@Override
doTest(true);
}
- private void convertLocal(final boolean makeEnumConstant) {
+ private static void convertLocal(final boolean makeEnumConstant) {
PsiLocalVariable local = PsiTreeUtil.getParentOfType(getFile().findElementAt(getEditor().getCaretModel().getOffset()), PsiLocalVariable.class);
new MockLocalToFieldHandler(getProject(), true, makeEnumConstant).convertLocalToField(local, getEditor());
}
checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
}
- protected Sdk getTestProjectJdk() {
+ protected Sdk getProjectJDK() {
return JavaSdkImpl.getMockJdk15("java 1.5");
}
}
\ No newline at end of file