172: Revert "AbstractQuickFixTest: FORCE_PACKAGE_FOLDER directive added"
This reverts commit 91e10ae8bb6d2748a7a8b02fa661daa4cb00d0f8.
This commit is contained in:
@@ -73,13 +73,6 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getPathAccordingToPackage(name: String, text: String): String {
|
|
||||||
val packagePath = text.lines().let { it.find { it.trim().startsWith("package") } }
|
|
||||||
?.removePrefix("package")
|
|
||||||
?.trim()?.replace(".", "/") ?: ""
|
|
||||||
return packagePath + "/" + name
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun doKotlinQuickFixTest(beforeFileName: String) {
|
private fun doKotlinQuickFixTest(beforeFileName: String) {
|
||||||
val testFile = File(beforeFileName)
|
val testFile = File(beforeFileName)
|
||||||
CommandProcessor.getInstance().executeCommand(project, {
|
CommandProcessor.getInstance().executeCommand(project, {
|
||||||
@@ -97,22 +90,13 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
|
|
||||||
expectedErrorMessage = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// SHOULD_FAIL_WITH: ")
|
expectedErrorMessage = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// SHOULD_FAIL_WITH: ")
|
||||||
val contents = StringUtil.convertLineSeparators(fileText)
|
val contents = StringUtil.convertLineSeparators(fileText)
|
||||||
var filePath = testFile.canonicalFile.name
|
myFixture.configureByText(testFile.canonicalFile.name, contents)
|
||||||
val putIntoPackageFolder = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// FORCE_PACKAGE_FOLDER") != null
|
|
||||||
if (putIntoPackageFolder) {
|
|
||||||
filePath = getPathAccordingToPackage(filePath, contents)
|
|
||||||
myFixture.addFileToProject(filePath, contents)
|
|
||||||
myFixture.configureByFile(filePath)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
myFixture.configureByText(filePath, contents)
|
|
||||||
}
|
|
||||||
|
|
||||||
checkForUnexpectedActions()
|
checkForUnexpectedActions()
|
||||||
|
|
||||||
configExtra(fileText)
|
configExtra(fileText)
|
||||||
|
|
||||||
applyAction(contents, filePath)
|
applyAction(contents, testFile.canonicalPath)
|
||||||
|
|
||||||
UsefulTestCase.assertEmpty(expectedErrorMessage)
|
UsefulTestCase.assertEmpty(expectedErrorMessage)
|
||||||
}
|
}
|
||||||
|
|||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
// "Add qualifier" "true"
|
||||||
|
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
|
||||||
|
// CONFIGURE_SPRING_FILE_SET
|
||||||
|
// WITH_RUNTIME
|
||||||
|
// DISABLE-ERRORS
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
|
import org.springframework.stereotype.Component
|
||||||
|
import org.springframework.context.annotation.ComponentScan
|
||||||
|
import org.springframework.context.annotation.Configuration
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@ComponentScan
|
||||||
|
open class InvalidAutowiredByTypeQualifiers
|
||||||
|
|
||||||
|
abstract class BaseBarBean
|
||||||
|
@Component
|
||||||
|
open class BarBean1 : BaseBarBean()
|
||||||
|
@Component
|
||||||
|
open class BarBean2 : BaseBarBean()
|
||||||
|
|
||||||
|
@Component
|
||||||
|
open class MultipleAutowiredCandidates() {
|
||||||
|
@Autowired
|
||||||
|
lateinit var <caret>bean: BaseBarBean
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
// "Add qualifier" "true"
|
||||||
|
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
|
||||||
|
// CONFIGURE_SPRING_FILE_SET
|
||||||
|
// WITH_RUNTIME
|
||||||
|
// DISABLE-ERRORS
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
|
import org.springframework.stereotype.Component
|
||||||
|
import org.springframework.context.annotation.ComponentScan
|
||||||
|
import org.springframework.context.annotation.Configuration
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@ComponentScan
|
||||||
|
open class InvalidAutowiredByTypeQualifiers
|
||||||
|
|
||||||
|
abstract class BaseBarBean
|
||||||
|
@Component
|
||||||
|
open class BarBean1 : BaseBarBean()
|
||||||
|
@Component
|
||||||
|
open class BarBean2 : BaseBarBean()
|
||||||
|
|
||||||
|
@Component
|
||||||
|
open class MultipleAutowiredCandidates() {
|
||||||
|
@Qualifier("barBean1")
|
||||||
|
@Autowired
|
||||||
|
lateinit var bean: BaseBarBean
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user