From fa614b569caab8650fb6e722cdc3987d7afa5992 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 17 Jul 2013 16:49:34 +0200 Subject: [PATCH] more concise tests --- .../completion/NormalCompletionTest.groovy | 42 ++++++------------- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy index 2cbeed5de413..6997f4f10aab 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy @@ -192,41 +192,25 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { public void testReferenceParameters() throws Exception { configureByFile("ReferenceParameters.java"); assertNotNull(myItems); - assertEquals(myItems.length, 2); - assertEquals(myItems[0].getLookupString(), "AAAA"); - assertEquals(myItems[1].getLookupString(), "AAAB"); + assert myFixture.lookupElementStrings == ['AAAA', 'AAAB'] + } + + @Override + protected void tearDown() throws Exception { + CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION = true + super.tearDown() } public void testConstructorName1() throws Exception{ - final CodeInsightSettings settings = CodeInsightSettings.getInstance(); - final boolean autocomplete_on_code_completion = settings.AUTOCOMPLETE_ON_CODE_COMPLETION; - settings.AUTOCOMPLETE_ON_CODE_COMPLETION = false; - configureByFile("ConstructorName1.java"); - assertNotNull(myItems); - boolean failed = true; - for (final LookupElement item : myItems) { - if (item.getLookupString().equals("ABCDE")) { - failed = false; - } - } - assertFalse(failed); - settings.AUTOCOMPLETE_ON_CODE_COMPLETION = autocomplete_on_code_completion; + CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION = false + configure(); + assert 'ABCDE' in myFixture.lookupElementStrings } public void testConstructorName2() throws Exception{ - final CodeInsightSettings settings = CodeInsightSettings.getInstance(); - final boolean autocomplete_on_code_completion = settings.AUTOCOMPLETE_ON_CODE_COMPLETION; - settings.AUTOCOMPLETE_ON_CODE_COMPLETION = false; - configureByFile("ConstructorName2.java"); - assertNotNull(myItems); - boolean failed = true; - for (final LookupElement item : myItems) { - if (item.getLookupString().equals("ABCDE")) { - failed = false; - } - } - assertFalse(failed); - settings.AUTOCOMPLETE_ON_CODE_COMPLETION = autocomplete_on_code_completion; + CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION = false + configure(); + assert 'ABCDE' in myFixture.lookupElementStrings } public void testObjectsInThrowsBlock() throws Exception {