From a9d6e08ff50080144c07e52bb7b8576fd2b58740 Mon Sep 17 00:00:00 2001 From: Louis Vignier Date: Mon, 2 Nov 2020 11:04:10 +0100 Subject: [PATCH] [structuralsearch] Update TemplatesCompletionTest.kt - Using typeText instead of tailText - Not testing same name templates anymore GitOrigin-RevId: 1417be42839b1628b6027b2110d3d15b7edb0f1b --- .../plugin/ui/TemplatesCompletionTest.kt | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/platform/structuralsearch/testSource/com/intellij/structuralsearch/plugin/ui/TemplatesCompletionTest.kt b/platform/structuralsearch/testSource/com/intellij/structuralsearch/plugin/ui/TemplatesCompletionTest.kt index 49ec91cbe1d3..ae41698fcdd8 100644 --- a/platform/structuralsearch/testSource/com/intellij/structuralsearch/plugin/ui/TemplatesCompletionTest.kt +++ b/platform/structuralsearch/testSource/com/intellij/structuralsearch/plugin/ui/TemplatesCompletionTest.kt @@ -1,10 +1,10 @@ // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.structuralsearch.plugin.ui -import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase -import com.intellij.ide.highlighter.JavaFileType import com.intellij.codeInsight.lookup.LookupElementPresentation +import com.intellij.ide.highlighter.JavaFileType import com.intellij.structuralsearch.PredefinedConfigurationUtil +import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase class TemplatesCompletionTest : LightJavaCodeInsightFixtureTestCase() { @@ -13,21 +13,20 @@ class TemplatesCompletionTest : LightJavaCodeInsightFixtureTestCase() { myFixture.editor.putUserData(StructuralSearchDialog.TEST_STRUCTURAL_SEARCH_DIALOG, true) } - fun renderedLookupElementTexts(): Collection { - return myFixture.completeBasic() + private val renderedLookupElementTexts: Collection> + get() = myFixture.completeBasic() .map { LookupElementPresentation.renderElement(it) } - .map { it.itemText + it.tailText } - } + .map { "${it.itemText}" to "${it.typeText}" } - fun testSameName() { + fun testCompletion() { prepare("all fields of") - val customTemplate = PredefinedConfigurationUtil.createSearchTemplateInfo("all fields of a class", "", - "", JavaFileType.INSTANCE) + val customTemplate = PredefinedConfigurationUtil.createConfiguration("all fields of a class bis", "", + "", "", JavaFileType.INSTANCE) customTemplate.isPredefined = false ConfigurationManager.getInstance(project).addConfiguration(customTemplate) - val elements = renderedLookupElementTexts() - assert("all fields of a class(java search template)" in elements) - assert("all fields of a class(java search template, user defined)" in elements) + val elements = renderedLookupElementTexts + assert("All fields of a class" to "Java search template" in elements) // Predefined legacy Java configuration + assert("all fields of a class bis" to "Java search template, user defined" in elements) // Newly created configuration } } \ No newline at end of file