From 039b9a8e16674ca94b93464eb23795eb42178ecc Mon Sep 17 00:00:00 2001 From: Michael Nedzelsky Date: Mon, 23 Mar 2015 23:57:14 +0300 Subject: [PATCH] JetCotoImplementationTest -> KotlinGotoImplementationTestGenerated --- .../kotlin/generators/tests/GenerateTests.kt | 5 + .../AbstractKotlinGotoImplementationTest.kt | 37 ++++++++ .../navigation/JetGotoImplementationTest.java | 81 ---------------- ...KotlinGotoImplementationTestGenerated.java | 92 +++++++++++++++++++ 4 files changed, 134 insertions(+), 81 deletions(-) create mode 100644 idea/tests/org/jetbrains/kotlin/idea/navigation/AbstractKotlinGotoImplementationTest.kt delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/navigation/JetGotoImplementationTest.java create mode 100644 idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoImplementationTestGenerated.java diff --git a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index cc28f452942..a6e82c15559 100644 --- a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -72,6 +72,7 @@ import org.jetbrains.kotlin.idea.intentions.AbstractIntentionTest import org.jetbrains.kotlin.idea.intentions.declarations.AbstractJoinLinesTest import org.jetbrains.kotlin.idea.kdoc.AbstractKDocHighlightingTest import org.jetbrains.kotlin.idea.navigation.AbstractGotoSuperTest +import org.jetbrains.kotlin.idea.navigation.AbstractKotlinGotoImplementationTest import org.jetbrains.kotlin.idea.navigation.AbstractKotlinGotoTest import org.jetbrains.kotlin.idea.parameterInfo.AbstractFunctionParameterInfoTest import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiFileTest @@ -407,6 +408,10 @@ fun main(args: Array) { model("navigation/gotoSymbol", testMethod = "doSymbolTest") } + testClass(javaClass()) { + model("navigation/implementations", recursive = false) + } + testClass(javaClass()) { model("quickfix", pattern = """^(\w+)\.before\.Main\.kt$""", testMethod = "doTestWithExtraFile") } diff --git a/idea/tests/org/jetbrains/kotlin/idea/navigation/AbstractKotlinGotoImplementationTest.kt b/idea/tests/org/jetbrains/kotlin/idea/navigation/AbstractKotlinGotoImplementationTest.kt new file mode 100644 index 00000000000..be79d38625d --- /dev/null +++ b/idea/tests/org/jetbrains/kotlin/idea/navigation/AbstractKotlinGotoImplementationTest.kt @@ -0,0 +1,37 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.idea.navigation + +import com.intellij.openapi.projectRoots.Sdk +import com.intellij.testFramework.LightCodeInsightTestCase +import com.intellij.testFramework.LightPlatformCodeInsightTestCase +import org.jetbrains.kotlin.idea.PluginTestCaseBase +import org.jetbrains.kotlin.test.JetTestUtils +import java.io.File + +public abstract class AbstractKotlinGotoImplementationTest : LightCodeInsightTestCase() { + + override fun getTestDataPath(): String = JetTestUtils.getHomeDirectory() + File.separator + + override fun getProjectJDK(): Sdk = PluginTestCaseBase.mockJdk() + + protected fun doTest(path: String) { + configureByFile(path) + val gotoData = NavigationTestUtils.invokeGotoImplementations(LightPlatformCodeInsightTestCase.getEditor(), LightPlatformCodeInsightTestCase.getFile()) + NavigationTestUtils.assertGotoImplementations(LightPlatformCodeInsightTestCase.getEditor(), gotoData) + } +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/navigation/JetGotoImplementationTest.java b/idea/tests/org/jetbrains/kotlin/idea/navigation/JetGotoImplementationTest.java deleted file mode 100644 index ac1fa3d9904..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/navigation/JetGotoImplementationTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.navigation; - -import com.intellij.codeInsight.navigation.GotoTargetHandler; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.testFramework.LightCodeInsightTestCase; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.kotlin.idea.PluginTestCaseBase; - -import java.io.File; - -public class JetGotoImplementationTest extends LightCodeInsightTestCase { - public void testClassNavigation() { - doTest(); - } - - public void testClassImplementorsWithDeclaration() { - doTest(); - } - - public void testAbstractClassImplementorsWithDeclaration() { - doTest(); - } - - public void testTraitImplementorsWithDeclaration() { - doTest(); - } - - public void testFunctionOverrideNavigation() { - doTest(); - } - - public void testPropertyOverriddenNavigation() { - doTest(); - } - - public void testConstructorPropertyOverriddenNavigation() { - doTest(); - } - - public void testOverridesInEnumEntries() { - doTest(); - } - - public void testEnumEntriesInheritance() { - doTest(); - } - - @NotNull - @Override - protected String getTestDataPath() { - return new File(PluginTestCaseBase.getTestDataPathBase(), "/navigation/implementations").getPath() + - File.separator; - } - - @Override - protected Sdk getProjectJDK() { - return PluginTestCaseBase.mockJdk(); - } - - protected void doTest() { - configureByFile(getTestName(false) + ".kt"); - GotoTargetHandler.GotoData gotoData = NavigationTestUtils.invokeGotoImplementations(getEditor(), getFile()); - NavigationTestUtils.assertGotoImplementations(getEditor(), gotoData); - } -} diff --git a/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoImplementationTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoImplementationTestGenerated.java new file mode 100644 index 00000000000..4e7b1f3dba3 --- /dev/null +++ b/idea/tests/org/jetbrains/kotlin/idea/navigation/KotlinGotoImplementationTestGenerated.java @@ -0,0 +1,92 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.idea.navigation; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.InnerTestClasses; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.JetTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("idea/testData/navigation/implementations") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class KotlinGotoImplementationTestGenerated extends AbstractKotlinGotoImplementationTest { + @TestMetadata("AbstractClassImplementorsWithDeclaration.kt") + public void testAbstractClassImplementorsWithDeclaration() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/navigation/implementations/AbstractClassImplementorsWithDeclaration.kt"); + doTest(fileName); + } + + public void testAllFilesPresentInImplementations() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/navigation/implementations"), Pattern.compile("^(.+)\\.kt$"), false); + } + + @TestMetadata("ClassImplementorsWithDeclaration.kt") + public void testClassImplementorsWithDeclaration() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/navigation/implementations/ClassImplementorsWithDeclaration.kt"); + doTest(fileName); + } + + @TestMetadata("ClassNavigation.kt") + public void testClassNavigation() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/navigation/implementations/ClassNavigation.kt"); + doTest(fileName); + } + + @TestMetadata("ConstructorPropertyOverriddenNavigation.kt") + public void testConstructorPropertyOverriddenNavigation() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/navigation/implementations/ConstructorPropertyOverriddenNavigation.kt"); + doTest(fileName); + } + + @TestMetadata("EnumEntriesInheritance.kt") + public void testEnumEntriesInheritance() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/navigation/implementations/EnumEntriesInheritance.kt"); + doTest(fileName); + } + + @TestMetadata("FunctionOverrideNavigation.kt") + public void testFunctionOverrideNavigation() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/navigation/implementations/FunctionOverrideNavigation.kt"); + doTest(fileName); + } + + @TestMetadata("OverridesInEnumEntries.kt") + public void testOverridesInEnumEntries() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/navigation/implementations/OverridesInEnumEntries.kt"); + doTest(fileName); + } + + @TestMetadata("PropertyOverriddenNavigation.kt") + public void testPropertyOverriddenNavigation() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/navigation/implementations/PropertyOverriddenNavigation.kt"); + doTest(fileName); + } + + @TestMetadata("TraitImplementorsWithDeclaration.kt") + public void testTraitImplementorsWithDeclaration() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/navigation/implementations/TraitImplementorsWithDeclaration.kt"); + doTest(fileName); + } +}