Implement quickfixes for Android Lint api issues
#KT-16624 Fixed #KT-16625 Fixed #KT-14947 Fixed
This commit is contained in:
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.android.intentions
|
||||
package org.jetbrains.kotlin.android.intention
|
||||
|
||||
import com.intellij.openapi.util.Key
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.android.intentions
|
||||
package org.jetbrains.kotlin.android.intention
|
||||
|
||||
import com.android.resources.ResourceType
|
||||
import com.intellij.CommonBundle
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.android.intentions
|
||||
package org.jetbrains.kotlin.android.intention
|
||||
|
||||
import com.android.SdkConstants
|
||||
import com.google.gson.JsonObject
|
||||
+24
-24
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.android.intentions;
|
||||
package org.jetbrains.kotlin.android.intention;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
@@ -28,131 +28,131 @@ 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/android/resourceIntentions")
|
||||
@TestMetadata("idea/testData/android/resourceIntention")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class AndroidResourceIntentionTestGenerated extends AbstractAndroidResourceIntentionTest {
|
||||
public void testAllFilesPresentInResourceIntentions() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentInSingleGeneratedClass(this.getClass(), new File("idea/testData/android/resourceIntentions"), Pattern.compile("^(.+)\\.test$"), TargetBackend.ANY);
|
||||
public void testAllFilesPresentInResourceIntention() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentInSingleGeneratedClass(this.getClass(), new File("idea/testData/android/resourceIntention"), Pattern.compile("^(.+)\\.test$"), TargetBackend.ANY);
|
||||
}
|
||||
|
||||
@TestMetadata("createColorValueResource/alreadyExists/alreadyExists.test")
|
||||
public void testCreateColorValueResource_alreadyExists_AlreadyExists() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/createColorValueResource/alreadyExists/alreadyExists.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/createColorValueResource/alreadyExists/alreadyExists.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("createColorValueResource/simpleFunction/simpleFunction.test")
|
||||
public void testCreateColorValueResource_simpleFunction_SimpleFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/createColorValueResource/simpleFunction/simpleFunction.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/createColorValueResource/simpleFunction/simpleFunction.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("createLayoutResourceFile/alreadyExists/alreadyExists.test")
|
||||
public void testCreateLayoutResourceFile_alreadyExists_AlreadyExists() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/createLayoutResourceFile/alreadyExists/alreadyExists.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/createLayoutResourceFile/alreadyExists/alreadyExists.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("createLayoutResourceFile/simpleFunction/simpleFunction.test")
|
||||
public void testCreateLayoutResourceFile_simpleFunction_SimpleFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/createLayoutResourceFile/simpleFunction/simpleFunction.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/createLayoutResourceFile/simpleFunction/simpleFunction.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("createStringValueResource/alreadyExists/alreadyExists.test")
|
||||
public void testCreateStringValueResource_alreadyExists_AlreadyExists() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/createStringValueResource/alreadyExists/alreadyExists.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/createStringValueResource/alreadyExists/alreadyExists.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("createStringValueResource/simpleFunction/simpleFunction.test")
|
||||
public void testCreateStringValueResource_simpleFunction_SimpleFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/createStringValueResource/simpleFunction/simpleFunction.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/createStringValueResource/simpleFunction/simpleFunction.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinAndroidAddStringResource/activityExtension/activityExtension.test")
|
||||
public void testKotlinAndroidAddStringResource_activityExtension_ActivityExtension() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/activityExtension/activityExtension.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/activityExtension/activityExtension.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinAndroidAddStringResource/activityMethod/activityMethod.test")
|
||||
public void testKotlinAndroidAddStringResource_activityMethod_ActivityMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/activityMethod/activityMethod.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/activityMethod/activityMethod.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinAndroidAddStringResource/classInActivity/classInActivity.test")
|
||||
public void testKotlinAndroidAddStringResource_classInActivity_ClassInActivity() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/classInActivity/classInActivity.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/classInActivity/classInActivity.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinAndroidAddStringResource/extensionLambda/extensionLambda.test")
|
||||
public void testKotlinAndroidAddStringResource_extensionLambda_ExtensionLambda() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/extensionLambda/extensionLambda.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/extensionLambda/extensionLambda.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinAndroidAddStringResource/function/function.test")
|
||||
public void testKotlinAndroidAddStringResource_function_Function() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/function/function.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/function/function.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinAndroidAddStringResource/genericContextExtensionFunction/genericContextExtensionFunction.test")
|
||||
public void testKotlinAndroidAddStringResource_genericContextExtensionFunction_GenericContextExtensionFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/genericContextExtensionFunction/genericContextExtensionFunction.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/genericContextExtensionFunction/genericContextExtensionFunction.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinAndroidAddStringResource/innerClassInActivity/innerClassInActivity.test")
|
||||
public void testKotlinAndroidAddStringResource_innerClassInActivity_InnerClassInActivity() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/innerClassInActivity/innerClassInActivity.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/innerClassInActivity/innerClassInActivity.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinAndroidAddStringResource/innerViewInActivity/innerViewInActivity.test")
|
||||
public void testKotlinAndroidAddStringResource_innerViewInActivity_InnerViewInActivity() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/innerViewInActivity/innerViewInActivity.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/innerViewInActivity/innerViewInActivity.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinAndroidAddStringResource/objectInActivity/objectInActivity.test")
|
||||
public void testKotlinAndroidAddStringResource_objectInActivity_ObjectInActivity() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/objectInActivity/objectInActivity.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/objectInActivity/objectInActivity.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinAndroidAddStringResource/objectInActivityMethod/objectInActivityMethod.test")
|
||||
public void testKotlinAndroidAddStringResource_objectInActivityMethod_ObjectInActivityMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/objectInActivityMethod/objectInActivityMethod.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/objectInActivityMethod/objectInActivityMethod.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinAndroidAddStringResource/objectInFunction/objectInFunction.test")
|
||||
public void testKotlinAndroidAddStringResource_objectInFunction_ObjectInFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/objectInFunction/objectInFunction.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/objectInFunction/objectInFunction.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinAndroidAddStringResource/stringTemplate/stringTemplate.test")
|
||||
public void testKotlinAndroidAddStringResource_stringTemplate_StringTemplate() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/stringTemplate/stringTemplate.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/stringTemplate/stringTemplate.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinAndroidAddStringResource/viewExtensionActivityMethod/viewExtensionActivityMethod.test")
|
||||
public void testKotlinAndroidAddStringResource_viewExtensionActivityMethod_ViewExtensionActivityMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/viewExtensionActivityMethod/viewExtensionActivityMethod.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/viewExtensionActivityMethod/viewExtensionActivityMethod.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinAndroidAddStringResource/viewMethod/viewMethod.test")
|
||||
public void testKotlinAndroidAddStringResource_viewMethod_ViewMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntentions/kotlinAndroidAddStringResource/viewMethod/viewMethod.test");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/resourceIntention/kotlinAndroidAddStringResource/viewMethod/viewMethod.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
-101
@@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2017 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.android.intentions;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
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/android/intentions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class AndroidIntentionTestGenerated extends AbstractAndroidIntentionTest {
|
||||
public void testAllFilesPresentInIntentions() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/android/intentions"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/android/intentions/suppressLint")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class SuppressLint extends AbstractAndroidIntentionTest {
|
||||
@TestMetadata("activityMethod.kt")
|
||||
public void testActivityMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/intentions/suppressLint/activityMethod.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("addToExistingAnnotation.kt")
|
||||
public void testAddToExistingAnnotation() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/intentions/suppressLint/addToExistingAnnotation.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSuppressLint() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/android/intentions/suppressLint"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("constructorParameter.kt")
|
||||
public void testConstructorParameter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/intentions/suppressLint/constructorParameter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("destructuringDeclaration.kt")
|
||||
public void testDestructuringDeclaration() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/intentions/suppressLint/destructuringDeclaration.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaArgument.kt")
|
||||
public void testLambdaArgument() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/intentions/suppressLint/lambdaArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaArgumentProperty.kt")
|
||||
public void testLambdaArgumentProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/intentions/suppressLint/lambdaArgumentProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("methodParameter.kt")
|
||||
public void testMethodParameter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/intentions/suppressLint/methodParameter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("propertyWithLambda.kt")
|
||||
public void testPropertyWithLambda() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/intentions/suppressLint/propertyWithLambda.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleProperty.kt")
|
||||
public void testSimpleProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/intentions/suppressLint/simpleProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
+25
-13
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
* Copyright 2010-2017 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.
|
||||
@@ -14,40 +14,52 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.android.intentions
|
||||
package org.jetbrains.kotlin.android.quickfix
|
||||
|
||||
import com.android.SdkConstants
|
||||
import com.intellij.codeInspection.InspectionProfileEntry
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.util.PathUtil
|
||||
import org.jetbrains.android.inspections.klint.AndroidLintInspectionBase
|
||||
import org.jetbrains.kotlin.android.KotlinAndroidTestCase
|
||||
import org.jetbrains.kotlin.idea.test.DirectiveBasedActionUtils
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import java.io.File
|
||||
|
||||
|
||||
abstract class AbstractAndroidIntentionTest : KotlinAndroidTestCase() {
|
||||
abstract class AbstractAndroidLintQuickfixTest : KotlinAndroidTestCase() {
|
||||
|
||||
override fun setUp() {
|
||||
AndroidLintInspectionBase.invalidateInspectionShortName2IssueMap()
|
||||
super.setUp()
|
||||
}
|
||||
|
||||
fun doTest(path: String) {
|
||||
val fileText = FileUtil.loadFile(File(path), true)
|
||||
val intentionText = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// INTENTION_TEXT: ") ?: error("Empty intention text")
|
||||
val mainInspectionClassName = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// INSPECTION_CLASS: ") ?: error("Empty inspection class name")
|
||||
val dependency = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// DEPENDENCY: ")
|
||||
val intentionAvailable = !InTextDirectivesUtils.isDirectiveDefined(fileText, "// INTENTION_NOT_AVAILABLE")
|
||||
|
||||
val inspectionClass = Class.forName(mainInspectionClassName).newInstance() as AndroidLintInspectionBase
|
||||
|
||||
myFixture.enableInspections(inspectionClass)
|
||||
val inspection = Class.forName(mainInspectionClassName).newInstance() as InspectionProfileEntry
|
||||
myFixture.enableInspections(inspection)
|
||||
|
||||
val sourceFile = myFixture.copyFileToProject(path, "src/${PathUtil.getFileName(path)}")
|
||||
myFixture.configureFromExistingVirtualFile(sourceFile)
|
||||
|
||||
DirectiveBasedActionUtils.checkForUnexpectedErrors(myFixture.file as KtFile)
|
||||
if (dependency != null) {
|
||||
val (dependencyFile, dependencyTargetPath) = dependency.split(" -> ").map(String::trim)
|
||||
myFixture.copyFileToProject("${PathUtil.getParentPath(path)}/$dependencyFile", "src/$dependencyTargetPath")
|
||||
}
|
||||
|
||||
val intention = myFixture.getAvailableIntention(intentionText) ?: error("Failed to find intention")
|
||||
myFixture.launchAction(intention)
|
||||
|
||||
myFixture.checkResultByFile(path + ".expected")
|
||||
if (intentionAvailable) {
|
||||
val intention = myFixture.getAvailableIntention(intentionText) ?: error("Failed to find intention")
|
||||
myFixture.launchAction(intention)
|
||||
myFixture.checkResultByFile(path + ".expected")
|
||||
}
|
||||
else {
|
||||
assertNull("Intention should not be availabale", myFixture.availableIntentions.find { it.text == intentionText })
|
||||
}
|
||||
}
|
||||
|
||||
override fun createManifest() {
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.android.quickfixes;
|
||||
package org.jetbrains.kotlin.android.quickfix;
|
||||
|
||||
import com.intellij.facet.FacetManager;
|
||||
import com.intellij.facet.ModifiableFacetModel;
|
||||
+272
@@ -0,0 +1,272 @@
|
||||
/*
|
||||
* Copyright 2010-2017 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.android.quickfix;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
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/android/lintQuickfix")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class AndroidLintQuickfixTestGenerated extends AbstractAndroidLintQuickfixTest {
|
||||
public void testAllFilesPresentInLintQuickfix() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/android/lintQuickfix"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/android/lintQuickfix/requiresApi")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class RequiresApi extends AbstractAndroidLintQuickfixTest {
|
||||
public void testAllFilesPresentInRequiresApi() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/android/lintQuickfix/requiresApi"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("annotation.kt")
|
||||
public void testAnnotation() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/requiresApi/annotation.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("companion.kt")
|
||||
public void testCompanion() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/requiresApi/companion.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("defaultParameter.kt")
|
||||
public void testDefaultParameter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/requiresApi/defaultParameter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extend.kt")
|
||||
public void testExtend() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/requiresApi/extend.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("functionLiteral.kt")
|
||||
public void testFunctionLiteral() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/requiresApi/functionLiteral.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("method.kt")
|
||||
public void testMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/requiresApi/method.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("property.kt")
|
||||
public void testProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/requiresApi/property.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("when.kt")
|
||||
public void testWhen() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/requiresApi/when.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/android/lintQuickfix/suppressLint")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class SuppressLint extends AbstractAndroidLintQuickfixTest {
|
||||
@TestMetadata("activityMethod.kt")
|
||||
public void testActivityMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/suppressLint/activityMethod.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("addToExistingAnnotation.kt")
|
||||
public void testAddToExistingAnnotation() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/suppressLint/addToExistingAnnotation.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSuppressLint() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/android/lintQuickfix/suppressLint"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("constructorParameter.kt")
|
||||
public void testConstructorParameter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/suppressLint/constructorParameter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("destructuringDeclaration.kt")
|
||||
public void testDestructuringDeclaration() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/suppressLint/destructuringDeclaration.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaArgument.kt")
|
||||
public void testLambdaArgument() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/suppressLint/lambdaArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaArgumentProperty.kt")
|
||||
public void testLambdaArgumentProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/suppressLint/lambdaArgumentProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("methodParameter.kt")
|
||||
public void testMethodParameter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/suppressLint/methodParameter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("propertyWithLambda.kt")
|
||||
public void testPropertyWithLambda() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/suppressLint/propertyWithLambda.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleProperty.kt")
|
||||
public void testSimpleProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/suppressLint/simpleProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/android/lintQuickfix/targetApi")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class TargetApi extends AbstractAndroidLintQuickfixTest {
|
||||
public void testAllFilesPresentInTargetApi() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/android/lintQuickfix/targetApi"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("annotation.kt")
|
||||
public void testAnnotation() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetApi/annotation.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("companion.kt")
|
||||
public void testCompanion() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetApi/companion.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("defaultParameter.kt")
|
||||
public void testDefaultParameter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetApi/defaultParameter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extend.kt")
|
||||
public void testExtend() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetApi/extend.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("functionLiteral.kt")
|
||||
public void testFunctionLiteral() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetApi/functionLiteral.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("method.kt")
|
||||
public void testMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetApi/method.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("property.kt")
|
||||
public void testProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetApi/property.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("when.kt")
|
||||
public void testWhen() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetApi/when.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/android/lintQuickfix/targetVersionCheck")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class TargetVersionCheck extends AbstractAndroidLintQuickfixTest {
|
||||
public void testAllFilesPresentInTargetVersionCheck() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/android/lintQuickfix/targetVersionCheck"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("annotation.kt")
|
||||
public void testAnnotation() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetVersionCheck/annotation.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("defaultParameter.kt")
|
||||
public void testDefaultParameter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetVersionCheck/defaultParameter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("expressionBody.kt")
|
||||
public void testExpressionBody() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetVersionCheck/expressionBody.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("functionLiteral.kt")
|
||||
public void testFunctionLiteral() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetVersionCheck/functionLiteral.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("if.kt")
|
||||
public void testIf() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetVersionCheck/if.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ifWithBlock.kt")
|
||||
public void testIfWithBlock() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetVersionCheck/ifWithBlock.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("method.kt")
|
||||
public void testMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetVersionCheck/method.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("when.kt")
|
||||
public void testWhen() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lintQuickfix/targetVersionCheck/when.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.android.quickfixes;
|
||||
package org.jetbrains.kotlin.android.quickfix;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
Reference in New Issue
Block a user