mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
lighten up, remove redundant language level setting
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
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
|
||||
@@ -18,7 +18,7 @@ public class AnonymousToInnerTest extends CodeInsightTestCase {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sdk getTestProjectJdk() {
|
||||
protected Sdk getProjectJDK() {
|
||||
return JavaSdkImpl.getMockJdk15("java 1.5");
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class AnonymousToInnerTest extends CodeInsightTestCase {
|
||||
};
|
||||
|
||||
|
||||
handler.invoke(myProject, myEditor, myFile, null);
|
||||
handler.invoke(getProject(), myEditor, myFile, null);
|
||||
checkResultByFile(TEST_ROOT + getTestName(true) + "_after.java");
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -1,6 +1,6 @@
|
||||
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;
|
||||
@@ -8,8 +8,8 @@ import com.intellij.refactoring.changeSignature.ChangeSignatureProcessor;
|
||||
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;
|
||||
@@ -17,7 +17,7 @@ import java.util.Set;
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public class ChangeSignaturePropagationTest extends CodeInsightTestCase {
|
||||
public class ChangeSignaturePropagationTest extends LightCodeInsightTestCase {
|
||||
public void testParamSimple() throws Exception {
|
||||
parameterPropagationTest();
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public class ChangeSignaturePropagationTest extends CodeInsightTestCase {
|
||||
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);
|
||||
@@ -46,7 +46,7 @@ public class ChangeSignaturePropagationTest extends CodeInsightTestCase {
|
||||
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);
|
||||
@@ -60,7 +60,7 @@ public class ChangeSignaturePropagationTest extends CodeInsightTestCase {
|
||||
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),
|
||||
@@ -78,7 +78,7 @@ public class ChangeSignaturePropagationTest extends CodeInsightTestCase {
|
||||
return (PsiMethod) targetElement;
|
||||
}
|
||||
|
||||
private String getBasePath() {
|
||||
private static String getBasePath() {
|
||||
return "/refactoring/changeSignaturePropagation/";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
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);
|
||||
}
|
||||
@@ -202,11 +200,6 @@ public class ChangeSignatureTest extends CodeInsightTestCase {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -4,15 +4,12 @@
|
||||
*/
|
||||
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
|
||||
@@ -20,17 +17,6 @@ public class ExtractMethod15Test extends LightCodeInsightTestCase {
|
||||
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());
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
*/
|
||||
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();
|
||||
|
||||
+3
-3
@@ -4,15 +4,15 @@
|
||||
*/
|
||||
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();
|
||||
|
||||
@@ -4,37 +4,21 @@
|
||||
*/
|
||||
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");
|
||||
|
||||
@@ -1,44 +1,28 @@
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
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
|
||||
@@ -36,7 +36,7 @@ public class IntroduceConstantTest extends CodeInsightTestCase {
|
||||
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());
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class IntroduceConstantTest extends CodeInsightTestCase {
|
||||
checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
|
||||
}
|
||||
|
||||
protected Sdk getTestProjectJdk() {
|
||||
protected Sdk getProjectJDK() {
|
||||
return JavaSdkImpl.getMockJdk15("java 1.5");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user