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,2 +1,2 @@
|
||||
public class Subclass<E extends Runnable, Q extends Runnable> extends Superclass<E, Q> {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import java.util.List;
|
||||
|
||||
public class Subclass<E extends List<String>> extends Superclass<E> {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
public abstract class TestSubclass implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,4 @@ package a;
|
||||
|
||||
public abstract class Test {
|
||||
abstract void x();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,4 @@ public abstract class Test {
|
||||
abstract void x();
|
||||
|
||||
private void xx(){}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,4 +4,4 @@ public class Test extends Sup {
|
||||
void x() {
|
||||
foo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,4 @@ package a;
|
||||
|
||||
public class Test extends Sup {
|
||||
void foo(){}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,4 @@ public class Test {
|
||||
void x() {
|
||||
foo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
public class Test {
|
||||
public void m() {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,4 +4,4 @@ public class Test extends ArrayList {
|
||||
public Test(int capacity) {
|
||||
super(capacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
public abstract class Test implements java.util.List<String> {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,4 +4,4 @@ public class Test {
|
||||
public Test() {
|
||||
x = (String)"";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,4 @@ public class Test {
|
||||
|
||||
protected static class X {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@ package p1;
|
||||
public class A {
|
||||
public void m1() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
public class Test {
|
||||
public <T> T m(){return null;}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
public class Test<A, B extends Number> {
|
||||
public B m(A a){return null;}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,4 +4,4 @@ public class Test extends ArrayList {
|
||||
void x() {
|
||||
removeRange(0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,4 +4,4 @@ public class Test {
|
||||
public Test(int a) {
|
||||
this.a = a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,4 +4,4 @@ public class B {
|
||||
public static B getInstance() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,4 @@ public class Test {
|
||||
interface B<T> {
|
||||
void bar(T t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,4 @@ public class B extends A<String> {
|
||||
public B(String e) {
|
||||
super(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,4 @@ package pack2;
|
||||
|
||||
public class X {
|
||||
public void foo(X x) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,4 @@ package pack1;
|
||||
|
||||
class Class2 {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package s;
|
||||
|
||||
class MyLocal{}
|
||||
class MyLocal{}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package t;
|
||||
|
||||
class MyLocal{}
|
||||
class MyLocal{}
|
||||
|
||||
@@ -6,4 +6,4 @@ public class B extends A {
|
||||
private B() {
|
||||
System.out.println("Constructor");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,4 @@ class B {
|
||||
}
|
||||
|
||||
static void foo(){}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,4 +4,4 @@ class B {
|
||||
B() {
|
||||
System.out.println("Constructor");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,4 @@ public enum E {
|
||||
E(final String presentableText) {
|
||||
PRESENTABLE_TEXT = presentableText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,4 @@ class B extends S{
|
||||
super(a.foo());
|
||||
this.a = a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package p;
|
||||
|
||||
public enum E {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,4 +4,4 @@ public class B {
|
||||
public static B create() {
|
||||
return new B();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,4 +4,4 @@ class B {
|
||||
public static B create() {
|
||||
return new B();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,4 @@ import java.util.List;
|
||||
abstract class A implements List<A.B> {
|
||||
static class B {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pack1;
|
||||
|
||||
public class Inner {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,4 @@ public class MyRunnable {
|
||||
public void run() {
|
||||
d.iAmProtected();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,4 @@ public class StaticInner {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package xxx;
|
||||
|
||||
public class Inner {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,4 @@ class Inner {
|
||||
public Inner(Outer outer) {
|
||||
this.outer = outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,4 @@ public class B extends X {
|
||||
public B(A outer) {
|
||||
this.outer = outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package package2;
|
||||
|
||||
public class InnerClass { }
|
||||
public class InnerClass { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pack1;
|
||||
|
||||
public class Inner {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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