Convert AddOpenToClassDeclarationTest to regular multifile quickfix test
This commit is contained in:
-4
@@ -1,4 +0,0 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AddModifierFix" "false"
|
||||
import testPackage.*
|
||||
|
||||
class foo<T : JavaClass>() {}
|
||||
-2
@@ -1,3 +1 @@
|
||||
package testPackage;
|
||||
|
||||
public final class JavaClass {}
|
||||
-2
@@ -1,6 +1,4 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AddModifierFix" "false"
|
||||
// ERROR: This type is final, so it cannot be inherited from
|
||||
// ACTION: Create test
|
||||
import testPackage.*
|
||||
|
||||
class foo : <caret>JavaClass() {}
|
||||
+1
@@ -0,0 +1 @@
|
||||
public final class JavaClass {}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AddModifierFix" "false"
|
||||
// ACTION: Create test
|
||||
// ACTION: Inline type parameter
|
||||
// ACTION: Remove final upper bound
|
||||
class foo<T : <caret>JavaClass>() {}
|
||||
@@ -52,12 +52,6 @@ import java.util.*
|
||||
import java.util.regex.Pattern
|
||||
|
||||
abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||
|
||||
@Throws(Exception::class)
|
||||
protected open fun doTestWithoutExtraFile(beforeFileName: String) {
|
||||
doTest(beforeFileName, false)
|
||||
}
|
||||
|
||||
@Throws(Exception::class)
|
||||
protected open fun doTestWithExtraFile(beforeFileName: String) {
|
||||
enableInspections(beforeFileName)
|
||||
@@ -66,7 +60,7 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest
|
||||
doMultiFileTest(beforeFileName)
|
||||
}
|
||||
else {
|
||||
doTest(beforeFileName, true)
|
||||
doTest(beforeFileName)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,25 +206,20 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest
|
||||
}
|
||||
|
||||
@Throws(Exception::class)
|
||||
private fun doTest(beforeFileName: String, withExtraFile: Boolean) {
|
||||
private fun doTest(beforeFileName: String) {
|
||||
val mainFile = File(beforeFileName)
|
||||
val originalFileText = FileUtil.loadFile(mainFile, true)
|
||||
|
||||
if (withExtraFile) {
|
||||
val mainFileDir = mainFile.parentFile!!
|
||||
val mainFileDir = mainFile.parentFile!!
|
||||
|
||||
val mainFileName = mainFile.name
|
||||
val extraFiles = mainFileDir.listFiles { dir, name -> name.startsWith(extraFileNamePrefix(mainFileName)) && name != mainFileName }!!
|
||||
val mainFileName = mainFile.name
|
||||
val extraFiles = mainFileDir.listFiles { dir, name -> name.startsWith(extraFileNamePrefix(mainFileName)) && name != mainFileName }!!
|
||||
|
||||
val testFiles = ArrayList<String>()
|
||||
testFiles.add(mainFile.name)
|
||||
extraFiles.mapTo(testFiles) { file -> file.name }
|
||||
val testFiles = ArrayList<String>()
|
||||
testFiles.add(mainFile.name)
|
||||
extraFiles.mapTo(testFiles) { file -> file.name }
|
||||
|
||||
myFixture.configureByFiles(*testFiles.toTypedArray())
|
||||
}
|
||||
else {
|
||||
myFixture.configureByFile(beforeFileName)
|
||||
}
|
||||
myFixture.configureByFiles(*testFiles.toTypedArray())
|
||||
|
||||
CommandProcessor.getInstance().executeCommand(project, {
|
||||
try {
|
||||
|
||||
@@ -1,47 +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.quickfix;
|
||||
|
||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase;
|
||||
|
||||
public class AddOpenToClassDeclarationTest extends AbstractQuickFixMultiFileTest {
|
||||
/*
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
LocalFileSystemUtils.refreshPath(getTestDataPath());
|
||||
String path = getTestDataPath() + "javaCode/";
|
||||
VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, path, myFilesToDelete, false);
|
||||
addSourceContentToRoots(myModule, rootDir);
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
|
||||
}
|
||||
*/
|
||||
|
||||
public void testFinalJavaSupertype() throws Exception {
|
||||
doTestWithoutExtraFile("FinalJavaSupertype.before.kt");
|
||||
}
|
||||
|
||||
public void testFinalJavaUpperBound() throws Exception {
|
||||
doTestWithoutExtraFile("FinalJavaUpperBound.before.kt");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PluginTestCaseBase.getTestDataPathBase() + "/quickfix/modifiers/addOpenToClassDeclaration/finalJavaClass/";
|
||||
}
|
||||
}
|
||||
@@ -1746,23 +1746,16 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/modifiers/addOpenToClassDeclaration"), Pattern.compile("^(\\w+)\\.((before\\.Main\\.\\w+)|(test))$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/modifiers/addOpenToClassDeclaration/finalJavaClass")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class FinalJavaClass extends AbstractQuickFixMultiFileTest {
|
||||
public void testAllFilesPresentInFinalJavaClass() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/modifiers/addOpenToClassDeclaration/finalJavaClass"), Pattern.compile("^(\\w+)\\.((before\\.Main\\.\\w+)|(test))$"), TargetBackend.ANY, true);
|
||||
}
|
||||
@TestMetadata("finalJavaSupertype.before.Main.kt")
|
||||
public void testFinalJavaSupertype() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/modifiers/addOpenToClassDeclaration/finalJavaSupertype.before.Main.kt");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/modifiers/addOpenToClassDeclaration/finalJavaClass/javaCode")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class JavaCode extends AbstractQuickFixMultiFileTest {
|
||||
public void testAllFilesPresentInJavaCode() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/modifiers/addOpenToClassDeclaration/finalJavaClass/javaCode"), Pattern.compile("^(\\w+)\\.((before\\.Main\\.\\w+)|(test))$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
}
|
||||
@TestMetadata("finalJavaUpperBound.before.Main.kt")
|
||||
public void testFinalJavaUpperBound() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/modifiers/addOpenToClassDeclaration/finalJavaUpperBound.before.Main.kt");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6792,25 +6792,6 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/modifiers/addOpenToClassDeclaration/withConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/modifiers/addOpenToClassDeclaration/finalJavaClass")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class FinalJavaClass extends AbstractQuickFixTest {
|
||||
public void testAllFilesPresentInFinalJavaClass() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/modifiers/addOpenToClassDeclaration/finalJavaClass"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/modifiers/addOpenToClassDeclaration/finalJavaClass/javaCode")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class JavaCode extends AbstractQuickFixTest {
|
||||
public void testAllFilesPresentInJavaCode() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/modifiers/addOpenToClassDeclaration/finalJavaClass/javaCode"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/modifiers/suspend")
|
||||
|
||||
Reference in New Issue
Block a user