mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
[maven] IDEA-356183 MavenParentCompletionAndResolutionTest.testHighlightingAbsentGroupId: check highlighting twice
GitOrigin-RevId: 7795e445bd4458f980c63edfc84a2961d436e07a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1605af64c4
commit
3ea2f70e1e
@@ -508,11 +508,18 @@ class MavenParentCompletionAndResolutionTest : MavenDomWithIndicesTestCase() {
|
||||
</parent>
|
||||
""".trimIndent())
|
||||
importProjectAsync()
|
||||
checkHighlighting(projectPom,
|
||||
Highlight(text="parent", description = "'groupId' child tag should be defined"),
|
||||
Highlight(text="junit"),
|
||||
Highlight(text="4.0"),
|
||||
|
||||
val expectedHighlights = arrayOf(
|
||||
Highlight(text = "parent", description = "'groupId' child tag should be defined"),
|
||||
Highlight(text = "junit"),
|
||||
Highlight(text = "4.0"),
|
||||
)
|
||||
|
||||
val highlights1 = doHighlighting(projectPom)
|
||||
val highlights2 = doHighlighting(projectPom)
|
||||
|
||||
assertHighlighting(highlights1, *expectedHighlights)
|
||||
assertHighlighting(highlights2, *expectedHighlights)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -566,19 +566,23 @@ abstract class MavenDomTestCase : MavenMultiVersionImportingTestCase() {
|
||||
}
|
||||
|
||||
protected suspend fun checkHighlighting(file: VirtualFile, vararg expectedHighlights: Highlight) {
|
||||
withContext(Dispatchers.EDT) {
|
||||
assertHighlighting(doHighlighting(file), *expectedHighlights)
|
||||
}
|
||||
|
||||
protected suspend fun doHighlighting(file: VirtualFile): Collection<HighlightInfo> {
|
||||
return withContext(Dispatchers.EDT) {
|
||||
refreshFiles(listOf(file))
|
||||
val content = String(file.contentsToByteArray())
|
||||
MavenLog.LOG.debug("Checking highlighting in file $file:\n$content")
|
||||
MavenLog.LOG.warn("Checking highlighting in file $file:\n$content")
|
||||
fixture.openFileInEditor(file)
|
||||
MavenLog.LOG.debug("Text in editor: ${fixture.editor.document.text}")
|
||||
MavenLog.LOG.warn("Text in editor: ${fixture.editor.document.text}")
|
||||
val highlightingInfos = fixture.doHighlighting()
|
||||
MavenLog.LOG.debug("Highlighting results: ${highlightingInfos.joinToString { "\n${it.severity} ${it.description} (${it.startOffset}, ${it.endOffset})" }}")
|
||||
assertHighlighting(highlightingInfos, *expectedHighlights)
|
||||
MavenLog.LOG.warn("Highlighting results: ${highlightingInfos.joinToString { "\n${it.severity} ${it.description} (${it.startOffset}, ${it.endOffset})" }}")
|
||||
highlightingInfos
|
||||
}
|
||||
}
|
||||
|
||||
private fun assertHighlighting(highlightingInfos: Collection<HighlightInfo>, vararg expectedHighlights: Highlight) {
|
||||
protected fun assertHighlighting(highlightingInfos: Collection<HighlightInfo>, vararg expectedHighlights: Highlight) {
|
||||
expectedHighlights.forEach { assertHighlighting(highlightingInfos, it) }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user