mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[maven] encapsulate CodeInsightTestFixture in MavenDomTestCase
GitOrigin-RevId: 8907aa2a62d66bb33b155b2444557c350a2e6b44
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b1814d0a22
commit
2d4a66fd5d
+10
-10
@@ -30,7 +30,7 @@ import org.junit.Test
|
||||
class AddMavenDependencyQuickFixTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
private fun findAddMavenIntention(): IntentionAction {
|
||||
for (intention in myFixture.getAvailableIntentions()) {
|
||||
for (intention in fixture.getAvailableIntentions()) {
|
||||
if (intention.getText().contains("Add Maven")) {
|
||||
return intention
|
||||
}
|
||||
@@ -59,7 +59,7 @@ class AddMavenDependencyQuickFixTest : MavenDomWithIndicesTestCase() {
|
||||
<version>1</version>
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(f)
|
||||
fixture.configureFromExistingVirtualFile(f)
|
||||
|
||||
val intentionAction = findAddMavenIntention()
|
||||
|
||||
@@ -67,7 +67,7 @@ class AddMavenDependencyQuickFixTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
waitForImportWithinTimeout {
|
||||
withContext(Dispatchers.EDT) {
|
||||
intentionAction.invoke(myProject, myFixture.getEditor(), myFixture.getFile())
|
||||
intentionAction.invoke(myProject, fixture.getEditor(), fixture.getFile())
|
||||
}
|
||||
}
|
||||
val pomText = readAction { PsiManager.getInstance(myProject).findFile(myProjectPom)!!.getText() }
|
||||
@@ -96,20 +96,20 @@ class AddMavenDependencyQuickFixTest : MavenDomWithIndicesTestCase() {
|
||||
<version>1</version>
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(f)
|
||||
fixture.configureFromExistingVirtualFile(f)
|
||||
|
||||
val intentionAction = findAddMavenIntention()
|
||||
|
||||
MavenArtifactSearchDialog.ourResultForTest = listOf(MavenId("commons-io", "commons-io", "2.4"))
|
||||
waitForImportWithinTimeout {
|
||||
withContext(Dispatchers.EDT) {
|
||||
intentionAction.invoke(myProject, myFixture.getEditor(), myFixture.getFile())
|
||||
intentionAction.invoke(myProject, fixture.getEditor(), fixture.getFile())
|
||||
}
|
||||
}
|
||||
MavenArtifactSearchDialog.ourResultForTest = listOf(MavenId("commons-io", "commons-io", "2.4"))
|
||||
waitForImportWithinTimeout {
|
||||
withContext(Dispatchers.EDT) {
|
||||
intentionAction.invoke(myProject, myFixture.getEditor(), myFixture.getFile())
|
||||
intentionAction.invoke(myProject, fixture.getEditor(), fixture.getFile())
|
||||
}
|
||||
}
|
||||
val pomText = readAction { PsiManager.getInstance(myProject).findFile(myProjectPom)!!.getText() }
|
||||
@@ -159,14 +159,14 @@ class AddMavenDependencyQuickFixTest : MavenDomWithIndicesTestCase() {
|
||||
</dependencies>
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(f)
|
||||
fixture.configureFromExistingVirtualFile(f)
|
||||
|
||||
val intentionAction = findAddMavenIntention()
|
||||
|
||||
MavenArtifactSearchDialog.ourResultForTest = listOf(MavenId("commons-io", "commons-io", "2.4"))
|
||||
waitForImportWithinTimeout {
|
||||
withContext(Dispatchers.EDT) {
|
||||
intentionAction.invoke(myProject, myFixture.getEditor(), myFixture.getFile())
|
||||
intentionAction.invoke(myProject, fixture.getEditor(), fixture.getFile())
|
||||
}
|
||||
}
|
||||
val pomText = readAction { PsiManager.getInstance(myProject).findFile(myProjectPom)!!.getText() }
|
||||
@@ -207,7 +207,7 @@ class AddMavenDependencyQuickFixTest : MavenDomWithIndicesTestCase() {
|
||||
<version>1</version>
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(f)
|
||||
fixture.configureFromExistingVirtualFile(f)
|
||||
|
||||
val intentionAction = findAddMavenIntention()
|
||||
|
||||
@@ -215,7 +215,7 @@ class AddMavenDependencyQuickFixTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
waitForImportWithinTimeout {
|
||||
withContext(Dispatchers.EDT) {
|
||||
intentionAction.invoke(myProject, myFixture.getEditor(), myFixture.getFile())
|
||||
intentionAction.invoke(myProject, fixture.getEditor(), fixture.getFile())
|
||||
}
|
||||
}
|
||||
val pomText = readAction { PsiManager.getInstance(myProject).findFile(myProjectPom)!!.getText() }
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ class MavenAutomaticVersioningResolutionTest : MavenDomTestCase() {
|
||||
<artifactId>m</artifactId>
|
||||
""".trimIndent())
|
||||
assertResolved(m, findPsiFile(myProjectPom))
|
||||
myFixture.enableInspections(listOf<Class<out LocalInspectionTool?>>(MavenParentMissedVersionInspection::class.java))
|
||||
fixture.enableInspections(listOf<Class<out LocalInspectionTool?>>(MavenParentMissedVersionInspection::class.java))
|
||||
checkHighlighting(m)
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ class MavenAutomaticVersioningResolutionTest : MavenDomTestCase() {
|
||||
</parent>
|
||||
<artifactId>m</artifactId>
|
||||
""".trimIndent())
|
||||
myFixture.enableInspections(listOf<Class<out LocalInspectionTool?>>(MavenParentMissedVersionInspection::class.java))
|
||||
fixture.enableInspections(listOf<Class<out LocalInspectionTool?>>(MavenParentMissedVersionInspection::class.java))
|
||||
checkHighlighting(m)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -713,7 +713,7 @@ $libPath<caret></systemPath>
|
||||
try {
|
||||
// prevent file path from wrapping.
|
||||
xmlSettings.XML_TEXT_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP
|
||||
myFixture.launchAction(action)
|
||||
fixture.launchAction(action)
|
||||
}
|
||||
finally {
|
||||
xmlSettings.XML_TEXT_WRAP = prevValue
|
||||
|
||||
+47
-47
@@ -34,14 +34,14 @@ class MavenDependencySmartCompletionTest : MavenDomWithIndicesTestCase() {
|
||||
""".trimIndent())
|
||||
|
||||
configTest(myProjectPom)
|
||||
val elements = myFixture.completeBasic()
|
||||
assertCompletionVariants(myFixture, RENDERING_TEXT, "junit:junit")
|
||||
val elements = fixture.completeBasic()
|
||||
assertCompletionVariants(fixture, RENDERING_TEXT, "junit:junit")
|
||||
UsefulTestCase.assertSize(1, elements)
|
||||
|
||||
myFixture.type('\n')
|
||||
fixture.type('\n')
|
||||
|
||||
|
||||
myFixture.checkResult(createPomXml("""
|
||||
fixture.checkResult(createPomXml("""
|
||||
<groupId>test</groupId>
|
||||
<artifactId>project</artifactId>
|
||||
<version>1</version>
|
||||
@@ -77,11 +77,11 @@ class MavenDependencySmartCompletionTest : MavenDomWithIndicesTestCase() {
|
||||
""".trimIndent())
|
||||
|
||||
configTest(myProjectPom)
|
||||
myFixture.complete(CompletionType.BASIC)
|
||||
assertCompletionVariants(myFixture, RENDERING_TEXT, "junit:junit")
|
||||
myFixture.type('\n')
|
||||
fixture.complete(CompletionType.BASIC)
|
||||
assertCompletionVariants(fixture, RENDERING_TEXT, "junit:junit")
|
||||
fixture.type('\n')
|
||||
|
||||
myFixture.checkResult(createPomXml("""
|
||||
fixture.checkResult(createPomXml("""
|
||||
<groupId>test</groupId>
|
||||
<artifactId>project</artifactId>
|
||||
<version>1</version>
|
||||
@@ -132,13 +132,13 @@ class MavenDependencySmartCompletionTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
configTest(myProjectPom)
|
||||
|
||||
val elements = myFixture.completeBasic()
|
||||
val elements = fixture.completeBasic()
|
||||
UsefulTestCase.assertSize(1, elements)
|
||||
|
||||
myFixture.type('\n')
|
||||
fixture.type('\n')
|
||||
|
||||
|
||||
myFixture.checkResult(createPomXml("""
|
||||
fixture.checkResult(createPomXml("""
|
||||
<groupId>test</groupId>
|
||||
<artifactId>project</artifactId>
|
||||
<version>1</version>
|
||||
@@ -186,19 +186,19 @@ class MavenDependencySmartCompletionTest : MavenDomWithIndicesTestCase() {
|
||||
</dependencies>
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(myProjectPom)
|
||||
fixture.configureFromExistingVirtualFile(myProjectPom)
|
||||
|
||||
var elements = myFixture.completeBasic()
|
||||
var elements = fixture.completeBasic()
|
||||
assertTrue(elements.size > 0)
|
||||
assertEquals("junit:junit:3.8.1", elements[0].getLookupString())
|
||||
|
||||
myFixture.type('\n')
|
||||
fixture.type('\n')
|
||||
|
||||
elements = myFixture.completeBasic()
|
||||
elements = fixture.completeBasic()
|
||||
UsefulTestCase.assertSize(1, elements)
|
||||
myFixture.type('\n')
|
||||
fixture.type('\n')
|
||||
|
||||
myFixture.checkResult(createPomXml("""
|
||||
fixture.checkResult(createPomXml("""
|
||||
<groupId>test</groupId><artifactId>project</artifactId><version>1</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -211,7 +211,7 @@ class MavenDependencySmartCompletionTest : MavenDomWithIndicesTestCase() {
|
||||
""".trimIndent()))
|
||||
|
||||
assertTrue(
|
||||
myFixture.getLookupElementStrings()!!.containsAll(mutableListOf("3.8.1", "4.0")))
|
||||
fixture.getLookupElementStrings()!!.containsAll(mutableListOf("3.8.1", "4.0")))
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -231,19 +231,19 @@ class MavenDependencySmartCompletionTest : MavenDomWithIndicesTestCase() {
|
||||
</dependencies>
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(myProjectPom)
|
||||
fixture.configureFromExistingVirtualFile(myProjectPom)
|
||||
|
||||
val elements = myFixture.completeBasic()
|
||||
val elements = fixture.completeBasic()
|
||||
|
||||
assertCompletionVariants(myFixture, RENDERING_TEXT, "intellijartifactanother", "intellijartifact")
|
||||
assertCompletionVariants(fixture, RENDERING_TEXT, "intellijartifactanother", "intellijartifact")
|
||||
|
||||
myFixture.type('\n')
|
||||
fixture.type('\n')
|
||||
|
||||
assertCompletionVariants(myFixture, RENDERING_TEXT, "org.intellijgroup")
|
||||
assertCompletionVariants(fixture, RENDERING_TEXT, "org.intellijgroup")
|
||||
|
||||
myFixture.type("\n")
|
||||
fixture.type("\n")
|
||||
|
||||
myFixture.checkResult(createPomXml("""
|
||||
fixture.checkResult(createPomXml("""
|
||||
<groupId>test</groupId><artifactId>project</artifactId><version>1</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -272,13 +272,13 @@ class MavenDependencySmartCompletionTest : MavenDomWithIndicesTestCase() {
|
||||
</dependencies>
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(myProjectPom)
|
||||
val elements = myFixture.completeBasic()
|
||||
fixture.configureFromExistingVirtualFile(myProjectPom)
|
||||
val elements = fixture.completeBasic()
|
||||
UsefulTestCase.assertSize(1, elements)
|
||||
|
||||
myFixture.type('\n')
|
||||
fixture.type('\n')
|
||||
|
||||
assertCompletionVariants(myFixture, RENDERING_TEXT, "org.example")
|
||||
assertCompletionVariants(fixture, RENDERING_TEXT, "org.example")
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -300,21 +300,21 @@ class MavenDependencySmartCompletionTest : MavenDomWithIndicesTestCase() {
|
||||
</dependencyManagement>
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(myProjectPom)
|
||||
fixture.configureFromExistingVirtualFile(myProjectPom)
|
||||
|
||||
val elements = myFixture.completeBasic()
|
||||
val elements = fixture.completeBasic()
|
||||
UsefulTestCase.assertSize(1, elements)
|
||||
myFixture.type('\n')
|
||||
fixture.type('\n')
|
||||
|
||||
assertCompletionVariants(myFixture, RENDERING_TEXT, "org.example")
|
||||
assertCompletionVariants(fixture, RENDERING_TEXT, "org.example")
|
||||
|
||||
myFixture.type('\n')
|
||||
fixture.type('\n')
|
||||
|
||||
assertCompletionVariants(myFixture, RENDERING_TEXT, "1.0", "2.0")
|
||||
assertCompletionVariants(fixture, RENDERING_TEXT, "1.0", "2.0")
|
||||
|
||||
myFixture.type('\n')
|
||||
fixture.type('\n')
|
||||
|
||||
myFixture.checkResult(createPomXml("""
|
||||
fixture.checkResult(createPomXml("""
|
||||
<groupId>test</groupId><artifactId>project</artifactId><version>1</version>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
@@ -361,17 +361,17 @@ class MavenDependencySmartCompletionTest : MavenDomWithIndicesTestCase() {
|
||||
</dependencies>
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(myProjectPom)
|
||||
fixture.configureFromExistingVirtualFile(myProjectPom)
|
||||
|
||||
var elements = myFixture.completeBasic()
|
||||
var elements = fixture.completeBasic()
|
||||
UsefulTestCase.assertSize(1, elements!!)
|
||||
myFixture.type('\n')
|
||||
fixture.type('\n')
|
||||
|
||||
elements = myFixture.completeBasic()
|
||||
elements = fixture.completeBasic()
|
||||
UsefulTestCase.assertSize(1, elements)
|
||||
myFixture.type('\n')
|
||||
fixture.type('\n')
|
||||
|
||||
myFixture.checkResult(createPomXml("""
|
||||
fixture.checkResult(createPomXml("""
|
||||
<groupId>test</groupId><artifactId>project</artifactId><version>1</version>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
@@ -432,13 +432,13 @@ class MavenDependencySmartCompletionTest : MavenDomWithIndicesTestCase() {
|
||||
</dependencies>
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(myProjectPom)
|
||||
fixture.configureFromExistingVirtualFile(myProjectPom)
|
||||
|
||||
val elements = myFixture.complete(CompletionType.BASIC)
|
||||
val elements = fixture.complete(CompletionType.BASIC)
|
||||
UsefulTestCase.assertSize(1, elements)
|
||||
myFixture.type('\n')
|
||||
fixture.type('\n')
|
||||
|
||||
myFixture.checkResult(createPomXml("""
|
||||
fixture.checkResult(createPomXml("""
|
||||
<groupId>test</groupId><artifactId>project</artifactId><version>1</version>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
@@ -166,10 +166,10 @@ class MavenDomAnnotatorTest : MavenDomTestCase() {
|
||||
|
||||
private fun checkGutters(virtualFile: VirtualFile, expectedProperties: Collection<String>) {
|
||||
val file = PsiManager.getInstance(myProject).findFile(virtualFile)!!
|
||||
myFixture.configureFromExistingVirtualFile(virtualFile)
|
||||
fixture.configureFromExistingVirtualFile(virtualFile)
|
||||
|
||||
val text = file.text
|
||||
val actualProperties = myFixture.doHighlighting()
|
||||
val actualProperties = fixture.doHighlighting()
|
||||
.filter { it.gutterIconRenderer != null }
|
||||
.map { text.substring(it.getStartOffset(), it.getEndOffset()) }
|
||||
.map { it.replace(" ", "") }
|
||||
|
||||
+2
-2
@@ -45,10 +45,10 @@ class MavenDomPathWithPropertyTest : MavenDomTestCase() {
|
||||
val dir = createProjectSubDir("aaa/bbb/res")
|
||||
|
||||
val bbb = dir.getParent()
|
||||
myFixture.renameElement(PsiManager.getInstance(myFixture.getProject()).findDirectory(bbb)!!, "Z")
|
||||
fixture.renameElement(PsiManager.getInstance(fixture.getProject()).findDirectory(bbb)!!, "Z")
|
||||
|
||||
|
||||
val text = PsiManager.getInstance(myFixture.getProject()).findFile(myProjectPom)!!.getText()
|
||||
val text = PsiManager.getInstance(fixture.getProject()).findFile(myProjectPom)!!.getText()
|
||||
assert(text.contains("<directory>aaa/Z/res</directory>"))
|
||||
assert(text.contains("<directory>aaa/Z/res</directory>"))
|
||||
assert(text.contains("<directory>aaa/Z/res</directory>"))
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ class MavenDomSoftReferencesInParentTest : MavenDomTestCase() {
|
||||
}
|
||||
|
||||
private suspend fun getDocument(f: VirtualFile): Document {
|
||||
return readAction { myFixture.getDocument(findPsiFile(f)!!) }
|
||||
return readAction { fixture.getDocument(findPsiFile(f)!!) }
|
||||
}
|
||||
|
||||
private suspend fun checkHighlightingEdt() {
|
||||
|
||||
+3
-3
@@ -514,7 +514,7 @@ class MavenFilteredPropertiesCompletionAndResolutionTest : MavenDomWithIndicesTe
|
||||
val f = createProjectSubFile("res/foo.properties",
|
||||
"foo=abc\${x<caret>xx}abc")
|
||||
assertResolved(f, findPropertyPsiElement(filter, "xxx")!!)
|
||||
myFixture.configureFromExistingVirtualFile(filter)
|
||||
fixture.configureFromExistingVirtualFile(filter)
|
||||
doInlineRename(f, "bar")
|
||||
|
||||
assertEquals("foo=abc\${bar}abc", findPsiFile(f).getText())
|
||||
@@ -676,9 +676,9 @@ class MavenFilteredPropertiesCompletionAndResolutionTest : MavenDomWithIndicesTe
|
||||
</root>
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(f)
|
||||
fixture.configureFromExistingVirtualFile(f)
|
||||
|
||||
val attribute = PsiTreeUtil.getParentOfType(myFixture.getFile().findElementAt(myFixture.getCaretOffset()), XmlAttribute::class.java)
|
||||
val attribute = PsiTreeUtil.getParentOfType(fixture.getFile().findElementAt(fixture.getCaretOffset()), XmlAttribute::class.java)
|
||||
|
||||
val references = attribute!!.getReferences()
|
||||
|
||||
|
||||
+17
-17
@@ -55,7 +55,7 @@ class MavenModelValidationTest : MavenDomWithIndicesTestCase() {
|
||||
""".trimIndent())
|
||||
|
||||
configTest(modulePom)
|
||||
val elementAtCaret = myFixture.getElementAtCaret()
|
||||
val elementAtCaret = fixture.getElementAtCaret()
|
||||
|
||||
UsefulTestCase.assertInstanceOf(elementAtCaret, PsiFile::class.java)
|
||||
assertEquals((elementAtCaret as PsiFile).getVirtualFile(), myProjectPom)
|
||||
@@ -63,7 +63,7 @@ class MavenModelValidationTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
@Test
|
||||
fun testUnderstandingProjectSchemaWithoutNamespace() = runBlocking {
|
||||
myFixture.saveText(myProjectPom,
|
||||
fixture.saveText(myProjectPom,
|
||||
"""
|
||||
<project>
|
||||
<dep<caret>
|
||||
@@ -99,7 +99,7 @@ class MavenModelValidationTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
@Test
|
||||
fun testAbsentModelVersion() = runBlocking {
|
||||
myFixture.saveText(myProjectPom,
|
||||
fixture.saveText(myProjectPom,
|
||||
"""
|
||||
<<error descr="'modelVersion' child tag should be defined">project</error> xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<artifactId>foo</artifactId>
|
||||
@@ -110,7 +110,7 @@ class MavenModelValidationTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
@Test
|
||||
fun testAbsentArtifactId() = runBlocking {
|
||||
myFixture.saveText(myProjectPom,
|
||||
fixture.saveText(myProjectPom,
|
||||
"""
|
||||
<<error descr="'artifactId' child tag should be defined">project</error> xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -121,7 +121,7 @@ class MavenModelValidationTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
@Test
|
||||
fun testUnknownModelVersion() = runBlocking {
|
||||
myFixture.saveText(myProjectPom,
|
||||
fixture.saveText(myProjectPom,
|
||||
"""
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion><error descr="Unsupported model version. Only version 4.0.0 is supported.">666</error></modelVersion>
|
||||
@@ -143,7 +143,7 @@ class MavenModelValidationTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
@Test
|
||||
fun testAddingSettingsXmlReadingProblemsToProjectTag() = runBlocking {
|
||||
myFixture.saveText(myProjectPom,
|
||||
fixture.saveText(myProjectPom,
|
||||
"""
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -156,7 +156,7 @@ class MavenModelValidationTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
readProjects()
|
||||
|
||||
myFixture.saveText(myProjectPom,
|
||||
fixture.saveText(myProjectPom,
|
||||
"""
|
||||
<<error descr="'settings.xml' has syntax errors">project</error>>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -170,7 +170,7 @@ class MavenModelValidationTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
@Test
|
||||
fun testAddingProfilesXmlReadingProblemsToProjectTag() = runBlocking {
|
||||
myFixture.saveText(myProjectPom,
|
||||
fixture.saveText(myProjectPom,
|
||||
"""
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -183,7 +183,7 @@ class MavenModelValidationTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
readProjects()
|
||||
|
||||
myFixture.saveText(myProjectPom,
|
||||
fixture.saveText(myProjectPom,
|
||||
"""
|
||||
<<error descr="'profiles.xml' has syntax errors">project</error>>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -197,7 +197,7 @@ class MavenModelValidationTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
@Test
|
||||
fun testAddingStructureReadingProblemsToParentTag() = runBlocking {
|
||||
myFixture.saveText(myProjectPom,
|
||||
fixture.saveText(myProjectPom,
|
||||
"""
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -214,7 +214,7 @@ class MavenModelValidationTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
readProjects()
|
||||
|
||||
myFixture.saveText(myProjectPom,
|
||||
fixture.saveText(myProjectPom,
|
||||
"""
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -242,7 +242,7 @@ class MavenModelValidationTest : MavenDomWithIndicesTestCase() {
|
||||
<<<
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.saveText(myProjectPom,
|
||||
fixture.saveText(myProjectPom,
|
||||
"""
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -259,7 +259,7 @@ class MavenModelValidationTest : MavenDomWithIndicesTestCase() {
|
||||
""".trimIndent())
|
||||
readProjects()
|
||||
|
||||
myFixture.saveText(myProjectPom,
|
||||
fixture.saveText(myProjectPom,
|
||||
"""
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -279,7 +279,7 @@ class MavenModelValidationTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
@Test
|
||||
fun testDoNotAddReadingSyntaxProblemsToProjectTag() = runBlocking {
|
||||
myFixture.saveText(myProjectPom,
|
||||
fixture.saveText(myProjectPom,
|
||||
"""
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -291,7 +291,7 @@ class MavenModelValidationTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
readProjects()
|
||||
|
||||
myFixture.saveText(myProjectPom,
|
||||
fixture.saveText(myProjectPom,
|
||||
"""
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -305,7 +305,7 @@ class MavenModelValidationTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
@Test
|
||||
fun testDoNotAddDependencyAndModuleProblemsToProjectTag() = runBlocking {
|
||||
myFixture.saveText(myProjectPom,
|
||||
fixture.saveText(myProjectPom,
|
||||
"""
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -328,7 +328,7 @@ class MavenModelValidationTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
readProjects()
|
||||
|
||||
myFixture.saveText(myProjectPom,
|
||||
fixture.saveText(myProjectPom,
|
||||
"""
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
+10
-10
@@ -344,7 +344,7 @@ class MavenModuleCompletionAndResolutionTest : MavenDomWithIndicesTestCase() {
|
||||
val i = getIntentionAtCaret(createModuleIntention)
|
||||
assertNotNull(i)
|
||||
|
||||
myFixture.launchAction(i)
|
||||
fixture.launchAction(i)
|
||||
|
||||
assertCreateModuleFixResult(
|
||||
"subDir/newModule/pom.xml",
|
||||
@@ -387,7 +387,7 @@ class MavenModuleCompletionAndResolutionTest : MavenDomWithIndicesTestCase() {
|
||||
val i = getIntentionAtCaret(createModuleIntention)
|
||||
assertNotNull(i)
|
||||
|
||||
myFixture.launchAction(i)
|
||||
fixture.launchAction(i)
|
||||
|
||||
assertCreateModuleFixResult(
|
||||
"subDir/newModule.xml",
|
||||
@@ -431,7 +431,7 @@ class MavenModuleCompletionAndResolutionTest : MavenDomWithIndicesTestCase() {
|
||||
val i = getIntentionAtCaret(createModuleIntention)
|
||||
assertNotNull(i)
|
||||
|
||||
myFixture.launchAction(i)
|
||||
fixture.launchAction(i)
|
||||
|
||||
assertCreateModuleFixResult(
|
||||
"subDir/newModule.xml/pom.xml",
|
||||
@@ -477,7 +477,7 @@ class MavenModuleCompletionAndResolutionTest : MavenDomWithIndicesTestCase() {
|
||||
val i = getIntentionAtCaret(createModuleIntention)
|
||||
assertNotNull(i)
|
||||
|
||||
myFixture.launchAction(i)
|
||||
fixture.launchAction(i)
|
||||
|
||||
assertCreateModuleFixResult(
|
||||
"newModule/pom.xml",
|
||||
@@ -522,7 +522,7 @@ class MavenModuleCompletionAndResolutionTest : MavenDomWithIndicesTestCase() {
|
||||
val i = getIntentionAtCaret(createModuleIntention)
|
||||
assertNotNull(i)
|
||||
|
||||
myFixture.launchAction(i)
|
||||
fixture.launchAction(i)
|
||||
|
||||
val pom = myProjectRoot.findFileByRelativePath("subDir/newModule/pom.xml")
|
||||
assertNotNull(pom)
|
||||
@@ -548,7 +548,7 @@ class MavenModuleCompletionAndResolutionTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
val i = getIntentionAtCaret(createModuleIntention)
|
||||
assertNotNull(i)
|
||||
myFixture.launchAction(i)
|
||||
fixture.launchAction(i)
|
||||
|
||||
assertCreateModuleFixResult(
|
||||
"newModule/pom.xml",
|
||||
@@ -590,7 +590,7 @@ class MavenModuleCompletionAndResolutionTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
val i = getIntentionAtCaret(createModuleWithParentIntention)
|
||||
assertNotNull(i)
|
||||
myFixture.launchAction(i)
|
||||
fixture.launchAction(i)
|
||||
|
||||
assertCreateModuleFixResult(
|
||||
"newModule/pom.xml",
|
||||
@@ -638,7 +638,7 @@ class MavenModuleCompletionAndResolutionTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
val i = getIntentionAtCaret(createModuleWithParentIntention)
|
||||
assertNotNull(i)
|
||||
myFixture.launchAction(i)
|
||||
fixture.launchAction(i)
|
||||
|
||||
assertCreateModuleFixResult(
|
||||
"ppp/newModule/pom.xml",
|
||||
@@ -677,7 +677,7 @@ class MavenModuleCompletionAndResolutionTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
importProjectAsync(parentPom)
|
||||
|
||||
myFixture.saveText(parentPom, createPomXml(
|
||||
fixture.saveText(parentPom, createPomXml(
|
||||
"""
|
||||
<groupId>test</groupId>
|
||||
<artifactId>project</artifactId>
|
||||
@@ -690,7 +690,7 @@ class MavenModuleCompletionAndResolutionTest : MavenDomWithIndicesTestCase() {
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments()
|
||||
val i = getIntentionAtCaret(parentPom, createModuleWithParentIntention)
|
||||
assertNotNull(i)
|
||||
myFixture.launchAction(i)
|
||||
fixture.launchAction(i)
|
||||
|
||||
assertCreateModuleFixResult(
|
||||
"ppp/newModule/pom.xml",
|
||||
|
||||
+5
-5
@@ -248,7 +248,7 @@ class MavenParentCompletionAndResolutionTest : MavenDomWithIndicesTestCase() {
|
||||
</parent>
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.enableInspections(MavenRedundantGroupIdInspection::class.java)
|
||||
fixture.enableInspections(MavenRedundantGroupIdInspection::class.java)
|
||||
checkHighlighting()
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ class MavenParentCompletionAndResolutionTest : MavenDomWithIndicesTestCase() {
|
||||
<artifactId>m1</artifactId>
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.enableInspections(listOf<Class<out LocalInspectionTool?>>(MavenPropertyInParentInspection::class.java))
|
||||
fixture.enableInspections(listOf<Class<out LocalInspectionTool?>>(MavenPropertyInParentInspection::class.java))
|
||||
checkHighlighting(m2)
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ class MavenParentCompletionAndResolutionTest : MavenDomWithIndicesTestCase() {
|
||||
<artifactId>m1</artifactId>
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.enableInspections(listOf<Class<out LocalInspectionTool?>>(MavenPropertyInParentInspection::class.java))
|
||||
fixture.enableInspections(listOf<Class<out LocalInspectionTool?>>(MavenPropertyInParentInspection::class.java))
|
||||
checkHighlighting(m2)
|
||||
}
|
||||
|
||||
@@ -504,7 +504,7 @@ class MavenParentCompletionAndResolutionTest : MavenDomWithIndicesTestCase() {
|
||||
""".trimIndent())
|
||||
importProjectWithErrors()
|
||||
|
||||
myFixture.enableInspections(MavenParentMissedVersionInspection::class.java)
|
||||
fixture.enableInspections(MavenParentMissedVersionInspection::class.java)
|
||||
checkHighlighting()
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ class MavenParentCompletionAndResolutionTest : MavenDomWithIndicesTestCase() {
|
||||
val i = getIntentionAtCaret("Fix Relative Path")
|
||||
assertNotNull(i)
|
||||
|
||||
myFixture.launchAction(i)
|
||||
fixture.launchAction(i)
|
||||
val el = getElementAtCaret(myProjectPom)
|
||||
|
||||
assertEquals("bar/pom.xml", ElementManipulators.getValueText(el))
|
||||
|
||||
+5
-5
@@ -756,9 +756,9 @@ class MavenPropertyCompletionAndResolutionTest : MavenDomTestCase() {
|
||||
</profiles>
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(profiles)
|
||||
myFixture.complete(CompletionType.BASIC)
|
||||
val strings = myFixture.getLookupElementStrings()!!
|
||||
fixture.configureFromExistingVirtualFile(profiles)
|
||||
fixture.complete(CompletionType.BASIC)
|
||||
val strings = fixture.getLookupElementStrings()!!
|
||||
|
||||
assert(strings.containsAll(mutableListOf("foo", "bar")))
|
||||
assert(!strings.contains("xxx"))
|
||||
@@ -778,9 +778,9 @@ class MavenPropertyCompletionAndResolutionTest : MavenDomTestCase() {
|
||||
</profiles>
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(profiles)
|
||||
fixture.configureFromExistingVirtualFile(profiles)
|
||||
readAction {
|
||||
val elementAtCaret = myFixture.getElementAtCaret()
|
||||
val elementAtCaret = fixture.getElementAtCaret()
|
||||
assert(elementAtCaret is XmlTag)
|
||||
assertEquals("foo", (elementAtCaret as XmlTag).getName())
|
||||
}
|
||||
|
||||
+4
-4
@@ -40,8 +40,8 @@ $relativePathUnixSeparator<caret></relativePath>
|
||||
</parent>"""
|
||||
)
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(pom)
|
||||
val resolved = myFixture.getElementAtCaret()
|
||||
fixture.configureFromExistingVirtualFile(pom)
|
||||
val resolved = fixture.getElementAtCaret()
|
||||
assertTrue(resolved is XmlFileImpl)
|
||||
val f = LocalFileSystem.getInstance().refreshAndFindFileByPath(file.path)
|
||||
val parentPsi = findPsiFile(f)
|
||||
@@ -72,8 +72,8 @@ $relativePathUnixSeparator<caret></relativePath>
|
||||
</parent>"""
|
||||
)
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(pom)
|
||||
val resolved = myFixture.getElementAtCaret()
|
||||
fixture.configureFromExistingVirtualFile(pom)
|
||||
val resolved = fixture.getElementAtCaret()
|
||||
assertTrue(resolved is XmlFileImpl)
|
||||
val f = LocalFileSystem.getInstance().refreshAndFindFileByPath(file.path)
|
||||
val parentPsi = findPsiFile(f)
|
||||
|
||||
@@ -25,7 +25,7 @@ class MavenSpellcheckerTest : MavenDomTestCase() {
|
||||
|
||||
@Test
|
||||
fun testSpell() = runBlocking {
|
||||
myFixture.enableInspections(SpellCheckingInspection::class.java)
|
||||
fixture.enableInspections(SpellCheckingInspection::class.java)
|
||||
|
||||
createProjectPom("""
|
||||
<groupId>test</groupId>
|
||||
|
||||
+9
-9
@@ -32,9 +32,9 @@ class MavenSuperNavigationTest : MavenDomTestCase() {
|
||||
</dependencies>
|
||||
""".trimIndent())
|
||||
|
||||
myFixture.performEditorAction("GotoSuperMethod")
|
||||
fixture.performEditorAction("GotoSuperMethod")
|
||||
|
||||
myFixture.checkResultWithInlays(
|
||||
fixture.checkResultWithInlays(
|
||||
createPomXml(
|
||||
"""
|
||||
<groupId>test</groupId>
|
||||
@@ -84,9 +84,9 @@ class MavenSuperNavigationTest : MavenDomTestCase() {
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
myFixture.performEditorAction("GotoSuperMethod")
|
||||
fixture.performEditorAction("GotoSuperMethod")
|
||||
|
||||
myFixture.checkResultWithInlays(
|
||||
fixture.checkResultWithInlays(
|
||||
createPomXml(
|
||||
"""
|
||||
<groupId>test</groupId>
|
||||
@@ -137,7 +137,7 @@ class MavenSuperNavigationTest : MavenDomTestCase() {
|
||||
""".trimIndent())
|
||||
|
||||
configTest(m1)
|
||||
myFixture.performEditorAction("GotoSuperMethod")
|
||||
fixture.performEditorAction("GotoSuperMethod")
|
||||
|
||||
val offset = getEditorOffset(parent)
|
||||
assertEquals(0, offset)
|
||||
@@ -184,10 +184,10 @@ class MavenSuperNavigationTest : MavenDomTestCase() {
|
||||
)
|
||||
|
||||
configTest(m1)
|
||||
myFixture.performEditorAction("GotoSuperMethod")
|
||||
fixture.performEditorAction("GotoSuperMethod")
|
||||
|
||||
configTest(parent)
|
||||
myFixture.checkResultWithInlays(
|
||||
fixture.checkResultWithInlays(
|
||||
createPomXml(
|
||||
"""
|
||||
<groupId>test</groupId>
|
||||
@@ -255,10 +255,10 @@ class MavenSuperNavigationTest : MavenDomTestCase() {
|
||||
)
|
||||
|
||||
configTest(m1)
|
||||
myFixture.performEditorAction("GotoSuperMethod")
|
||||
fixture.performEditorAction("GotoSuperMethod")
|
||||
|
||||
configTest(parent)
|
||||
myFixture.checkResultWithInlays(
|
||||
fixture.checkResultWithInlays(
|
||||
createPomXml(
|
||||
"""
|
||||
<groupId>test</groupId>
|
||||
|
||||
@@ -307,7 +307,7 @@ class MavenTypingTest : MavenDomTestCase() {
|
||||
|
||||
private fun assertTypeResultInRegularFile(f: VirtualFile, c: Char, expected: String) {
|
||||
type(f, c)
|
||||
myFixture.checkResult(expected)
|
||||
fixture.checkResult(expected)
|
||||
}
|
||||
|
||||
private fun assertBackspaceResult(xml: String) {
|
||||
|
||||
+6
-6
@@ -9,7 +9,7 @@ class MavenDuplicatedDependencyInspectionTest : MavenDomWithIndicesTestCase() {
|
||||
override fun runInDispatchThread() = true
|
||||
@Test
|
||||
fun testDuplicatedInSameFile() = runBlocking {
|
||||
myFixture.enableInspections(MavenDuplicateDependenciesInspection::class.java)
|
||||
fixture.enableInspections(MavenDuplicateDependenciesInspection::class.java)
|
||||
|
||||
createProjectPom("""
|
||||
<groupId>mavenParent</groupId>
|
||||
@@ -36,7 +36,7 @@ class MavenDuplicatedDependencyInspectionTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
@Test
|
||||
fun testDuplicatedInSameFileDifferentVersion() = runBlocking {
|
||||
myFixture.enableInspections(MavenDuplicateDependenciesInspection::class.java)
|
||||
fixture.enableInspections(MavenDuplicateDependenciesInspection::class.java)
|
||||
|
||||
createProjectPom("""
|
||||
<groupId>mavenParent</groupId>
|
||||
@@ -62,7 +62,7 @@ class MavenDuplicatedDependencyInspectionTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
@Test
|
||||
fun testDuplicatedInParentDifferentScope() = runBlocking {
|
||||
myFixture.enableInspections(MavenDuplicateDependenciesInspection::class.java)
|
||||
fixture.enableInspections(MavenDuplicateDependenciesInspection::class.java)
|
||||
|
||||
createModulePom("child", """
|
||||
<groupId>mavenParent</groupId>
|
||||
@@ -112,7 +112,7 @@ class MavenDuplicatedDependencyInspectionTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
@Test
|
||||
fun testDuplicatedInParentSameScope() = runBlocking {
|
||||
myFixture.enableInspections(MavenDuplicateDependenciesInspection::class.java)
|
||||
fixture.enableInspections(MavenDuplicateDependenciesInspection::class.java)
|
||||
|
||||
createModulePom("child", """
|
||||
<groupId>mavenParent</groupId>
|
||||
@@ -161,7 +161,7 @@ class MavenDuplicatedDependencyInspectionTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
@Test
|
||||
fun testDuplicatedInParentDifferentVersion() = runBlocking {
|
||||
myFixture.enableInspections(MavenDuplicateDependenciesInspection::class.java)
|
||||
fixture.enableInspections(MavenDuplicateDependenciesInspection::class.java)
|
||||
|
||||
createModulePom("child", """
|
||||
<groupId>mavenParent</groupId>
|
||||
@@ -207,7 +207,7 @@ class MavenDuplicatedDependencyInspectionTest : MavenDomWithIndicesTestCase() {
|
||||
|
||||
@Test
|
||||
fun testDuplicatedInManagedDependencies() = runBlocking {
|
||||
myFixture.enableInspections(MavenDuplicateDependenciesInspection::class.java)
|
||||
fixture.enableInspections(MavenDuplicateDependenciesInspection::class.java)
|
||||
|
||||
createProjectPom("""
|
||||
<groupId>mavenParent</groupId>
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ public class MavenDuplicatedPluginInspectionTest extends MavenDomTestCase {
|
||||
|
||||
@Test
|
||||
public void testDuplicatedPlugin() {
|
||||
myFixture.enableInspections(MavenDuplicatePluginInspection.class);
|
||||
getFixture().enableInspections(MavenDuplicatePluginInspection.class);
|
||||
|
||||
createProjectPom("""
|
||||
<groupId>mavenParent</groupId>
|
||||
|
||||
+6
-6
@@ -17,7 +17,7 @@ public class MavenRedundantGroupIdTest extends MavenDomTestCase {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
myFixture.enableInspections(MavenRedundantGroupIdInspection.class);
|
||||
getFixture().enableInspections(MavenRedundantGroupIdInspection.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -75,12 +75,12 @@ public class MavenRedundantGroupIdTest extends MavenDomTestCase {
|
||||
<version>1.0</version>
|
||||
</parent>""");
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(myProjectPom);
|
||||
myFixture.doHighlighting();
|
||||
getFixture().configureFromExistingVirtualFile(myProjectPom);
|
||||
getFixture().doHighlighting();
|
||||
|
||||
for (IntentionAction intention : myFixture.getAvailableIntentions()) {
|
||||
for (IntentionAction intention : getFixture().getAvailableIntentions()) {
|
||||
if (intention.getText().startsWith("Remove ") && intention.getText().contains("<groupId>")) {
|
||||
myFixture.launchAction(intention);
|
||||
getFixture().launchAction(intention);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@ public class MavenRedundantGroupIdTest extends MavenDomTestCase {
|
||||
//doPostponedFormatting(myProject)
|
||||
PostprocessReformattingAspect.getInstance(myProject).doPostponedFormatting();
|
||||
|
||||
myFixture.checkResult(MavenTestCase.createPomXml("""
|
||||
getFixture().checkResult(MavenTestCase.createPomXml("""
|
||||
<artifactId>childA</artifactId>
|
||||
<version>1.0</version>
|
||||
|
||||
|
||||
+3
-3
@@ -94,8 +94,8 @@ class MavenAddDependencyIntentionTest : MavenDomTestCase() {
|
||||
private fun doTest(classText: String, referenceText: String?) {
|
||||
val file = createProjectSubFile("src/main/java/A.java", classText)
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(file)
|
||||
val element = PsiTreeUtil.getParentOfType(myFixture.getFile().findElementAt(myFixture.getCaretOffset()),
|
||||
fixture.configureFromExistingVirtualFile(file)
|
||||
val element = PsiTreeUtil.getParentOfType(fixture.getFile().findElementAt(fixture.getCaretOffset()),
|
||||
PsiJavaCodeReferenceElement::class.java)
|
||||
|
||||
assertNull(element!!.resolve())
|
||||
@@ -103,7 +103,7 @@ class MavenAddDependencyIntentionTest : MavenDomTestCase() {
|
||||
val fix = AddMavenDependencyQuickFix(element)
|
||||
|
||||
if (referenceText == null) {
|
||||
assertFalse(fix.isAvailable(myProject, myFixture.getEditor(), myFixture.getFile()))
|
||||
assertFalse(fix.isAvailable(myProject, fixture.getEditor(), fixture.getFile()))
|
||||
}
|
||||
else {
|
||||
assertEquals(fix.getReferenceText(), referenceText)
|
||||
|
||||
+21
-17
@@ -56,7 +56,7 @@ import java.util.*;
|
||||
import java.util.function.Function;
|
||||
|
||||
public abstract class MavenDomTestCase extends MavenMultiVersionImportingTestCase {
|
||||
protected CodeInsightTestFixture myFixture;
|
||||
private CodeInsightTestFixture fixture;
|
||||
private final Map<VirtualFile, Long> myConfigTimestamps = new HashMap<>();
|
||||
private boolean myOriginalAutoCompletion;
|
||||
|
||||
@@ -72,11 +72,11 @@ public abstract class MavenDomTestCase extends MavenMultiVersionImportingTestCas
|
||||
protected void setUpFixtures() throws Exception {
|
||||
myTestFixture = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(getName()).getFixture();
|
||||
|
||||
myFixture = IdeaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(myTestFixture);
|
||||
myFixture.setUp();
|
||||
((CodeInsightTestFixtureImpl)myFixture).canChangeDocumentDuringHighlighting(true); // org.jetbrains.idea.maven.utils.MavenRehighlighter
|
||||
fixture = IdeaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(myTestFixture);
|
||||
getFixture().setUp();
|
||||
((CodeInsightTestFixtureImpl)getFixture()).canChangeDocumentDuringHighlighting(true); // org.jetbrains.idea.maven.utils.MavenRehighlighter
|
||||
|
||||
myFixture.enableInspections(MavenModelInspection.class);
|
||||
getFixture().enableInspections(MavenModelInspection.class);
|
||||
|
||||
myOriginalAutoCompletion = CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION;
|
||||
CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION = false;
|
||||
@@ -88,10 +88,10 @@ public abstract class MavenDomTestCase extends MavenMultiVersionImportingTestCas
|
||||
CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION = myOriginalAutoCompletion;
|
||||
myConfigTimestamps.clear();
|
||||
|
||||
myFixture.tearDown();
|
||||
getFixture().tearDown();
|
||||
}
|
||||
finally {
|
||||
myFixture = null;
|
||||
fixture = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,14 +109,14 @@ public abstract class MavenDomTestCase extends MavenMultiVersionImportingTestCas
|
||||
MavenLog.LOG.warn("MavenDomTestCase configTest skipped");
|
||||
return;
|
||||
}
|
||||
myFixture.configureFromExistingVirtualFile(f);
|
||||
getFixture().configureFromExistingVirtualFile(f);
|
||||
myConfigTimestamps.put(f, f.getTimeStamp());
|
||||
MavenLog.LOG.warn("MavenDomTestCase configTest performed");
|
||||
}
|
||||
|
||||
protected void type(VirtualFile f, char c) {
|
||||
configTest(f);
|
||||
myFixture.type(c);
|
||||
getFixture().type(c);
|
||||
}
|
||||
|
||||
protected PsiReference getReferenceAtCaret(VirtualFile f) {
|
||||
@@ -142,7 +142,7 @@ public abstract class MavenDomTestCase extends MavenMultiVersionImportingTestCas
|
||||
|
||||
protected Editor getEditor(VirtualFile f) {
|
||||
configTest(f);
|
||||
return myFixture.getEditor();
|
||||
return getFixture().getEditor();
|
||||
}
|
||||
|
||||
protected int getEditorOffset() {
|
||||
@@ -159,7 +159,7 @@ public abstract class MavenDomTestCase extends MavenMultiVersionImportingTestCas
|
||||
|
||||
private PsiFile getTestPsiFile(VirtualFile f) {
|
||||
configTest(f);
|
||||
return myFixture.getFile();
|
||||
return getFixture().getFile();
|
||||
}
|
||||
|
||||
protected XmlTag findTag(String path) {
|
||||
@@ -300,7 +300,7 @@ public abstract class MavenDomTestCase extends MavenMultiVersionImportingTestCas
|
||||
|
||||
protected List<String> getCompletionVariants(VirtualFile f, Function<? super LookupElement, String> lookupElementStringFunction) {
|
||||
configTest(f);
|
||||
LookupElement[] variants = myFixture.completeBasic();
|
||||
LookupElement[] variants = getFixture().completeBasic();
|
||||
|
||||
List<String> result = new ArrayList<>();
|
||||
for (LookupElement each : variants) {
|
||||
@@ -316,7 +316,7 @@ public abstract class MavenDomTestCase extends MavenMultiVersionImportingTestCas
|
||||
protected Set<String> getDependencyCompletionVariants(VirtualFile f,
|
||||
Function<? super MavenRepositoryArtifactInfo, String> lookupElementStringFunction) {
|
||||
configTest(f);
|
||||
LookupElement[] variants = myFixture.completeBasic();
|
||||
LookupElement[] variants = getFixture().completeBasic();
|
||||
|
||||
Set<String> result = new TreeSet<>();
|
||||
for (LookupElement each : variants) {
|
||||
@@ -371,7 +371,7 @@ public abstract class MavenDomTestCase extends MavenMultiVersionImportingTestCas
|
||||
MavenLog.LOG.warn("checkHighlighting: psi file is null");
|
||||
}
|
||||
else {
|
||||
var document = myFixture.getDocument(psiFile);
|
||||
var document = getFixture().getDocument(psiFile);
|
||||
if (null == document) {
|
||||
MavenLog.LOG.warn("checkHighlighting: document is null");
|
||||
}
|
||||
@@ -385,7 +385,7 @@ public abstract class MavenDomTestCase extends MavenMultiVersionImportingTestCas
|
||||
MavenLog.LOG.warn("checkHighlighting: test configured");
|
||||
|
||||
try {
|
||||
myFixture.testHighlighting(true, false, true, f);
|
||||
getFixture().testHighlighting(true, false, true, f);
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
throw new RuntimeException(throwable);
|
||||
@@ -402,7 +402,7 @@ public abstract class MavenDomTestCase extends MavenMultiVersionImportingTestCas
|
||||
protected IntentionAction getIntentionAtCaret(VirtualFile pomFile, String intentionName) {
|
||||
configTest(pomFile);
|
||||
try {
|
||||
List<IntentionAction> intentions = myFixture.getAvailableIntentions();
|
||||
List<IntentionAction> intentions = getFixture().getAvailableIntentions();
|
||||
|
||||
return CodeInsightTestUtil.findIntentionByText(intentions, intentionName);
|
||||
}
|
||||
@@ -429,7 +429,7 @@ public abstract class MavenDomTestCase extends MavenMultiVersionImportingTestCas
|
||||
final RenameHandler renameHandler = RenameHandlerRegistry.getInstance().getRenameHandler(context);
|
||||
assertNotNull(renameHandler);
|
||||
assertInstanceOf(renameHandler, VariableInplaceRenameHandler.class);
|
||||
CodeInsightTestUtil.doInlineRename((VariableInplaceRenameHandler)renameHandler, value, myFixture);
|
||||
CodeInsightTestUtil.doInlineRename((VariableInplaceRenameHandler)renameHandler, value, getFixture());
|
||||
}
|
||||
|
||||
protected void assertCannotRename() {
|
||||
@@ -500,6 +500,10 @@ public abstract class MavenDomTestCase extends MavenMultiVersionImportingTestCas
|
||||
assertUnorderedElementsAreEqual(actual, expected);
|
||||
}
|
||||
|
||||
protected @NotNull CodeInsightTestFixture getFixture() {
|
||||
return fixture;
|
||||
}
|
||||
|
||||
protected static class HighlightPointer {
|
||||
public PsiElement element;
|
||||
public String text;
|
||||
|
||||
Reference in New Issue
Block a user