From 589208ff992f8a2348144ef066fe6a5b01ab1227 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 29 Jan 2014 18:16:14 +0100 Subject: [PATCH] test that stats is remembered for global static method completion variants --- .../normalSorting/GlobalStaticMemberStats.java | 12 ++++++++++++ .../smartTypeSorting/GlobalStaticMemberStats.java | 14 ++++++++++++++ .../completion/NormalCompletionOrderingTest.groovy | 8 ++++++++ .../SmartTypeCompletionOrderingTest.groovy | 8 ++++++++ 4 files changed, 42 insertions(+) create mode 100644 java/java-tests/testData/codeInsight/completion/normalSorting/GlobalStaticMemberStats.java create mode 100644 java/java-tests/testData/codeInsight/completion/smartTypeSorting/GlobalStaticMemberStats.java diff --git a/java/java-tests/testData/codeInsight/completion/normalSorting/GlobalStaticMemberStats.java b/java/java-tests/testData/codeInsight/completion/normalSorting/GlobalStaticMemberStats.java new file mode 100644 index 000000000000..06d45b63948b --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/normalSorting/GlobalStaticMemberStats.java @@ -0,0 +1,12 @@ +public class Foo { + + void foo() { + newLi + } +} + +class Bar { + static void newLinkedSet0() {} + static void newLinkedSet1(int a) {} + static void newLinkedSet2(int a, int b) {} +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/completion/smartTypeSorting/GlobalStaticMemberStats.java b/java/java-tests/testData/codeInsight/completion/smartTypeSorting/GlobalStaticMemberStats.java new file mode 100644 index 000000000000..48f2fe993157 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartTypeSorting/GlobalStaticMemberStats.java @@ -0,0 +1,14 @@ +import java.util.Set; + +public class Foo { + + void foo() { + Set s = newLi + } +} + +class Bar { + static Set newLinkedSet0() {} + static Set newLinkedSet1(int a) {} + static Set newLinkedSet2(int a, int b) {} +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy index 46ba9b593c52..5c1683c9eee2 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy @@ -624,4 +624,12 @@ interface TxANotAnno {} checkPreferredItems 0, 'MyEnum.BAR', 'MyEnum', 'MyEnum.FOO' } + public void testGlobalStaticMemberStats() { + configureNoCompletion(getTestName(false) + ".java") + myFixture.complete(CompletionType.BASIC, 2) + assertPreferredItems 0, 'newLinkedSet0', 'newLinkedSet1', 'newLinkedSet2' + incUseCount lookup, 1 + assertPreferredItems 0, 'newLinkedSet1', 'newLinkedSet0', 'newLinkedSet2' + } + } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionOrderingTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionOrderingTest.groovy index e19a3ada2002..24604af0f7d9 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionOrderingTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionOrderingTest.groovy @@ -325,6 +325,14 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase { checkPreferredItems 0, 'toString' } + public void testGlobalStaticMemberStats() { + configureNoCompletion(getTestName(false) + ".java") + myFixture.complete(CompletionType.SMART, 2) + assertPreferredItems 0, 'newLinkedSet0', 'newLinkedSet1', 'newLinkedSet2' + incUseCount lookup, 1 + assertPreferredItems 0, 'newLinkedSet1', 'newLinkedSet0', 'newLinkedSet2' + } + @Override protected String getBasePath() { return JavaTestUtil.getRelativeJavaTestDataPath() + BASE_PATH;