use of com.intellij.refactoring.makeStatic.MakeClassStaticProcessor in project intellij-community by JetBrains.
the class MakeClassStaticTest method perform.
private void perform() throws Exception {
configureByFile(TEST_ROOT + getTestName(false) + ".java");
PsiElement element = TargetElementUtil.findTargetElement(myEditor, TargetElementUtil.ELEMENT_NAME_ACCEPTED);
assertTrue(element instanceof PsiClass);
PsiClass aClass = (PsiClass) element;
boolean addClassParameter = MakeStaticUtil.isParameterNeeded(aClass);
new MakeClassStaticProcessor(getProject(), aClass, new Settings(true, addClassParameter ? "anObject" : null, null)).run();
checkResultByFile(TEST_ROOT + getTestName(false) + "_after.java");
}
use of com.intellij.refactoring.makeStatic.MakeClassStaticProcessor in project intellij-community by JetBrains.
the class MakeClassStaticTest method performWithFields.
private void performWithFields() throws Exception {
configureByFile(TEST_ROOT + getTestName(false) + ".java");
PsiElement element = TargetElementUtil.findTargetElement(myEditor, TargetElementUtil.ELEMENT_NAME_ACCEPTED);
assertTrue(element instanceof PsiClass);
PsiClass aClass = (PsiClass) element;
final ArrayList<VariableData> parametersForFields = new ArrayList<>();
final boolean addClassParameter = MakeStaticUtil.buildVariableData(aClass, parametersForFields);
new MakeClassStaticProcessor(getProject(), aClass, new Settings(true, addClassParameter ? "anObject" : null, parametersForFields.toArray(new VariableData[parametersForFields.size()]))).run();
checkResultByFile(TEST_ROOT + getTestName(false) + "_after.java");
}
Aggregations