mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 05:09:37 +07:00
[tests] fixes strange overriding of inner templates; corrects test data
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.java.codeInsight.daemon.quickFix
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.JavaModuleGraphUtil
|
||||
@@ -25,7 +23,7 @@ class CreateServiceImplementationClassTest : LightJava9ModulesCodeInsightFixture
|
||||
myFixture.checkResult("foo/bar/MyServiceImpl.java",
|
||||
"package foo.bar;\n\n" +
|
||||
"public class MyServiceImpl extends MyService {\n" +
|
||||
"}", true)
|
||||
"}\n", true)
|
||||
}
|
||||
|
||||
fun testExistingPackageInterfaceImported() {
|
||||
@@ -36,7 +34,7 @@ class CreateServiceImplementationClassTest : LightJava9ModulesCodeInsightFixture
|
||||
myFixture.checkResult("foo/bar/MyServiceImpl.java",
|
||||
"package foo.bar;\n\n" +
|
||||
"public class MyServiceImpl extends MyService {\n" +
|
||||
"}", true)
|
||||
"}\n", true)
|
||||
}
|
||||
|
||||
fun testExistingPackageNested() {
|
||||
@@ -67,7 +65,7 @@ class CreateServiceImplementationClassTest : LightJava9ModulesCodeInsightFixture
|
||||
"import foo.bar.MyService;\n" +
|
||||
"\n" +
|
||||
"public class MyServiceImpl extends MyService {\n" +
|
||||
"}", true)
|
||||
"}\n", true)
|
||||
}
|
||||
|
||||
fun testNestedNonexistentPackage() {
|
||||
@@ -80,7 +78,7 @@ class CreateServiceImplementationClassTest : LightJava9ModulesCodeInsightFixture
|
||||
"import foo.bar.MyService;\n" +
|
||||
"\n" +
|
||||
"public class MyServiceImpl extends MyService {\n" +
|
||||
"}", true)
|
||||
"}\n", true)
|
||||
}
|
||||
|
||||
fun testNestedNonexistentPackageProviderMethod() {
|
||||
@@ -96,7 +94,7 @@ class CreateServiceImplementationClassTest : LightJava9ModulesCodeInsightFixture
|
||||
" public static MyService provider() {\n" +
|
||||
" return null;\n" +
|
||||
" }\n" +
|
||||
"}", true)
|
||||
"}\n", true)
|
||||
}
|
||||
|
||||
fun testMultipleImplementations() {
|
||||
@@ -108,7 +106,7 @@ class CreateServiceImplementationClassTest : LightJava9ModulesCodeInsightFixture
|
||||
myFixture.checkResult("foo/bar/MyServiceImpl.java",
|
||||
"package foo.bar;\n\n" +
|
||||
"public class MyServiceImpl extends MyService {\n" +
|
||||
"}", true)
|
||||
"}\n", true)
|
||||
}
|
||||
|
||||
fun testAbstractSuperclass() {
|
||||
@@ -119,7 +117,7 @@ class CreateServiceImplementationClassTest : LightJava9ModulesCodeInsightFixture
|
||||
myFixture.checkResult("foo/bar/MyServiceImpl.java",
|
||||
"package foo.bar;\n\n" +
|
||||
"public class MyServiceImpl extends MyService {\n" +
|
||||
"}", true)
|
||||
"}\n", true)
|
||||
}
|
||||
|
||||
fun testServiceInterface() {
|
||||
@@ -130,7 +128,7 @@ class CreateServiceImplementationClassTest : LightJava9ModulesCodeInsightFixture
|
||||
myFixture.checkResult("foo/bar/MyServiceImpl.java",
|
||||
"package foo.bar;\n\n" +
|
||||
"public class MyServiceImpl implements MyService {\n" +
|
||||
"}", true)
|
||||
"}\n", true)
|
||||
}
|
||||
|
||||
fun testServiceSuperclassFromOtherModule() {
|
||||
@@ -144,7 +142,7 @@ class CreateServiceImplementationClassTest : LightJava9ModulesCodeInsightFixture
|
||||
"import foo.bar.other.MyService;\n" +
|
||||
"\n" +
|
||||
"public class MyServiceImpl extends MyService {\n" +
|
||||
"}", true)
|
||||
"}\n", true)
|
||||
}
|
||||
|
||||
fun testServiceSuperclassFromNotReadableModule() {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.java.codeInsight.daemon.quickFix
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.JavaModuleGraphUtil
|
||||
@@ -27,7 +25,7 @@ class CreateServiceInterfaceOrClassTest : LightJava9ModulesCodeInsightFixtureTes
|
||||
myFixture.checkResult("foo/bar/MyService.java",
|
||||
"package foo.bar;\n\n" +
|
||||
"public class MyService {\n" +
|
||||
"}", true)
|
||||
"}\n", true)
|
||||
}
|
||||
|
||||
fun testSameModuleExistingPackageInterface() {
|
||||
@@ -39,7 +37,7 @@ class CreateServiceInterfaceOrClassTest : LightJava9ModulesCodeInsightFixtureTes
|
||||
myFixture.checkResult("foo/bar/MyService.java",
|
||||
"package foo.bar;\n\n" +
|
||||
"public interface MyService {\n" +
|
||||
"}", true)
|
||||
"}\n", true)
|
||||
}
|
||||
|
||||
fun testSameModuleExistingPackageAnnotation() {
|
||||
@@ -51,7 +49,7 @@ class CreateServiceInterfaceOrClassTest : LightJava9ModulesCodeInsightFixtureTes
|
||||
myFixture.checkResult("foo/bar/MyService.java",
|
||||
"package foo.bar;\n\n" +
|
||||
"public @interface MyService {\n" +
|
||||
"}", true)
|
||||
"}\n", true)
|
||||
}
|
||||
|
||||
fun testOtherModuleExistingPackage() {
|
||||
@@ -65,7 +63,7 @@ class CreateServiceInterfaceOrClassTest : LightJava9ModulesCodeInsightFixtureTes
|
||||
myFixture.checkResult("../${OTHER.rootName}/foo/bar/other/MyService.java",
|
||||
"package foo.bar.other;\n\n" +
|
||||
"public class MyService {\n" +
|
||||
"}", true)
|
||||
"}\n", true)
|
||||
}
|
||||
|
||||
fun testSameModuleExistingOuterClass() {
|
||||
@@ -90,7 +88,7 @@ class CreateServiceInterfaceOrClassTest : LightJava9ModulesCodeInsightFixtureTes
|
||||
myFixture.checkResult("foo/bar/api/MyService.java",
|
||||
"package foo.bar.api;\n\n" +
|
||||
"public class MyService {\n" +
|
||||
"}", true)
|
||||
"}\n", true)
|
||||
}
|
||||
|
||||
fun testExistingLibraryPackage() = doTestNoAction("module foo.bar { uses java.io.<caret>MyService; }")
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight;
|
||||
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
|
||||
import com.intellij.ide.fileTemplates.FileTemplate;
|
||||
import com.intellij.ide.fileTemplates.FileTemplateManager;
|
||||
import com.intellij.ide.fileTemplates.impl.FileTemplateManagerImpl;
|
||||
import com.intellij.injected.editor.EditorWindow;
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -50,7 +47,10 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Mike
|
||||
@@ -71,25 +71,6 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
return editor;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
fixTemplates();
|
||||
}
|
||||
|
||||
public static void fixTemplates() {
|
||||
FileTemplateManager manager = FileTemplateManager.getDefaultInstance();
|
||||
for (String tname : Arrays.asList("Class", "AnnotationType", "Enum", "Interface")) {
|
||||
for (FileTemplate template : manager.getInternalTemplates()) {
|
||||
if (tname.equals(template.getName())) {
|
||||
String text = "package $PACKAGE_NAME$;\npublic " + manager.internalTemplateToSubject(tname) + " $NAME$ { }";
|
||||
template.setText(FileTemplateManagerImpl.normalizeText(text));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user