Spring Support: Fix tests in IDEA 2017.1
Filter out duplicate reference targets. Fix test data as directory references are available inside of string literals. Fix test data as Spring @Autowired inspection no more reports parameterless methods. Fix gutter checking as configuration bean references now resolve to @ComponentScan annotation
This commit is contained in:
committed by
Dmitry Jemerov
parent
2804264289
commit
2e3617adbb
@@ -49,15 +49,6 @@
|
|||||||
<description>Only one constructor can have @Autowired annotation</description>
|
<description>Only one constructor can have @Autowired annotation</description>
|
||||||
</problem>
|
</problem>
|
||||||
|
|
||||||
<problem>
|
|
||||||
<file>parameterlessFunction.kt</file>
|
|
||||||
<line>15</line>
|
|
||||||
<module>light_idea_test_case</module>
|
|
||||||
<entry_point TYPE="file" FQNAME="temp:///src/parameterlessFunction.kt" />
|
|
||||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Autowiring for Bean Class (Kotlin)</problem_class>
|
|
||||||
<description>Autowired method without parameters</description>
|
|
||||||
</problem>
|
|
||||||
|
|
||||||
<problem>
|
<problem>
|
||||||
<file>invalidAutowiredResource.kt</file>
|
<file>invalidAutowiredResource.kt</file>
|
||||||
<line>24</line>
|
<line>24</line>
|
||||||
|
|||||||
+1
@@ -1,5 +1,6 @@
|
|||||||
// NO_XML_CONFIG
|
// NO_XML_CONFIG
|
||||||
// REF: java
|
// REF: java
|
||||||
|
// REF: java.java
|
||||||
|
|
||||||
import org.springframework.context.annotation.ComponentScan
|
import org.springframework.context.annotation.ComponentScan
|
||||||
import org.springframework.context.annotation.Configuration
|
import org.springframework.context.annotation.Configuration
|
||||||
|
|||||||
+7
-1
@@ -30,7 +30,10 @@ import com.intellij.spring.model.xml.beans.SpringPropertyDefinition
|
|||||||
import com.intellij.testFramework.UsefulTestCase.assertSameElements
|
import com.intellij.testFramework.UsefulTestCase.assertSameElements
|
||||||
import com.intellij.util.containers.ContainerUtil
|
import com.intellij.util.containers.ContainerUtil
|
||||||
import com.intellij.util.xml.DomUtil
|
import com.intellij.util.xml.DomUtil
|
||||||
|
import org.jetbrains.kotlin.asJava.elements.KtLightAnnotation
|
||||||
import org.jetbrains.kotlin.idea.completion.test.assertInstanceOf
|
import org.jetbrains.kotlin.idea.completion.test.assertInstanceOf
|
||||||
|
import org.jetbrains.kotlin.psi.KtModifierListOwner
|
||||||
|
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
||||||
|
|
||||||
private fun nameBean(element: PsiElement): String {
|
private fun nameBean(element: PsiElement): String {
|
||||||
return when (element) {
|
return when (element) {
|
||||||
@@ -43,7 +46,10 @@ private fun nameBean(element: PsiElement): String {
|
|||||||
|
|
||||||
private fun nameProperty(element: PsiElement) = DomUtil.getDomElement(element).assertInstanceOf<SpringPropertyDefinition>().propertyName!!
|
private fun nameProperty(element: PsiElement) = DomUtil.getDomElement(element).assertInstanceOf<SpringPropertyDefinition>().propertyName!!
|
||||||
|
|
||||||
private fun namePsi(element: PsiElement) = SymbolPresentationUtil.getSymbolPresentableText(element)
|
private fun namePsi(element: PsiElement): String {
|
||||||
|
if (element is KtLightAnnotation) return namePsi(element.kotlinOrigin.getStrictParentOfType<KtModifierListOwner>()!!)
|
||||||
|
return SymbolPresentationUtil.getSymbolPresentableText(element)
|
||||||
|
}
|
||||||
|
|
||||||
fun checkBeanGutterTargets(gutterMark: GutterMark, expectedBeanNames: Collection<String>) {
|
fun checkBeanGutterTargets(gutterMark: GutterMark, expectedBeanNames: Collection<String>) {
|
||||||
checkGutterTargets(gutterMark, expectedBeanNames, ::nameBean)
|
checkGutterTargets(gutterMark, expectedBeanNames, ::nameBean)
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ abstract class AbstractSpringReferenceNavigationTest : AbstractNavigationTest()
|
|||||||
override fun getSourceAndTargetElements(editor: Editor, file: PsiFile): GotoTargetHandler.GotoData? {
|
override fun getSourceAndTargetElements(editor: Editor, file: PsiFile): GotoTargetHandler.GotoData? {
|
||||||
val stringTemplate = file.findElementAt(editor.caretModel.offset)!!.getNonStrictParentOfType<KtStringTemplateExpression>()!!
|
val stringTemplate = file.findElementAt(editor.caretModel.offset)!!.getNonStrictParentOfType<KtStringTemplateExpression>()!!
|
||||||
return GotoTargetHandler.GotoData(stringTemplate,
|
return GotoTargetHandler.GotoData(stringTemplate,
|
||||||
stringTemplate.references.mapNotNull { it.resolve() }.toTypedArray(),
|
stringTemplate.references.mapNotNull { it.resolve() }.distinct().toTypedArray(),
|
||||||
emptyList())
|
emptyList())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user