mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
Rename .groovy to .java
IDEA-354899 GitOrigin-RevId: f18ce740b9d50e2adb8e7130462bd553c8c954a3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
02b2582b1e
commit
16653a58e7
@@ -1,47 +0,0 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package org.jetbrains.plugins.groovy.refactoring.move
|
||||
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.refactoring.LightMultiFileTestCase
|
||||
import com.intellij.refactoring.move.moveInner.MoveInnerProcessor
|
||||
import groovy.transform.CompileStatic
|
||||
import org.jetbrains.plugins.groovy.util.TestUtils
|
||||
|
||||
@CompileStatic
|
||||
class GroovyMoveInnerClassTest extends GroovyMoveTestBase {
|
||||
protected String getBasePath() {
|
||||
return TestUtils.getTestDataPath() + "refactoring/move/moveClass/"
|
||||
}
|
||||
|
||||
void testAliasImportedInnerClass() {
|
||||
doTest("p2", "p1.C1.X", "Y")
|
||||
}
|
||||
|
||||
void testStaticInnerClass() {
|
||||
doTest("p2", "p1.X.Y", "Y")
|
||||
}
|
||||
|
||||
@Override
|
||||
void perform(String newPackageName, String[] classNames) {
|
||||
assertEquals("ClassNames should contain source class name and target class name", 2, classNames.length)
|
||||
|
||||
String className = classNames[0]
|
||||
PsiClass psiClass = JavaPsiFacade.getInstance(getProject()).findClass(className, GlobalSearchScope.allScope(getProject()))
|
||||
assertNotNull("Class " + className + " not found", psiClass)
|
||||
|
||||
PsiPackage aPackage = JavaPsiFacade.getInstance(getProject()).findPackage(newPackageName)
|
||||
assertNotNull("Package " + newPackageName + " not found", aPackage)
|
||||
final PsiDirectory[] dirs = aPackage.getDirectories()
|
||||
|
||||
assertEquals(1, dirs.size())
|
||||
final PsiDirectory dir = dirs.first()
|
||||
new MoveInnerProcessor(getProject(), psiClass, classNames[1], false, null, dir).run()
|
||||
|
||||
PsiDocumentManager.getInstance(getProject()).commitAllDocuments()
|
||||
FileDocumentManager.getInstance().saveAllDocuments()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package org.jetbrains.plugins.groovy.refactoring.move;
|
||||
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.move.moveInner.MoveInnerProcessor;
|
||||
import org.jetbrains.plugins.groovy.util.TestUtils;
|
||||
|
||||
public class GroovyMoveInnerClassTest extends GroovyMoveTestBase {
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return TestUtils.getTestDataPath() + "refactoring/move/moveClass/";
|
||||
}
|
||||
|
||||
public void testAliasImportedInnerClass() {
|
||||
doTest("p2", "p1.C1.X", "Y");
|
||||
}
|
||||
|
||||
public void testStaticInnerClass() {
|
||||
doTest("p2", "p1.X.Y", "Y");
|
||||
}
|
||||
|
||||
@Override
|
||||
void perform(String newPackageName, String[] classNames) {
|
||||
assertEquals("ClassNames should contain source class name and target class name", 2, classNames.length);
|
||||
|
||||
String className = classNames[0];
|
||||
PsiClass psiClass = JavaPsiFacade.getInstance(getProject()).findClass(className, GlobalSearchScope.allScope(getProject()));
|
||||
assertNotNull("Class " + className + " not found", psiClass);
|
||||
|
||||
PsiPackage aPackage = JavaPsiFacade.getInstance(getProject()).findPackage(newPackageName);
|
||||
assertNotNull("Package " + newPackageName + " not found", aPackage);
|
||||
final PsiDirectory[] dirs = aPackage.getDirectories();
|
||||
|
||||
assertEquals(1, dirs.length);
|
||||
final PsiDirectory dir = dirs[0];
|
||||
new MoveInnerProcessor(getProject(), psiClass, classNames[1], false, null, dir).run();
|
||||
|
||||
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
|
||||
FileDocumentManager.getInstance().saveAllDocuments();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user