From abf97d879088bc32b50f86be08fc02c2632ca0c3 Mon Sep 17 00:00:00 2001 From: Daniil Ovchinnikov Date: Tue, 30 Aug 2016 13:56:44 +0300 Subject: [PATCH] cleanup: remove unnecessary 'public' --- .../CopyReferenceActionFilesTest.groovy | 14 +- .../codeInsight/DuplicateActionTest.groovy | 14 +- .../GenerateGetterSetterTest.groovy | 20 +- .../codeInsight/JavaDocumentationTest.groovy | 20 +- .../MakeInferredAnnotationExplicitTest.groovy | 8 +- .../MultipleModuleHighlightingTest.groovy | 8 +- .../NonSourceInspectionTest.groovy | 6 +- .../codeInsight/OverrideImplementTest.groovy | 30 +- .../CustomFileTypeInspectionTest.groovy | 6 +- .../completion/FragmentCompletionTest.groovy | 28 +- .../GlobalMemberNameCompletionTest.groovy | 41 +- .../completion/HeavyCompletionTest.groovy | 41 +- .../completion/HippieCompletionTest.groovy | 35 +- .../completion/JavaAutoPopupTest.groovy | 222 +++--- .../completion/JavadocCompletionTest.groovy | 134 ++-- .../MagicConstantCompletionTest.groovy | 10 +- .../completion/Normal17CompletionTest.groovy | 32 +- .../completion/Normal8CompletionTest.groovy | 50 +- .../completion/NormalCompletionDfaTest.groovy | 7 +- .../NormalCompletionOrderingTest.groovy | 230 +++--- .../completion/NormalCompletionTest.groovy | 734 ++++++++++-------- .../completion/SeemsScrambledTest.groovy | 10 +- .../SmartTypeCompletionOrderingTest.groovy | 162 ++-- .../completion/VariablesCompletionTest.groovy | 94 ++- .../daemon/RehighlightingTest.groovy | 4 +- .../CreateConstantFieldFromUsageTest.groovy | 27 +- .../quickFix/CreateMethodFromUsageTest.groovy | 16 +- .../ReplaceFromOfNullableFixTest.groovy | 6 +- .../folding/JavaFolding8Test.groovy | 6 +- .../HighlightUsagesHandlerTest.groovy | 40 +- .../intention/AddImportActionHeavyTest.groovy | 2 +- .../intention/AddImportActionTest.groovy | 60 +- .../codeInsight/psi/AnnotatedTypeTest.groovy | 28 +- .../template/LiveTemplateTest.groovy | 152 ++-- .../NamingConventionMacrosTest.groovy | 12 +- .../ContractInferenceFromSourceTest.groovy | 62 +- .../PurityInferenceFromSourceTest.groovy | 30 +- .../intellij/index/ConcurrentIndexTest.groovy | 8 +- .../com/intellij/index/IndexTest.groovy | 52 +- .../navigation/ChooseByNameHddTest.groovy | 6 +- .../navigation/ChooseByNameTest.groovy | 50 +- .../intellij/navigation/GotoActionTest.groovy | 6 +- .../com/intellij/psi/AstLeaksTest.groovy | 10 +- .../com/intellij/psi/JavaStubsTest.groovy | 6 +- .../com/intellij/psi/StubAstSwitchTest.groovy | 20 +- .../JavaRearrangerAnonymousClassesTest.groovy | 6 +- .../JavaRearrangerBlankLinesTest.groovy | 4 +- .../psi/resolve/FileLocalResolverTest.groovy | 60 +- .../psi/resolve/ResolveInLibrariesTest.groovy | 18 +- .../InplaceRenameInvariantTest.groovy | 16 +- .../refactoring/RenameDirectoryTest.groovy | 6 +- .../refactoring/RenameSuggestionsTest.groovy | 18 +- .../run/JavaPathMacroCollectorTest.groovy | 6 +- .../unscramble/NormalizeTextTest.groovy | 34 +- .../unscramble/ThreadDumpParserTest.groovy | 4 +- .../ChangeClassParametersTest.groovy | 4 +- .../org/jetbrains/jps/gant/JpsGantTool.groovy | 4 +- .../project/ExternalProjectServiceTest.groovy | 2 +- .../test/AbstractExternalSystemTest.groovy | 6 +- .../application/TransactionTest.groovy | 48 +- .../custom/CustomFileTypeLexerTest.groovy | 44 +- .../intellij/notification/EventLogTest.groovy | 20 +- .../editor/actions/BlockSelectionTest.groovy | 8 +- .../com/intellij/util/IntSLRUCacheTest.groovy | 12 +- .../fixtures/CompletionAutoPopupTester.groovy | 4 +- .../openapi/util/RecursionManagerTest.groovy | 24 +- .../IgnoreResultOfCallInspectionTest.groovy | 35 +- .../codeInsight/PluginXmlAutoPopupTest.groovy | 6 +- .../PluginXmlFunctionalTest.groovy | 84 +- .../inspection/ToStringGeneratingTest.groovy | 4 +- .../config/GradleConfigurableTest.groovy | 17 +- .../tooling/builder/CopySpecWalker.groovy | 4 +- .../builder/EarModelBuilderImpl.groovy | 8 +- .../builder/ExternalProjectBuilderImpl.groovy | 6 +- .../builder/ScalaModelBuilderImpl.groovy | 10 +- .../builder/WarModelBuilderImpl.groovy | 10 +- .../groovy/dsl/psi/PsiMethodCategory.groovy | 4 +- .../groovy/dsl/toplevel/Context.groovy | 2 +- .../plugins/groovy/GroovyActionsTest.groovy | 41 +- .../plugins/groovy/GroovyCopyPasteTest.groovy | 20 +- .../groovy/GroovyDocumentationTest.groovy | 6 +- .../GroovyGoToTypeDeclarationTest.groovy | 6 +- .../GroovyLightProjectDescriptor.groovy | 2 +- .../plugins/groovy/LightGroovyTestCase.groovy | 4 +- .../plugins/groovy/ReachingDefsTest.groovy | 47 +- .../builder/XmlMarkupBuilderTest.groovy | 8 +- ...nnecessaryDefModifierInspectionTest.groovy | 2 +- ...cessaryPublicModifierInspectionTest.groovy | 2 +- .../compiler/GroovyCompilerTestCase.groovy | 4 +- .../groovy/compiler/GroovyDebuggerTest.groovy | 30 +- .../GrCompletionWithLibraryTest.groovy | 80 +- .../completion/GroovyAutoPopupTest.groovy | 50 +- .../GroovyClassNameCompletionTest.groovy | 56 +- .../completion/GroovyCompletionTest.groovy | 314 ++++---- .../GroovyCompletionTestBase.groovy | 16 +- .../GroovySmartCompletionTest.groovy | 57 +- .../completion/InjectedGroovyTest.groovy | 12 +- .../completion/KeywordCompletionTest.groovy | 4 +- .../plugins/groovy/dsl/DsldTest.groovy | 36 +- .../plugins/groovy/dsl/GroovyDslTest.groovy | 38 +- .../dsl/GroovyTransformationsTest.groovy | 24 +- .../gant/GantReferenceCompletionTest.groovy | 34 +- .../groovy/gant/StandaloneGantTest.groovy | 14 +- .../geb/AbstractGebLightTestCase.groovy | 4 +- .../groovy/grape/GrabDependenciesTest.groovy | 10 +- .../ide/GroovySourceRootDetectorTest.groovy | 12 +- .../groovy/inspections/CastToTypeTest.groovy | 4 +- .../inspections/GrChangeToOperatorTest.groovy | 2 +- .../GrMethodMayBeStaticTest.groovy | 2 +- .../GroovyValidGroupNameTest.groovy | 4 +- .../AddConstructorMatchingSuperTest.groovy | 4 +- .../intentions/AddReturnTypeFixTest.groovy | 4 +- .../CreateParameterForFieldTest.groovy | 9 +- .../intentions/GrAliasImportTest.groovy | 6 +- .../GrBreakStringOnLineBreaksTest.groovy | 4 +- ...rCreateConstructorMatchingSuperTest.groovy | 4 +- .../GrCreateMissingSwitchBranchesTest.groovy | 4 +- .../intentions/GrIntentionTestCase.groovy | 4 +- .../intentions/GrRedundantElseTest.groovy | 16 +- .../groovy/intentions/GrSortMapTest.groovy | 4 +- .../intentions/GrSplitDeclarationTest.groovy | 4 +- .../GroovyConvertJUnitIntentionTest.groovy | 23 +- .../groovy/intentions/InvertIfTest.groovy | 18 +- .../ReplaceTernaryWithIfElseTest.groovy | 20 +- .../ReplaceifWithTernaryTest.groovy | 8 +- .../SimplifyTernaryOperatorTest.groovy | 16 +- .../groovy/intentions/SplitIfTest.groovy | 6 +- .../eachToFor/EachToForIntentionTest.groovy | 4 +- .../ConvertConcatenationToGstringTest.groovy | 18 +- .../strings/ConvertGStringToStringTest.groovy | 14 +- ...vertMultilineStringToSingleLineTest.groovy | 10 +- .../ConvertStringToMultilineTest.groovy | 4 +- .../groovy/lang/GroovyEditingTest.groovy | 43 +- .../groovy/lang/GroovyFixesTest.groovy | 14 +- .../groovy/lang/GroovyFoldingTest.groovy | 4 +- .../lang/GroovyLiveTemplatesTest.groovy | 20 +- .../groovy/lang/GroovyMapAttributeTest.groovy | 50 +- .../lang/GroovyNamedArgumentTest.groovy | 4 +- .../lang/GroovyRegexFindExpressionTest.groovy | 6 +- .../groovy/lang/GroovySpellcheckerTest.groovy | 8 +- .../lang/GroovyStressPerformanceTest.groovy | 32 +- .../lang/GroovyStructureViewTest.groovy | 16 +- .../groovy/lang/GroovyStubsTest.groovy | 8 +- .../groovy/lang/GroovyUnwrapTest.groovy | 22 +- .../lang/LiteralConstructorUsagesTest.groovy | 4 +- .../groovy/lang/MissingReturnTest.groovy | 64 +- .../TargetAnnotationHighlightingTest.groovy | 8 +- .../generate/GroovyGenerateMembersTest.groovy | 12 +- .../GrAnnotationHighlightingTest.groovy | 6 +- .../lang/controlFlow/ControlFlowTest.groovy | 176 +++-- .../lang/findUsages/FindUsagesTest.groovy | 56 +- .../lang/formatter/EnterActionTest.groovy | 220 ++++-- .../lang/formatter/FormatterTest.groovy | 333 +++++--- .../GroovyCodeStyleFormatterTest.groovy | 78 +- .../formatter/GroovyFormatterTestCase.groovy | 8 +- .../ClashingTraitMethodsTest.groovy | 12 +- .../GrAssignabilityClosureToSamTest.groovy | 4 +- .../highlighting/GrAssignabilityTest.groovy | 92 +-- .../lang/highlighting/GrInspectionTest.groovy | 42 +- .../GrLibrarySourceHighlightingTest.groovy | 4 +- .../GrUnassignedVariableAccessTest.groovy | 18 +- .../GrUncheckedAssignmentOfRawTypeTest.groovy | 14 +- .../lang/highlighting/GrUnusedDefTest.groovy | 38 +- .../Groovy16HighlightingTest.groovy | 18 +- .../GroovyHighlightingTest.groovy | 154 ++-- ...FindOverridingMethodsAndClassesTest.groovy | 24 +- .../GroovyOverrideImplementTest.groovy | 14 +- .../lang/parser/AnnotationsParsingTest.groovy | 45 +- .../lang/parser/CommentsParsingTest.groovy | 21 +- .../lang/parser/ExpressionsParsingTest.groovy | 495 ++++++------ .../lang/parser/GenericsParsingTest.groovy | 42 +- .../lang/parser/GroovyParsingTestCase.groovy | 6 +- .../lang/parser/GroovyReparseTest.groovy | 33 +- .../lang/parser/GroovydocParsingTest.groovy | 105 ++- .../lang/parser/PackagingParsingTest.groovy | 27 +- .../lang/parser/StatementsParsingTest.groovy | 604 +++++++++----- .../lang/parser/TypesParsingTest.groovy | 87 ++- .../groovy/lang/psi/GrClassUtilTest.groovy | 4 +- .../lang/psi/GrStubAstSwitchTest.groovy | 2 +- .../resolve/DelegatesToSupportTest.groovy | 2 +- .../lang/resolve/GrDocResolveTest.groovy | 2 +- .../resolve/GrImportContributorTest.groovy | 2 +- .../GroovyResolveFileWithContextTest.groovy | 4 +- .../lang/resolve/GroovyResolveTestCase.groovy | 2 +- .../resolve/GroovyTraitCoercionTest.groovy | 2 +- .../resolve/JavaToGroovyResolveTest.groovy | 16 +- .../NavigateDelegatedClsMethodsTest.groovy | 6 +- .../lang/resolve/ResolveClassTest.groovy | 78 +- .../lang/resolve/ResolveMethodTest.groovy | 234 +++--- .../lang/resolve/ResolvePropertyTest.groovy | 190 ++--- .../resolve/ResolveWithDelegatesToTest.groovy | 2 +- .../lang/resolve/StaticCheckTest.groovy | 17 +- .../lang/resolve/TypeInference2_3Test.groovy | 4 +- .../lang/resolve/TypeInferenceTest.groovy | 86 +- .../lang/smartEnter/SmartEnterTest.groovy | 64 +- .../SurroundExpressionTest.groovy | 45 +- .../SurroundStatementsTest.groovy | 50 +- .../lang/surroundWith/SurroundTestCase.groovy | 4 +- .../surroundWith/SurrounderOrderTest.groovy | 12 +- .../ChangeSignatureForJavaTest.groovy | 34 +- .../ChangeSignatureTest.groovy | 100 +-- .../SimpleExceptionsGen.groovy | 6 +- .../changeSignature/SimpleParameterGen.groovy | 6 +- .../CodeBlockGenerationTest.groovy | 2 +- .../copy/GroovyCopyClassTest.groovy | 8 +- .../GrEncapsulateFieldsTest.groovy | 32 +- .../extract/method/ExtractMethodTest.groovy | 138 ++-- .../ImplementsExtendsQuickFixTest.groovy | 27 +- .../inline/InlineMethodTest.groovy | 185 +++-- .../inline/InlineVariableTest.groovy | 88 ++- .../introduce/IntroduceConstantTest.groovy | 36 +- .../field/GrIntroduceFieldTest.groovy | 40 +- .../ExtractClosureTest.groovy | 4 +- .../GrIntroduceParameterInClosureTest.groovy | 32 +- .../GrIntroduceParameterTest.groovy | 79 +- .../IntroduceParameterTest.groovy | 54 +- ...IntroduceParameterObjectForJavaTest.groovy | 4 +- .../IntroduceLocalVariableTest.groovy | 24 +- .../IntroduceVariableTest.groovy | 97 ++- .../StringExtractingTest.groovy | 16 +- .../memberPullUp/GrPullUpTest.groovy | 62 +- .../move/GroovyMoveClassTest.groovy | 46 +- .../move/GroovyMoveClassToInnerTest.groovy | 40 +- .../move/GroovyMoveFileTest.groovy | 6 +- .../move/GroovyMoveMembersTest.groovy | 50 +- .../move/GroovyMoveTestBase.groovy | 4 +- .../GroovyAddImportActionTest.groovy | 6 +- .../OptimizeImportsTest.groovy | 94 ++- .../refactoring/rename/RenameTest.groovy | 60 +- .../SafeDeleteJavaParameterTest.groovy | 4 +- .../plugins/groovy/spock/SpockTest.groovy | 23 +- .../GrBindableSupportTest.groovy | 2 +- .../GrVetoableSupportTest.groovy | 2 +- .../AnnotationProcessorImportingTest.groovy | 14 +- .../dom/MavenCombineChildAttributeTest.groovy | 4 +- .../maven/dom/MavenDomAnnotatorTest.groovy | 17 +- .../dom/MavenDomPathWithPropertyTest.groovy | 4 +- ...ckDependencyInManagementSectionTest.groovy | 4 +- .../dom/MavenPomXmlDocumentationTest.groovy | 4 +- ...avenPropertyInActivationSectionTest.groovy | 4 +- .../importing/EncodingImportingTest.groovy | 6 +- .../importing/MavenAttachedJarTest.groovy | 4 +- .../MavenDontExcludeTargetTest.groovy | 6 +- .../maven/importing/MavenXmlCrcTest.groovy | 19 +- ...nDuplicatedDependencyInspectionTest.groovy | 14 +- ...MavenDuplicatedPluginInspectionTest.groovy | 4 +- .../MavenRedundantGroupIdTest.groovy | 23 +- .../MavenAddDependencyIntentionTest.groovy | 14 +- .../plugins/MavenBuildHelperPluginTest.groovy | 17 +- .../maven/plugins/MavenIdeaPluginTest.groovy | 17 +- .../MavenParameterFixedValueTest.groovy | 17 +- .../groovy/MavenGroovyInjectionTest.groovy | 12 +- ...avenArchetypeResourcesHighlightTest.groovy | 17 +- .../lang/xpath/XPath2CompletionTest.groovy | 8 +- .../codeInsight/XmlXIncludeTest.groovy | 27 +- .../template/XmlLiveTemplateTest.groovy | 12 +- .../xml/arrangement/XmlRearrangerTest.groovy | 16 +- 257 files changed, 5534 insertions(+), 4326 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/CopyReferenceActionFilesTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/CopyReferenceActionFilesTest.groovy index 2820da2fd78d..ac0415f2bf26 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/CopyReferenceActionFilesTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/CopyReferenceActionFilesTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import com.intellij.openapi.vfs.VirtualFileManager import com.intellij.psi.PsiManager import com.intellij.testFramework.PsiTestUtil -public class CopyReferenceActionFilesTest extends CodeInsightTestCase { +class CopyReferenceActionFilesTest extends CodeInsightTestCase { VirtualFile additionalRoot @Override @@ -52,7 +52,7 @@ public class CopyReferenceActionFilesTest extends CodeInsightTestCase { } } - public void testCopyFile_RegisteredAsSourceRoots_ShouldContainItsName() throws Exception { + void testCopyFile_RegisteredAsSourceRoots_ShouldContainItsName() throws Exception { // CPP-4315 "Edit | Copy Reference" result doesn't contain the file name VirtualFile dir @@ -77,7 +77,7 @@ public class CopyReferenceActionFilesTest extends CodeInsightTestCase { assertEquals("file.txt", CopyReferenceAction.elementToFqn(PsiManager.getInstance(project).findFile(file))); } - public void testCopyFile_RegisteredAsContentRoot_ShouldContainItsFullPath() throws Exception { + void testCopyFile_RegisteredAsContentRoot_ShouldContainItsFullPath() throws Exception { // IDEA-144300 Copy Reference for source folder/content root copies empty string VirtualFile dir @@ -101,7 +101,7 @@ public class CopyReferenceActionFilesTest extends CodeInsightTestCase { assertEquals(file.getPath(), CopyReferenceAction.elementToFqn(PsiManager.getInstance(project).findFile(file))); } - public void testCopyFile_RegisteredAsNestedContentRoot_ShouldContainPathFromOuterMostRoot() throws Exception { + void testCopyFile_RegisteredAsNestedContentRoot_ShouldContainPathFromOuterMostRoot() throws Exception { // IDEA-144300 Copy Reference for source folder/content root copies empty string VirtualFile dir @@ -124,8 +124,8 @@ public class CopyReferenceActionFilesTest extends CodeInsightTestCase { assertEquals("dir_dir", CopyReferenceAction.elementToFqn(PsiManager.getInstance(project).findDirectory(dir_dir))); assertEquals("dir_dir/file.txt", CopyReferenceAction.elementToFqn(PsiManager.getInstance(project).findFile(dir_dir_file))); } - - public void testCopyFile_UnderExcludeRoot_ShouldContainPathFromTheCorrespondingContentRoot() throws Exception { + + void testCopyFile_UnderExcludeRoot_ShouldContainPathFromTheCorrespondingContentRoot() throws Exception { // IDEA-144316 Copy Reference should work for excluded subfolders same way as it works for regular project subdirs VirtualFile dir diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/DuplicateActionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/DuplicateActionTest.groovy index 68b0de566438..2576c32f3e8d 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/DuplicateActionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/DuplicateActionTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,15 +20,15 @@ import com.intellij.openapi.actionSystem.IdeActions import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase import org.jetbrains.annotations.NonNls -public class DuplicateActionTest extends LightCodeInsightFixtureTestCase { - public void testOneLine() { +class DuplicateActionTest extends LightCodeInsightFixtureTestCase { + void testOneLine() { doTest '''xxx ''', "txt", '''xxx xxx ''' } - public void testEmpty() { + void testEmpty() { doTest '', "txt", '' } @@ -38,7 +38,7 @@ xxx myFixture.checkResult(after); } - public void testSelectName() { + void testSelectName() { doTest ''' class C { void foo() {} @@ -51,7 +51,7 @@ class C { ''' } - public void "test preserve caret position when it's already inside element's name"() { + void "test preserve caret position when it's already inside element's name"() { doTest ''' class C { void foo() {} @@ -64,7 +64,7 @@ class C { ''' } - public void testXmlTag() { + void testXmlTag() { doTest ''' diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/GenerateGetterSetterTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/GenerateGetterSetterTest.groovy index 6703d1b2064d..849fd346f0cf 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/GenerateGetterSetterTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/GenerateGetterSetterTest.groovy @@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable */ class GenerateGetterSetterTest extends LightCodeInsightFixtureTestCase { - public void "test don't strip is of non-boolean fields"() { + void "test don't strip is of non-boolean fields"() { myFixture.addClass('class YesNoRAMField {}') myFixture.configureByText 'a.java', ''' class Foo { @@ -52,8 +52,8 @@ class Foo { } ''' } - - public void "test strip is of boolean fields"() { + + void "test strip is of boolean fields"() { myFixture.configureByText 'a.java', ''' class Foo { boolean isStateForceMailField; @@ -77,9 +77,9 @@ class Foo { } } ''' - } - - public void "test strip is of boolean fields setter"() { + } + + void "test strip is of boolean fields setter"() { myFixture.configureByText 'a.java', ''' class Foo { boolean isStateForceMailField; @@ -99,7 +99,7 @@ class Foo { ''' } - public void "test strip field prefix"() { + void "test strip field prefix"() { def settings = CodeStyleSettingsManager.getInstance(getProject()).currentSettings String oldPrefix = settings.FIELD_NAME_PREFIX try { @@ -127,7 +127,7 @@ class Foo { } } - public void "test qualified this"() { + void "test qualified this"() { myFixture.enableInspections(UnqualifiedFieldAccessInspection.class) myFixture.configureByText 'a.java', ''' class Foo { @@ -148,7 +148,7 @@ class Foo { ''' } - public void "test nullable stuff"() { + void "test nullable stuff"() { myFixture.addClass("package org.jetbrains.annotations;\n" + "public @interface NotNull {}") myFixture.configureByText 'a.java', ''' @@ -197,7 +197,7 @@ class Foo { UIUtil.dispatchAllInvocationEvents() } - public void "test static or this setter with same name parameter"() { + void "test static or this setter with same name parameter"() { myFixture.enableInspections(UnqualifiedFieldAccessInspection.class) myFixture.configureByText 'a.java', ''' class Foo { diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/JavaDocumentationTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/JavaDocumentationTest.groovy index 417206df3460..ddc87dc76781 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/JavaDocumentationTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/JavaDocumentationTest.groovy @@ -41,7 +41,7 @@ class JavaDocumentationTest extends LightCodeInsightFixtureTestCase { " }" + " "; - public void testConstructorDoc() { + void testConstructorDoc() { configure """\ class Foo { Foo() {} Foo(int param) {} } @@ -63,7 +63,7 @@ class JavaDocumentationTest extends LightCodeInsightFixtureTestCase { assert doc == expected } - public void testConstructorDoc2() { + void testConstructorDoc2() { configure """\ class Foo { Foo() {} Foo(int param) {} } @@ -85,7 +85,7 @@ class JavaDocumentationTest extends LightCodeInsightFixtureTestCase { assert doc == expected } - public void testMethodDocWhenInArgList() { + void testMethodDocWhenInArgList() { configure """\ class Foo { void doFoo() {} } @@ -105,7 +105,7 @@ class JavaDocumentationTest extends LightCodeInsightFixtureTestCase { assert doc == expected } - public void testGenericMethod() { + void testGenericMethod() { configure """\ class Bar { java.util.List foo(T param); } @@ -119,7 +119,7 @@ class JavaDocumentationTest extends LightCodeInsightFixtureTestCase { assert doc == "Bar\n java.util.List<java.lang.String> foo (java.lang.String param)" } - public void testGenericField() { + void testGenericField() { configure """\ class Bar { T field; } @@ -132,8 +132,8 @@ class JavaDocumentationTest extends LightCodeInsightFixtureTestCase { assert doc == "Bar\n java.lang.Integer field" } - - public void testMethodInAnonymousClass() { + + void testMethodInAnonymousClass() { configure """\ class Foo {{ new Runnable() { @@ -151,7 +151,7 @@ class JavaDocumentationTest extends LightCodeInsightFixtureTestCase { assert doc == "private void m ()" } - public void testAsterisksFiltering() { + void testAsterisksFiltering() { configure """\ class C { /** @@ -176,7 +176,7 @@ class JavaDocumentationTest extends LightCodeInsightFixtureTestCase { assert doc == expected } - public void testInlineTagSpacing() { + void testInlineTagSpacing() { configure """\ class C { /** Visit the "{@code /login}" URL. */ @@ -196,7 +196,7 @@ class JavaDocumentationTest extends LightCodeInsightFixtureTestCase { assert doc == expected } - public void testMethodToMethodDelegate() { + void testMethodToMethodDelegate() { DocumentationDelegateProvider provider = { if (it instanceof PsiMethod && it.name == 'foo') { JavaPsiFacade.getInstance(project).findClass('Foo', it.resolveScope)?.findMethodBySignature(it, false) diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/MakeInferredAnnotationExplicitTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/MakeInferredAnnotationExplicitTest.groovy index 1c03bcc51975..f3c248c59894 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/MakeInferredAnnotationExplicitTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/MakeInferredAnnotationExplicitTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase */ class MakeInferredAnnotationExplicitTest extends LightCodeInsightFixtureTestCase { - public void "test contract and notNull"() { + void "test contract and notNull"() { myFixture.configureByText 'a.java', ''' class Foo { static String foo() { @@ -44,8 +44,8 @@ class Foo { ''' } - - public void "test custom notNull"() { + + void "test custom notNull"() { myFixture.addClass("package foo; public @interface MyNotNull {}") NullableNotNullManager.getInstance(project).notNulls = ['foo.MyNotNull'] NullableNotNullManager.getInstance(project).defaultNotNull = 'foo.MyNotNull' diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/MultipleModuleHighlightingTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/MultipleModuleHighlightingTest.groovy index a5b84c0c1559..a1898101341c 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/MultipleModuleHighlightingTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/MultipleModuleHighlightingTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ import com.intellij.util.containers.ContainerUtil */ class MultipleModuleHighlightingTest extends JavaCodeInsightFixtureTestCase { - public void "test use original place classpath for reference type resolving"() { + void "test use original place classpath for reference type resolving"() { addTwoModules() myFixture.addFileToProject "mod1/Class2.java", ''' @@ -63,7 +63,7 @@ class Class3 { myFixture.checkHighlighting() } - public void "test use original place classpath for new expression type resolving"() { + void "test use original place classpath for new expression type resolving"() { addTwoModules() myFixture.addFileToProject "mod1/A.java", ''' @@ -101,7 +101,7 @@ class Class3 { ModuleRootModificationUtil.addDependency(myModule, mod2) } - public void testOverridingJdkExceptions() { + void testOverridingJdkExceptions() { def dep = PsiTestUtil.addModule(project, JavaModuleType.moduleType, "dep", myFixture.tempDirFixture.findOrCreateDir("dep")) ModuleRootModificationUtil.setModuleSdk(dep, ModuleRootManager.getInstance(myModule).sdk) ModuleRootModificationUtil.updateModel(myModule, { model -> diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/NonSourceInspectionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/NonSourceInspectionTest.groovy index b1b805fc21d4..99a05d57bdac 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/NonSourceInspectionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/NonSourceInspectionTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase */ class NonSourceInspectionTest extends JavaCodeInsightFixtureTestCase { - public void "test inspection outside source root"() { + void "test inspection outside source root"() { PsiTestUtil.removeAllRoots(myModule, ModuleRootManager.getInstance(myModule).sdk) PsiTestUtil.addSourceRoot(myModule, myFixture.tempDirFixture.findOrCreateDir("src")) @@ -57,7 +57,7 @@ class SomeClass { assertEmpty InspectionEngine.runInspectionOnFile(file, wrapper, context) } - public void "test resolve super constructor reference"() { + void "test resolve super constructor reference"() { PsiTestUtil.removeAllRoots(myModule, ModuleRootManager.getInstance(myModule).sdk) PsiTestUtil.addSourceRoot(myModule, myFixture.tempDirFixture.findOrCreateDir("src")) diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/OverrideImplementTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/OverrideImplementTest.groovy index 0550a65190a3..7dcce291905d 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/OverrideImplementTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/OverrideImplementTest.groovy @@ -33,15 +33,21 @@ class OverrideImplementTest extends LightCodeInsightFixtureTestCase { JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/overrideImplement" } - public void testImplementExtensionMethods() { doTest(true) } - public void testOverrideExtensionMethods() { doTest(false) } - public void testDoNotImplementExtensionMethods() { doTest(true) } - public void testSkipUnknownAnnotations() { doTest(true) } - public void testMultipleInheritedThrows() { doTest(false) } - public void testOverrideInInterface() { doTest(false) } - public void testMultipleInheritanceWithThrowables() { doTest(true) } + void testImplementExtensionMethods() { doTest(true) } - public void testImplementInInterface() { + void testOverrideExtensionMethods() { doTest(false) } + + void testDoNotImplementExtensionMethods() { doTest(true) } + + void testSkipUnknownAnnotations() { doTest(true) } + + void testMultipleInheritedThrows() { doTest(false) } + + void testOverrideInInterface() { doTest(false) } + + void testMultipleInheritanceWithThrowables() { doTest(true) } + + void testImplementInInterface() { myFixture.addClass """\ interface A { void foo(); @@ -68,7 +74,7 @@ interface B extends A { """ } - public void testImplementInterfaceWhenClassProvidesProtectedImplementation() { + void testImplementInterfaceWhenClassProvidesProtectedImplementation() { myFixture.addClass """\ interface A { void f(); @@ -101,7 +107,7 @@ class C extends B implements A { """ } - public void testImplementSameNamedInterfaces() { + void testImplementSameNamedInterfaces() { myFixture.addClass """\ class Main1 { interface I { @@ -143,7 +149,7 @@ class B implements Main1.I, Main2.I { """ } - public void "test overriding overloaded method"() { + void "test overriding overloaded method"() { myFixture.addClass """\ package bar; interface A { @@ -177,7 +183,7 @@ class Test implements A { """ } - public void testTypeAnnotationsInImplementedMethod() { + void testTypeAnnotationsInImplementedMethod() { myFixture.addClass """\ import java.lang.annotation.*; @Target(ElementType.TYPE_USE) diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/CustomFileTypeInspectionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/CustomFileTypeInspectionTest.groovy index 9b6cdb7ff64f..36f6e50700ea 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/CustomFileTypeInspectionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/CustomFileTypeInspectionTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,9 +21,9 @@ import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase /** * @author peter */ -public class CustomFileTypeInspectionTest extends LightCodeInsightFixtureTestCase { +class CustomFileTypeInspectionTest extends LightCodeInsightFixtureTestCase { - public void testSpellChecking() { + void testSpellChecking() { myFixture.configureByText 'a.hs', ''' infixl -- keyword diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/FragmentCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/FragmentCompletionTest.groovy index 012559bffc25..ffa268806d45 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/FragmentCompletionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/FragmentCompletionTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,8 +27,8 @@ import com.intellij.util.PairFunction /** * @author peter */ -public class FragmentCompletionTest extends LightCodeInsightFixtureTestCase { - public void testDontCompleteFieldsAndMethodsInReferenceCodeFragment() throws Throwable { +class FragmentCompletionTest extends LightCodeInsightFixtureTestCase { + void testDontCompleteFieldsAndMethodsInReferenceCodeFragment() throws Throwable { final String text = CommonClassNames.JAVA_LANG_OBJECT + "."; PsiFile file = JavaCodeFragmentFactory.getInstance(project).createReferenceCodeFragment(text, null, true, true); myFixture.configureFromExistingVirtualFile(file.getVirtualFile()); @@ -36,7 +36,7 @@ public class FragmentCompletionTest extends LightCodeInsightFixtureTestCase { myFixture.checkResult(text); } - public void testNoKeywordsInReferenceCodeFragment() throws Throwable { + void testNoKeywordsInReferenceCodeFragment() throws Throwable { PsiFile file = JavaCodeFragmentFactory.getInstance(project).createReferenceCodeFragment("", null, true, true); myFixture.configureFromExistingVirtualFile(file.getVirtualFile()); assert myFixture.completeBasic() @@ -44,7 +44,7 @@ public class FragmentCompletionTest extends LightCodeInsightFixtureTestCase { assert !('import' in myFixture.lookupElementStrings) } - public void "test no classes in reference code fragment"() throws Throwable { + void "test no classes in reference code fragment"() throws Throwable { myFixture.addClass("package foo; public interface FooIntf { }") def text = "FooInt" @@ -54,7 +54,7 @@ public class FragmentCompletionTest extends LightCodeInsightFixtureTestCase { myFixture.checkResult(text) } - public void "test no constants in reference code fragment"() throws Throwable { + void "test no constants in reference code fragment"() throws Throwable { myFixture.addClass("package foo; public interface FooIntf { int constant = 2 }") def text = "FooInt.con" @@ -64,7 +64,7 @@ public class FragmentCompletionTest extends LightCodeInsightFixtureTestCase { myFixture.checkResult(text) } - public void testNoPackagesInExpressionCodeFragment() throws Throwable { + void testNoPackagesInExpressionCodeFragment() throws Throwable { final String text = "jav"; PsiFile file = JavaCodeFragmentFactory.getInstance(project).createExpressionCodeFragment(text, null, null, true); myFixture.configureFromExistingVirtualFile(file.getVirtualFile()); @@ -72,14 +72,14 @@ public class FragmentCompletionTest extends LightCodeInsightFixtureTestCase { myFixture.checkResult(text); } - public void testSubPackagesInExpressionCodeFragment() throws Throwable { + void testSubPackagesInExpressionCodeFragment() throws Throwable { PsiFile file = JavaCodeFragmentFactory.getInstance(project).createExpressionCodeFragment("java.la", null, null, true); myFixture.configureFromExistingVirtualFile(file.getVirtualFile()); assert !myFixture.completeBasic() myFixture.checkResult("java.lang."); } - public void testPrimitivesInTypeCodeFragmentWithParameterListContext() throws Throwable { + void testPrimitivesInTypeCodeFragmentWithParameterListContext() throws Throwable { def clazz = myFixture.addClass("class Foo { void foo(int a) {} }") PsiFile file = JavaCodeFragmentFactory.getInstance(project).createTypeCodeFragment("b", clazz.methods[0].parameterList, true); @@ -88,7 +88,7 @@ public class FragmentCompletionTest extends LightCodeInsightFixtureTestCase { assert myFixture.lookupElementStrings[0..1] == ['boolean', 'byte'] } - public void testQualifierCastingInExpressionCodeFragment() throws Throwable { + void testQualifierCastingInExpressionCodeFragment() throws Throwable { final ctxText = "class Bar {{ Object o; o=null }}" final ctxFile = createLightFile(StdFileTypes.JAVA, ctxText) final context = ctxFile.findElementAt(ctxText.indexOf("o=")) @@ -100,7 +100,7 @@ public class FragmentCompletionTest extends LightCodeInsightFixtureTestCase { myFixture.checkResult("o instanceof String && ((String) o).substring()"); } - public void testNoGenericQualifierCastingWithRuntimeType() throws Throwable { + void testNoGenericQualifierCastingWithRuntimeType() throws Throwable { final ctxText = "import java.util.*; class Bar {{ Map map = new HashMap(); map=null; }}" final ctxFile = createLightFile(StdFileTypes.JAVA, ctxText) final context = ctxFile.findElementAt(ctxText.indexOf("map=")) @@ -118,7 +118,7 @@ public class FragmentCompletionTest extends LightCodeInsightFixtureTestCase { myFixture.checkResult("map.entrySet()"); } - public void "test no static after instance in expression fragment"() { + void "test no static after instance in expression fragment"() { def ctxFile = myFixture.addClass("package foo; public class Class {{\n int a = 2; }}").containingFile def context = ctxFile.findElementAt(ctxFile.text.indexOf('int')) @@ -129,7 +129,7 @@ public class FragmentCompletionTest extends LightCodeInsightFixtureTestCase { assert !myFixture.lookupElementStrings.contains('valueOf') } - public void "test no class keywords in expression fragment"() { + void "test no class keywords in expression fragment"() { def ctxFile = myFixture.addClass("package foo; public class Class {{\n int a = 2; }}").containingFile def context = ctxFile.findElementAt(ctxFile.text.indexOf('int')) @@ -140,7 +140,7 @@ public class FragmentCompletionTest extends LightCodeInsightFixtureTestCase { assert !myFixture.lookupElementStrings.contains('class') } - public void "test annotation context"() { + void "test annotation context"() { def ctxFile = myFixture.addClass("class Class { void foo(int context) { @Anno int a; } }").containingFile def context = ctxFile.findElementAt(ctxFile.text.indexOf('Anno')) PsiFile file = JavaCodeFragmentFactory.getInstance(project).createExpressionCodeFragment("c", context, null, true); diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/GlobalMemberNameCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/GlobalMemberNameCompletionTest.groovy index cc05f2ff6a8f..5b2b79e42fad 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/GlobalMemberNameCompletionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/GlobalMemberNameCompletionTest.groovy @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.codeInsight.completion import com.intellij.codeInsight.JavaProjectCodeInsightSettings import com.intellij.codeInsight.lookup.LookupElement @@ -6,9 +21,9 @@ import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase /** * @author peter */ -public class GlobalMemberNameCompletionTest extends LightCodeInsightFixtureTestCase { +class GlobalMemberNameCompletionTest extends LightCodeInsightFixtureTestCase { - public void testMethodName() throws Exception { + void testMethodName() throws Exception { myFixture.addClass(""" package foo; @@ -23,7 +38,7 @@ public class Foo { class Bar {{ abcmethod() }}""" } - public void testFieldName() throws Exception { + void testFieldName() throws Exception { myFixture.addClass(""" package foo; @@ -38,7 +53,7 @@ public class Foo { class Bar {{ abcfield }}""" } - public void testFieldNameQualified() throws Exception { + void testFieldNameQualified() throws Exception { myFixture.addClass(""" package foo; @@ -53,7 +68,7 @@ public class Foo { class Bar {{ Foo.abcfield }}""" } - public void testFieldNamePresentation() { + void testFieldNamePresentation() { myFixture.addClass(""" package foo; @@ -74,7 +89,7 @@ public class Foo { myFixture.complete(CompletionType.BASIC, 2) } - public void testQualifiedMethodName() throws Exception { + void testQualifiedMethodName() throws Exception { myFixture.addClass(""" package foo; @@ -88,7 +103,7 @@ public class Foo { class Bar {{ Foo.abcmethod() }}""" } - public void testIfThereAreAlreadyStaticImportsWithThatClass() throws Exception { + void testIfThereAreAlreadyStaticImportsWithThatClass() throws Exception { myFixture.addClass(""" package foo; @@ -109,7 +124,7 @@ class Bar {{ abcmethod(); anotherMethod() }}""" } - public void testExcludeClassFromCompletion() throws Exception { + void testExcludeClassFromCompletion() throws Exception { myFixture.addClass("""package foo; public class Foo { public static int abcmethod() {} @@ -128,7 +143,7 @@ class Bar {{ abcmethod(); anotherMethod() }}""" class Bar {{ abcmethod() }}""" } - public void testExcludeMethodFromCompletion() throws Exception { + void testExcludeMethodFromCompletion() throws Exception { myFixture.addClass("""package foo; public class Foo { public static int abcmethod1() {} @@ -143,7 +158,7 @@ class Bar {{ abcmethod() }}""" class Bar {{ abcmethod1() }}""" } - public void testMergeOverloads() throws Exception { + void testMergeOverloads() throws Exception { myFixture.addClass("""package foo; public class Foo { public static int abcmethod(int a) {} @@ -164,7 +179,7 @@ class Bar {{ abcmethod1() }}""" assertOrderedEquals myFixture.lookupElementStrings, "abcmethod", "abcmethod1" } - public void testMethodFromTheSameClass() { + void testMethodFromTheSameClass() { myFixture.configureByText("a.java", """ class A { static void foo() {} @@ -189,7 +204,7 @@ class A { ''' } - public void "test static import before an identifier"() { + void "test static import before an identifier"() { myFixture.addClass ''' package test.t1; @@ -238,7 +253,7 @@ public class Demo { myFixture.checkResult output } - public void "test no results in incomplete static import"() { + void "test no results in incomplete static import"() { def text = """ package p; diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/HeavyCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/HeavyCompletionTest.groovy index 7a9d8cb7400a..231bc684acd5 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/HeavyCompletionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/HeavyCompletionTest.groovy @@ -1,6 +1,17 @@ /* - * Copyright (c) 2000-2005 by JetBrains s.r.o. All Rights Reserved. - * Use is subject to license terms. + * Copyright 2000-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.intellij.codeInsight.completion @@ -34,14 +45,14 @@ import org.jetbrains.annotations.NotNull /** * @author peter */ -public class HeavyCompletionTest extends JavaCodeInsightFixtureTestCase { +class HeavyCompletionTest extends JavaCodeInsightFixtureTestCase { @Override protected String getTestDataPath() { return JavaTestUtil.getJavaTestDataPath(); } - public void testPackagePrefix() throws Throwable { + void testPackagePrefix() throws Throwable { myFixture.configureByFile("/codeInsight/completion/normal/" + getTestName(false) + ".java"); ApplicationManager.application.runWriteAction { final ModifiableRootModel model = ModuleRootManager.getInstance(myFixture.getModule()).getModifiableModel(); @@ -56,7 +67,7 @@ public class HeavyCompletionTest extends JavaCodeInsightFixtureTestCase { assertTrue(JavaPsiFacade.getInstance(getProject()).findPackage("foo.bar.goo").isValid()); } - public void testPreferTestCases() throws Throwable { + void testPreferTestCases() throws Throwable { myFixture.configureByFile("/codeInsight/completion/normal/" + getTestName(false) + ".java"); ApplicationManager.application.runWriteAction { final ModifiableRootModel model = ModuleRootManager.getInstance(myFixture.getModule()).getModifiableModel(); @@ -76,7 +87,7 @@ public class HeavyCompletionTest extends JavaCodeInsightFixtureTestCase { myFixture.assertPreferredCompletionItems(0, "SomeTestCase", "SomeAnchor", "SomeTestec"); } - public void testAllClassesWhenNothingIsFound() throws Throwable { + void testAllClassesWhenNothingIsFound() throws Throwable { myFixture.addClass("package foo.bar; public class AxBxCxDxEx {}"); myFixture.configureByFile("/codeInsight/completion/normal/" + getTestName(false) + ".java"); @@ -85,7 +96,7 @@ public class HeavyCompletionTest extends JavaCodeInsightFixtureTestCase { myFixture.checkResultByFile("/codeInsight/completion/normal/" + getTestName(false) + "_after.java"); } - public void testAllClassesOnSecondBasicCompletion() throws Throwable { + void testAllClassesOnSecondBasicCompletion() throws Throwable { myFixture.addClass("package foo.bar; public class AxBxCxDxEx {}"); myFixture.configureByFile("/codeInsight/completion/normal/" + getTestName(false) + ".java"); @@ -110,7 +121,7 @@ public class HeavyCompletionTest extends JavaCodeInsightFixtureTestCase { } } - public void testMapsInvalidation() throws Exception { + void testMapsInvalidation() throws Exception { JavaAutoPopupTest.registerCompletionContributor(CacheVerifyingContributor, testRootDisposable, LoadingOrder.FIRST) myFixture.configureByFile("/codeInsight/completion/normal/" + getTestName(false) + ".java"); assertInstanceOf(myFixture.getFile().getVirtualFile().getFileSystem(), LocalFileSystem.class); // otherwise the completion copy won't be preserved which is critical here @@ -120,7 +131,7 @@ public class HeavyCompletionTest extends JavaCodeInsightFixtureTestCase { assert myFixture.completeBasic() == null } - public void testQualifyInaccessibleClassName() throws Exception { + void testQualifyInaccessibleClassName() throws Exception { PsiTestUtil.addModule(getProject(), StdModuleTypes.JAVA, "second", myFixture.getTempDirFixture().findOrCreateDir("second")); myFixture.addFileToProject("second/foo/bar/AxBxCxDxEx.java", "package foo.bar; class AxBxCxDxEx {}"); @@ -129,7 +140,7 @@ public class HeavyCompletionTest extends JavaCodeInsightFixtureTestCase { myFixture.checkResult("class Main { foo.bar.AxBxCxDxEx }"); } - public void testPreferOwnMethods() { + void testPreferOwnMethods() { def lib = LocalFileSystem.getInstance().refreshAndFindFileByPath(PathManagerEx.getTestDataPath() + "/../../../lib") def nanoJar = lib.children.find { it.name.startsWith("nanoxml") } @@ -148,7 +159,7 @@ public class Test { myFixture.assertPreferredCompletionItems 0, 'getBuilder' } - public void testNoJavaStructureModificationOnSecondInvocation() { + void testNoJavaStructureModificationOnSecondInvocation() { myFixture.configureByText 'a.java', 'class Foo { Xxxxx }' def oldCount = PsiManager.getInstance(project).modificationTracker.javaStructureModificationCount assert !myFixture.completeBasic() @@ -156,7 +167,7 @@ public class Test { assert oldCount == PsiManager.getInstance(project).modificationTracker.javaStructureModificationCount } - public void testNoJavaStructureModificationOnSecondInvocationAfterTyping() { + void testNoJavaStructureModificationOnSecondInvocationAfterTyping() { myFixture.configureByText 'a.java', 'class Foo { Xxxxx }' def tracker = PsiManager.getInstance(project).modificationTracker @@ -174,7 +185,7 @@ public class Test { assert oldCount == tracker.javaStructureModificationCount } - public void testForbiddenApiVariants() { + void testForbiddenApiVariants() { IdeaTestUtil.setModuleLanguageLevel(myModule, LanguageLevel.JDK_1_4) myFixture.addClass("""\ package java.nio.channels; @@ -203,7 +214,7 @@ public class SocketChannel { assert p.itemTextForeground == JBColor.foreground() } - public void "test seemingly scrambled subclass"() { + void "test seemingly scrambled subclass"() { PsiTestUtil.addLibrary(myModule, JavaTestUtil.getJavaTestDataPath() + "/codeInsight/completion/normal/seemsScrambled.jar") myFixture.configureByText 'a.java', '''import test.Books; @@ -217,7 +228,7 @@ class Foo {{ Books.Test.v1 }} } - public void "test different jdks in different modules"() { + void "test different jdks in different modules"() { (StatisticsManager.instance as StatisticsManagerImpl).enableStatistics(testRootDisposable) def anotherModule = PsiTestUtil.addModule(project, StdModuleTypes.JAVA, 'another', myFixture.tempDirFixture.findOrCreateDir('another')) diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/HippieCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/HippieCompletionTest.groovy index 4144309e118a..0bbc2950085d 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/HippieCompletionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/HippieCompletionTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase */ class HippieCompletionTest extends LightCodeInsightFixtureTestCase { - public void testDollars() { + void testDollars() { myFixture.configureByText "a.txt", ''' $some_long_variable_name = Obj::instance(); $some_lon @@ -34,7 +34,7 @@ $some_long_variable_name ''' } - public void testFromAnotherFile() { + void testFromAnotherFile() { myFixture.configureByText "b.txt", ''' $some_local = 1; ''' @@ -61,7 +61,7 @@ $some_long_variable_name } - public void testFromAnotherFile2() { + void testFromAnotherFile2() { myFixture.configureByText "b.txt", ''' foo function foo2 ''' @@ -99,7 +99,7 @@ foo2 ''' } - public void "test no middle matching"() { + void "test no middle matching"() { myFixture.configureByText "a.txt", ''' fooExpression exp @@ -111,7 +111,7 @@ exp ''' } - public void "test words from javadoc"() { + void "test words from javadoc"() { myFixture.configureByText "a.java", ''' /** some comment */ com @@ -122,8 +122,8 @@ com comment ''' } - - public void "test words from line comments"() { + + void "test words from line comments"() { myFixture.configureByText "a.java", ''' // some comment2 com @@ -134,7 +134,8 @@ com comment2 ''' } - public void "test words from block comments"() { + + void "test words from block comments"() { myFixture.configureByText "a.java", ''' /* some comment3 */ com @@ -146,7 +147,7 @@ comment3 ''' } - public void "test complete in string literal"() { + void "test complete in string literal"() { myFixture.configureByText "a.java", ''' class Foo { public Collection allInScope(@NotNull GlobalSearchScope scope) { @@ -164,7 +165,7 @@ class Foo { ''' } - public void "test complete variable name in string literal"() { + void "test complete variable name in string literal"() { myFixture.configureByText "a.java", ''' class Xoo { String foobar = "foo"; @@ -179,7 +180,7 @@ class Xoo { } - public void "test file start"() { + void "test file start"() { myFixture.configureByText "a.java", ''' class Xoo { } @@ -191,7 +192,7 @@ class Xoo { ''' } - public void "test cpp indirection"() { + void "test cpp indirection"() { myFixture.configureByText "a.c", '''f foo->bar ''' @@ -201,7 +202,7 @@ foo->bar ''' } - public void "test numbers"() { + void "test numbers"() { myFixture.configureByText "a.c", '''246 24601 ''' @@ -211,7 +212,7 @@ foo->bar ''' } - public void "test inside word"() { + void "test inside word"() { myFixture.configureByText "a.c", 'foo fox fbar' complete() myFixture.checkResult 'foo fox foxbar' @@ -219,7 +220,7 @@ foo->bar myFixture.checkResult 'foo fox foobar' } - public void "test multiple carets"() { + void "test multiple carets"() { myFixture.configureByText "a.txt", "fox food floor f f" complete() myFixture.checkResult "fox food floor floor floor" @@ -229,7 +230,7 @@ foo->bar myFixture.checkResult "fox food floor fox fox" } - public void "test multiple carets backward"() { + void "test multiple carets backward"() { myFixture.configureByText "a.txt", "f f fox food floor" backComplete() myFixture.checkResult "fox fox fox food floor" diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy index 411d5fabe3cf..d2b82e0847de 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy @@ -67,7 +67,7 @@ import static com.intellij.testFramework.EdtTestUtil.runInEdtAndWait */ class JavaAutoPopupTest extends CompletionAutoPopupTestCase { - public void testNewItemsOnLongerPrefix() { + void testNewItemsOnLongerPrefix() { myFixture.configureByText("a.java", """ class Foo { void foo(String iterable) { @@ -96,7 +96,7 @@ class JavaAutoPopupTest extends CompletionAutoPopupTestCase { assert lookup.focused } - public void testAfterDblColon() { + void testAfterDblColon() { myFixture.configureByText("a.java", """ class Foo { void foo() { @@ -114,7 +114,7 @@ class JavaAutoPopupTest extends CompletionAutoPopupTestCase { assert myFixture.lookupElementStrings.containsAll(items as List) } - public void testRecalculateItemsOnBackspace() { + void testRecalculateItemsOnBackspace() { myFixture.configureByText("a.java", """ class Foo { void foo(String iterable) { @@ -142,7 +142,7 @@ class JavaAutoPopupTest extends CompletionAutoPopupTestCase { myFixture.assertPreferredCompletionItems 0, "iter", "iterable" } - public void testExplicitSelectionShouldSurvive() { + void testExplicitSelectionShouldSurvive() { myFixture.configureByText("a.java", """ class Foo { void foo(String iterable) { @@ -164,7 +164,7 @@ class JavaAutoPopupTest extends CompletionAutoPopupTestCase { } - public void testExplicitMouseSelectionShouldSurvive() { + void testExplicitMouseSelectionShouldSurvive() { myFixture.configureByText("a.java", """ class Foo { void foo(String iterable) { @@ -185,7 +185,7 @@ class JavaAutoPopupTest extends CompletionAutoPopupTestCase { } - public void testGenerallyFocusLookupInJavaMethod() { + void testGenerallyFocusLookupInJavaMethod() { myFixture.configureByText("a.java", """ class Foo { String foo(String iterable) { @@ -197,7 +197,7 @@ class JavaAutoPopupTest extends CompletionAutoPopupTestCase { assertTrue lookup.focused } - public void testNoStupidNameSuggestions() { + void testNoStupidNameSuggestions() { myFixture.configureByText("a.java", """ class Foo { String foo(String ) { @@ -208,7 +208,7 @@ class JavaAutoPopupTest extends CompletionAutoPopupTestCase { assert !myFixture.lookupElementStrings } - public void testExplicitSelectionShouldBeHonoredFocused() { + void testExplicitSelectionShouldBeHonoredFocused() { myFixture.configureByText("a.java", """ class Foo { String foo() { @@ -239,7 +239,7 @@ class JavaAutoPopupTest extends CompletionAutoPopupTestCase { """ } - public void "test popup in javadoc reference"() { + void "test popup in javadoc reference"() { myFixture.configureByText("a.java", """ /** * {@link AIO} @@ -250,7 +250,7 @@ class JavaAutoPopupTest extends CompletionAutoPopupTestCase { assert lookup } - public void "test popup after hash in javadoc"() { + void "test popup after hash in javadoc"() { myFixture.configureByText("a.java", """ /** * {@link String} @@ -261,7 +261,7 @@ class JavaAutoPopupTest extends CompletionAutoPopupTestCase { assert lookup } - public void "test popup in javadoc local reference"() { + void "test popup in javadoc local reference"() { myFixture.configureByText("a.java", """ /** * {@link #} @@ -274,7 +274,7 @@ class JavaAutoPopupTest extends CompletionAutoPopupTestCase { assert lookup } - public void "test autopopup in javadoc tag name"() { + void "test autopopup in javadoc tag name"() { myFixture.configureByText("a.java", """ /** * @a @@ -285,7 +285,7 @@ class JavaAutoPopupTest extends CompletionAutoPopupTestCase { assert lookup } - public void "test no autopopup in javadoc parameter descriptions"() { + void "test no autopopup in javadoc parameter descriptions"() { myFixture.configureByText("a.java", """ class Foo { /** @@ -302,8 +302,8 @@ class Foo { type 'o' assert !lookup } - - public void "test autopopup in javadoc parameter name"() { + + void "test autopopup in javadoc parameter name"() { myFixture.configureByText("a.java", """ class Foo { /** @@ -316,7 +316,7 @@ class Foo { assert lookup } - public void testPrefixLengthDependentSorting() { + void testPrefixLengthDependentSorting() { myFixture.addClass("package foo; public class PsiJavaCodeReferenceElement {}") myFixture.configureByText("a.java", """ import foo.PsiJavaCodeReferenceElement; @@ -330,7 +330,7 @@ class Foo { } - public void testQuickSelectAfterReuse() { + void testQuickSelectAfterReuse() { myFixture.configureByText("a.java", """ class A { Iterable iterable; { } @@ -351,7 +351,7 @@ class Foo { """ } - public void testQuickSelectAfterReuseAndBackspace() { + void testQuickSelectAfterReuseAndBackspace() { myFixture.configureByText("a.java", """ class A { Iterable iterable; { } @@ -372,7 +372,7 @@ class Foo { """ } - public void testQuickSelectLiveTemplate() { + void testQuickSelectLiveTemplate() { myFixture.configureByText("a.java", """ class A { { } @@ -387,7 +387,7 @@ class Foo { """ } - public void testTwoQuickRestartsAfterHiding() { + void testTwoQuickRestartsAfterHiding() { for (i in 0..10) { myFixture.configureByText("a${i}.java", """ class A { @@ -417,7 +417,7 @@ class Foo { fail "too many too quick attempts" } - public void testTypingDuringExplicitCompletion() { + void testTypingDuringExplicitCompletion() { myFixture.configureByText("a.java", """ class A { { Runnable r = new } @@ -430,7 +430,7 @@ class Foo { assert 'Thread' in myFixture.lookupElementStrings } - public void testDotAfterVariable() { + void testDotAfterVariable() { myFixture.configureByText("a.java", """ class A { { Object ooo; } @@ -441,7 +441,7 @@ class Foo { assert lookup } - public void testDotAfterCall() { + void testDotAfterCall() { myFixture.configureByText("a.java", """ class A { { } @@ -452,7 +452,7 @@ class Foo { assert lookup } - public void testDotAfterClassName() { + void testDotAfterClassName() { myFixture.configureByText("a.java", """ class A { { } @@ -463,7 +463,7 @@ class Foo { assert lookup } - public void testDotAfterClassNameInParameter() { + void testDotAfterClassNameInParameter() { myFixture.configureByText("a.java", """ class A { void foo() {} @@ -505,7 +505,7 @@ class Foo { checkArrow(IdeActions.ACTION_EDITOR_MOVE_CARET_DOWN, indexDown) } - public void "test vertical arrows in non-focused lookup"() { + void "test vertical arrows in non-focused lookup"() { String toType = "ArrayIndexOutOfBoundsException ind" testArrows toType, LookupImpl.FocusDegree.UNFOCUSED, 0, 1 @@ -518,7 +518,7 @@ class Foo { } } - public void "test vertical arrows in semi-focused lookup"() { + void "test vertical arrows in semi-focused lookup"() { CodeInsightSettings.instance.SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS = false UISettings.getInstance().SORT_LOOKUP_ELEMENTS_LEXICOGRAPHICALLY = true @@ -534,7 +534,7 @@ class Foo { } } - public void testHideOnOnePrefixVariant() { + void testHideOnOnePrefixVariant() { myFixture.configureByText("a.java", """ class A { Object foo() { return nu } @@ -544,7 +544,7 @@ class Foo { assert !lookup } - public void testResumeAfterBackspace() { + void testResumeAfterBackspace() { myFixture.configureByText("a.java", """ class A { Object foo() { this } @@ -560,7 +560,7 @@ class Foo { assert lookup } - public void testHideOnInvalidSymbolAfterBackspace() { + void testHideOnInvalidSymbolAfterBackspace() { myFixture.configureByText("a.java", """ class A { Object foo() { this } @@ -576,7 +576,7 @@ class Foo { assert !lookup } - public void testDoubleLiteralInField() { + void testDoubleLiteralInField() { myFixture.configureByText "a.java", """ public interface Test { double FULL = 1.0 @@ -585,7 +585,7 @@ public interface Test { assert !lookup } - public void testCancellingDuringCalculation() { + void testCancellingDuringCalculation() { myFixture.configureByText "a.java", """ class Aaaaaaa {} public interface Test { @@ -624,7 +624,7 @@ public interface Test { } } - public void testDuringCompletionMustFinish() { + void testDuringCompletionMustFinish() { registerContributor(LongReplacementOffsetContributor) runInEdtAndWait { myFixture.addFileToProject 'directory/foo.txt', '' } @@ -648,7 +648,7 @@ public interface Test { Disposer.register(parentDisposable, { ep.unregisterExtension(bean) } as Disposable) } - public void testLeftRightMovements() { + void testLeftRightMovements() { myFixture.configureByText("a.java", """ class Foo { void foo(String iterable) { @@ -688,7 +688,7 @@ public interface Test { assert !lookup } - public void testMulticaretLeftRightMovements() { + void testMulticaretLeftRightMovements() { myFixture.configureByText("a.java", """ class Foo { void foo(String iterable) { @@ -728,8 +728,8 @@ public interface Test { assert lookup assert !lookup.calculating } - - public void testMulticaretRightMovementWithOneCaretAtDocumentEnd() { + + void testMulticaretRightMovementWithOneCaretAtDocumentEnd() { myFixture.configureByText("a.java", """ class Foo { void foo(String iterable) { @@ -755,7 +755,7 @@ public interface Test { i""" } - public void testTypingInAnotherEditor() { + void testTypingInAnotherEditor() { myFixture.configureByText("a.java", "") type 'c' assert lookup @@ -798,7 +798,7 @@ public interface Test { } - public void testExplicitCompletionOnEmptyAutopopup() { + void testExplicitCompletionOnEmptyAutopopup() { myFixture.configureByText("a.java", "") type 'cccccc' myFixture.completeBasic() @@ -806,13 +806,13 @@ public interface Test { assert !lookup } - public void testNoSingleTemplateLookup() { + void testNoSingleTemplateLookup() { myFixture.configureByText 'a.java', 'class Foo { psv }' type 'm' assert !lookup : myFixture.lookupElementStrings } - public void testTemplatesWithNonImportedClasses() { + void testTemplatesWithNonImportedClasses() { CodeInsightSettings.instance.COMPLETION_CASE_SENSITIVE = CodeInsightSettings.NONE myFixture.addClass("package foo.bar; public class ToArray {}") try { @@ -827,7 +827,7 @@ public interface Test { } } - public void testTemplateSelectionBySpace() { + void testTemplateSelectionBySpace() { myFixture.configureByText("a.java", """ class Foo { int ITER = 2; @@ -842,7 +842,7 @@ class Foo { assert !myFixture.editor.document.text.contains('for ') } - public void testNewClassParenthesis() { + void testNewClassParenthesis() { CodeInsightSettings.instance.COMPLETION_CASE_SENSITIVE = CodeInsightSettings.NONE try { myFixture.configureByText("a.java", """ class Foo { { new } } """) @@ -854,13 +854,13 @@ class Foo { } } - public void testUnknownMethodParenthesis() { + void testUnknownMethodParenthesis() { myFixture.configureByText("a.java", """ class Foo { { } } """) type 'filinpstr(' assert myFixture.editor.document.text.contains('filinpstr()') } - public void testNoAutopopupAfterSpace() { + void testNoAutopopupAfterSpace() { myFixture.configureByText("a.java", """ class Foo { { int newa; } } """) runInEdtAndWait { myFixture.type('new ') } joinAutopopup() @@ -868,7 +868,7 @@ class Foo { assert !lookup } - public void testRestartAndTypingDuringCopyCommit() { + void testRestartAndTypingDuringCopyCommit() { registerContributor(LongReplacementOffsetContributor) myFixture.configureByText("a.java", """ class Foo { { int newa; } } """) @@ -884,7 +884,7 @@ class Foo { assert !lookup } - public void testAutoRestartAndTypingDuringCopyCommit() { + void testAutoRestartAndTypingDuringCopyCommit() { registerContributor(LongReplacementOffsetContributor) myFixture.configureByText("a.java", """ class Foo { { int iteraaa; } } """) @@ -900,7 +900,7 @@ class Foo { assert !lookup } - public void testChoosingItemDuringCopyCommit() { + void testChoosingItemDuringCopyCommit() { registerContributor(LongReplacementOffsetContributor) myFixture.configureByText("a.java", """ class Foo { { int iteraaa; } } """) @@ -913,7 +913,7 @@ class Foo { myFixture.checkResult(" class Foo { { int iteraaa; iteraaa. } } ") } - public void testRestartWithInvisibleLookup() { + void testRestartWithInvisibleLookup() { registerContributor(LongReplacementOffsetContributor) myFixture.configureByText("a.java", """ class Foo { { int abcdef; } } """) @@ -928,7 +928,7 @@ class Foo { assert lookup.shown } - public void testRestartWithVisibleLookup() { + void testRestartWithVisibleLookup() { registerContributor(LongContributor, LoadingOrder.FIRST) myFixture.configureByText("a.java", """ class Foo { { int abcdef, abcdefg; ab } } """) @@ -962,7 +962,7 @@ class Foo { joinCompletion() } - public void testEveryPossibleWayToTypeIf() { + void testEveryPossibleWayToTypeIf() { def src = "class Foo { { int ifa; } }" def result = "class Foo { { int ifa; if } }" int actions = 4 @@ -1038,7 +1038,7 @@ class Foo { } - public void testNonFinishedParameterComma() { + void testNonFinishedParameterComma() { myFixture.configureByText("a.java", """ class Foo { void foo(int aaa, int aaaaa) { } @@ -1050,25 +1050,25 @@ class Foo { assert myFixture.editor.document.text.contains('foo(aaa, )') } - public void testFinishedParameterComma() { + void testFinishedParameterComma() { myFixture.configureByText("a.java", """ class Foo { void foo(int aaa, int aaaaa) { foo() } } """) type 'aaa,' assert myFixture.editor.document.text.contains('foo(aaa,)') } - public void testNonFinishedVariableEq() { + void testNonFinishedVariableEq() { myFixture.configureByText("a.java", """ class Foo { void foo(int aaa, int aaaaa) { } } """) type 'a=' assert myFixture.editor.document.text.contains('aaa = ') } - public void testFinishedVariableEq() { + void testFinishedVariableEq() { myFixture.configureByText("a.java", """ class Foo { void foo(int aaa, int aaaaa) { } } """) type 'aaa=' assert myFixture.editor.document.text.contains('aaa=') } - public void testCompletionWhenLiveTemplateAreNotSufficient() { + void testCompletionWhenLiveTemplateAreNotSufficient() { TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable()); myFixture.configureByText("a.java", """ class Foo { @@ -1091,13 +1091,13 @@ class Foo { assert myFixture.editor.document.text.contains('asdf.') } - public void testNoWordCompletionAutoPopup() { + void testNoWordCompletionAutoPopup() { myFixture.configureByText "a.java", 'class Bar { void foo() { "f" }}' type 'o' assert !lookup } - public void testMethodNameRestart() { + void testMethodNameRestart() { myFixture.configureByText "a.java", ''' public class Bar { private static List getS @@ -1108,7 +1108,7 @@ public class Bar { assert !lookup } - public void testTargetElementInLookup() { + void testTargetElementInLookup() { myFixture.configureByText 'a.java', ''' class Foo { void x__foo() {} @@ -1120,14 +1120,14 @@ class Foo { ''' PsiClass cls = ApplicationManager.getApplication().runReadAction(new Computable() { @Override - public PsiClass compute() { + PsiClass compute() { return ((PsiJavaFile)myFixture.file).getClasses()[0]; } }); PsiMethod[] methods = ApplicationManager.getApplication().runReadAction(new Computable() { @Override - public PsiMethod[] compute() { + PsiMethod[] compute() { return cls.methods; } }) @@ -1150,7 +1150,7 @@ class Foo { } } - public void testExplicitAutocompletionAfterAutoPopup() { + void testExplicitAutocompletionAfterAutoPopup() { myFixture.configureByText 'a.java', 'class Foo ' type 'ext' @@ -1162,7 +1162,7 @@ class Foo { myFixture.checkResult 'class Foo extends ' } - public void testExplicitMultipleVariantCompletionAfterAutoPopup() { + void testExplicitMultipleVariantCompletionAfterAutoPopup() { myFixture.configureByText 'a.java', 'class Foo {}' type 'pr' @@ -1183,7 +1183,7 @@ class Foo { assert myFixture.lookupElementStrings.containsAll(['private', 'protected']) } - public void testExactMatchesFirst() { + void testExactMatchesFirst() { myFixture.configureByText("a.java", """ public class UTest { void nextWord() {} @@ -1196,7 +1196,7 @@ public class UTest { assert myFixture.lookupElementStrings == ['new', 'nextWord'] } - public void testExactMatchesTemplateFirst() { + void testExactMatchesTemplateFirst() { LiveTemplateCompletionContributor.setShowTemplatesInTests(true, getTestRootDisposable()) myFixture.configureByText("a.java", """ public class Test { @@ -1211,7 +1211,7 @@ public class Test { assert myFixture.lookup.currentItem instanceof LiveTemplateLookupElement } - public void testMoreRecentExactMatchesTemplateFirst() { + void testMoreRecentExactMatchesTemplateFirst() { TemplateManager manager = TemplateManager.getInstance(getProject()); Template template = manager.createTemplate("itar", "myGroup", null); JavaCodeContextType contextType = ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), JavaCodeContextType.Statement); @@ -1230,7 +1230,7 @@ public class Test { } - public void testUpdatePrefixMatchingOnTyping() { + void testUpdatePrefixMatchingOnTyping() { myFixture.addClass("class CertificateEncodingException {}") myFixture.addClass("class CertificateException {}") myFixture.configureByText 'a.java', 'class Foo {}' @@ -1238,14 +1238,14 @@ public class Test { assert myFixture.lookupElementStrings == ['CertificateException', 'CertificateEncodingException'] } - public void testNoClassesInUnqualifiedImports() { + void testNoClassesInUnqualifiedImports() { myFixture.addClass("package xxxxx; public class Xxxxxxxxx {}") myFixture.configureByText 'a.java', 'package foo; import ' type 'xxx' assert !lookup } - public void testPopupAfterDotAfterPackage() { + void testPopupAfterDotAfterPackage() { myFixture.configureByText 'a.java', '' type 'import jav' assert lookup @@ -1253,14 +1253,14 @@ public class Test { assert lookup } - public void testSamePrefixIgnoreCase() { + void testSamePrefixIgnoreCase() { myFixture.addClass("package xxxxx; public class SYSTEM_EXCEPTION {}") myFixture.configureByText "a.java", "import xxxxx.*; class Foo { S }" type 'Ystem' myFixture.assertPreferredCompletionItems 1, 'System', 'SYSTEM_EXCEPTION' } - public void testSamePrefixIgnoreCase2() { + void testSamePrefixIgnoreCase2() { myFixture.addClass("package xxxxx; public class SYSTEM_EXCEPTION {}") myFixture.addClass("package xxxxx; public class SYstem {}") myFixture.configureByText "a.java", "import xxxxx.*; class Foo { S }" @@ -1275,7 +1275,7 @@ public class Test { def old = manager.editorProvider manager.editorProvider = new CurrentEditorProvider() { @Override - public FileEditor getCurrentEditor() { + FileEditor getCurrentEditor() { return editor; } }; @@ -1283,7 +1283,7 @@ public class Test { return editor } - public void testAutopopupTypingUndo() { + void testAutopopupTypingUndo() { myFixture.configureByText "a.java", "class Foo {{ }}" def editor = openEditorForUndo(); type 'aioobeeee' @@ -1291,19 +1291,19 @@ public class Test { assert !myFixture.editor.document.text.contains('aioo') } - public void testNoLiveTemplatesAfterDot() { + void testNoLiveTemplatesAfterDot() { myFixture.configureByText "a.java", "import java.util.List; class Foo {{ List t; t. }}" type 'toar' assert myFixture.lookupElementStrings == ['toArray', 'toArray'] } - public void testTypingFirstVarargDot() { + void testTypingFirstVarargDot() { myFixture.configureByText "a.java", "class Foo { void foo(Foo[] a) { }; class Bar {}}" type '.' assert !lookup } - public void testMulticaret() { + void testMulticaret() { doTestMulticaret """ class Foo {{ tx; @@ -1315,7 +1315,7 @@ class Foo {{ }}''' } - public void testMulticaretTab() { + void testMulticaretTab() { doTestMulticaret """ class Foo {{ tx; @@ -1327,7 +1327,7 @@ class Foo {{ }}''' } - public void testMulticaretBackspace() { + void testMulticaretBackspace() { doTestMulticaret """ class Foo {{ t; @@ -1347,14 +1347,14 @@ class Foo {{ myFixture.checkResult textAfter } - public void "test two non-imported classes when space selects first autopopup item"() { + void "test two non-imported classes when space selects first autopopup item"() { myFixture.addClass("package foo; public class Abcdefg {}") myFixture.configureByText 'a.java', 'class Foo extends ' type 'Abcde ' myFixture.checkResult 'import foo.Abcdefg;\n\nclass Foo extends Abcdefg ' } - public void "test two non-imported classes when space does not select first autopopup item"() { + void "test two non-imported classes when space does not select first autopopup item"() { CodeInsightSettings.instance.SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS = false myFixture.addClass("package foo; public class Abcdefg {}") @@ -1369,7 +1369,7 @@ class Foo {{ class Foo extends Abcdefg ''' } - public void testTwoNonImportedClasses_() { + void testTwoNonImportedClasses_() { myFixture.addClass("package foo; public class Abcdefg {}") myFixture.addClass("package bar; public class Abcdefg {}") myFixture.configureByText 'a.java', 'class Foo extends ' @@ -1377,7 +1377,7 @@ class Foo extends Abcdefg ''' assert lookup.items.size() == 2 } - public void testClassNameInProperties() { + void testClassNameInProperties() { myFixture.addClass("package java.langa; public class Abcdefg {}") myFixture.configureByText 'a.properties', 'key.11=java' type '.' @@ -1392,7 +1392,7 @@ class Foo extends Abcdefg ''' assert 'io' in myFixture.lookupElementStrings } - public void testEnteringLabel() { + void testEnteringLabel() { myFixture.configureByText 'a.java', '''class Foo {{ }} @@ -1401,7 +1401,7 @@ class Foo extends Abcdefg ''' assert myFixture.editor.document.text.contains('FIS:') } - public void testSoutvTemplate() { + void testSoutvTemplate() { TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable()); myFixture.configureByText 'a.java', 'class Foo {{ }}' type 'soutv\tgetcl.' @@ -1411,13 +1411,13 @@ class Foo {{ }}''' } - public void testReturnLParen() { + void testReturnLParen() { myFixture.configureByText 'a.java', 'class Foo { int foo() { }}' type 're(' myFixture.checkResult 'class Foo { int foo() { re() }}' } - public void testAmbiguousClassQualifier() { + void testAmbiguousClassQualifier() { myFixture.addClass("package foo; public class Util { public static void foo() {} public static final int CONSTANT = 2; }") myFixture.addClass("package bar; public class Util { public static void bar() {} }") myFixture.configureByText 'a.java', 'class Foo {{ Util }}' @@ -1437,7 +1437,7 @@ class Foo {{ Util.foo(); }}''' } - public void testPackageQualifier() { + void testPackageQualifier() { CodeInsightSettings.instance.SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS = false myFixture.addClass("package com.too; public class Util {}") @@ -1446,7 +1446,7 @@ class Foo {{ assert myFixture.lookupElementStrings.containsAll(['too', 'command.toString']) } - public void testUnfinishedString() { + void testUnfinishedString() { myFixture.configureByText 'a.java', ''' // Date class Foo { @@ -1458,7 +1458,7 @@ class Foo { assert !lookup } - public void testVarargParenthesis() { + void testVarargParenthesis() { myFixture.configureByText 'a.java', ''' class Foo { void foo(File... files) { } @@ -1469,7 +1469,7 @@ class Foo { assert myFixture.editor.document.text.contains('new File()') } - public void "test inaccessible class in another package shouldn't prevent choosing by space"() { + void "test inaccessible class in another package shouldn't prevent choosing by space"() { myFixture.addClass("package foo; class b {}") myFixture.configureByText 'a.java', 'class Foo {{ }}' type 'b' @@ -1493,7 +1493,7 @@ class Foo { super.tearDown() } - public void testBackspaceShouldShowPreviousVariants() { + void testBackspaceShouldShowPreviousVariants() { CodeInsightSettings.instance.COMPLETION_CASE_SENSITIVE = CodeInsightSettings.NONE myFixture.configureByText 'a.java', 'class Foo{ void foo(int itera, int itex) { it }}' type 'e' @@ -1504,7 +1504,7 @@ class Foo { myFixture.assertPreferredCompletionItems 0, 'itera', 'itex' } - public void testBackspaceUntilDot() { + void testBackspaceUntilDot() { myFixture.configureByText 'a.java', 'class Foo{ void foo(String s) { s }}' type '.sub' assert myFixture.lookupElementStrings @@ -1514,7 +1514,7 @@ class Foo { assert !lookup } - public void testReplaceTypedPrefixPart() { + void testReplaceTypedPrefixPart() { ((StatisticsManagerImpl)StatisticsManager.getInstance()).enableStatistics(getTestRootDisposable()); myFixture.configureByText 'a.java', 'class Foo{ { }}' for (i in 0..StatisticsManager.OBLIVION_THRESHOLD) { @@ -1526,7 +1526,7 @@ class Foo { assert myFixture.editor.document.text.contains('.println();2') } - public void testQuickBackspaceEnter() { + void testQuickBackspaceEnter() { myFixture.configureByText 'a.java', '' type 'cl' assert myFixture.lookupElementStrings == ['class'] @@ -1546,7 +1546,7 @@ class Foo { myTester.joinAutopopup() } - public void "test new primitive array in Object variable"() { + void "test new primitive array in Object variable"() { CodeInsightSettings.instance.COMPLETION_CASE_SENSITIVE = CodeInsightSettings.NONE myFixture.configureByText 'a.java', ''' class Foo { @@ -1568,7 +1568,7 @@ class Foo { ''' } - public void "test middle matching and overwrite"() { + void "test middle matching and overwrite"() { myFixture.configureByText 'a.java', ''' class ListConfigKey { void foo() { @@ -1587,7 +1587,7 @@ class ListConfigKey { } - public void testPreselectMostRelevantInTheMiddleAlpha() { + void testPreselectMostRelevantInTheMiddleAlpha() { UISettings.getInstance().SORT_LOOKUP_ELEMENTS_LEXICOGRAPHICALLY = true; CodeInsightSettings.instance.SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS = false @@ -1607,7 +1607,7 @@ class Foo { myFixture.assertPreferredCompletionItems 0, 'setHorizontalText', 'setText' } - public void "test pressing enter while autopopup is calculating variants should cancel autopopup"() { + void "test pressing enter while autopopup is calculating variants should cancel autopopup"() { registerContributor(LongContributor, LoadingOrder.FIRST) myFixture.configureByText "a.java", "class Foo {{ }}" myFixture.type('a') @@ -1616,7 +1616,7 @@ class Foo { assert !lookup } - public void "test pressing enter and a letter while autopopup is calculating variants should restart autopopup"() { + void "test pressing enter and a letter while autopopup is calculating variants should restart autopopup"() { registerContributor(LongContributor, LoadingOrder.FIRST) myFixture.configureByText "a.java", "class Foo {{ }}" myFixture.type('a') @@ -1626,7 +1626,7 @@ class Foo { assert lookup } - public void "test a random write action shouldn't cancel autopopup"() { + void "test a random write action shouldn't cancel autopopup"() { registerContributor(LongContributor, LoadingOrder.FIRST) myFixture.configureByText "a.java", "class Foo {{ }}" myFixture.type('a') @@ -1636,7 +1636,7 @@ class Foo { assert lookup } - public void "test typing during restart commit document"() { + void "test typing during restart commit document"() { def longText = "\nfoo(); bar();" * 100 myFixture.configureByText "a.java", "class Foo { void foo(int ab, int abde) { ; $longText }}" myFixture.type('a') @@ -1648,7 +1648,7 @@ class Foo { assert !lookup } - public void "test no name autopopup in live template"() { + void "test no name autopopup in live template"() { TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable()); myFixture.configureByText 'a.java', '''class F { String nameContainingIdentifier; @@ -1668,7 +1668,7 @@ class Foo { assert !lookup } - public void "test template prefix is better than middle matches"() { + void "test template prefix is better than middle matches"() { myFixture.configureByText "a.java", """ class Cls { void foo() { @@ -1681,7 +1681,7 @@ class Cls { myFixture.assertPreferredCompletionItems 0, 'sout', 'mySout' } - public void "test single overriding getter"() { + void "test single overriding getter"() { myFixture.configureByText "a.java", """ public class Foo { public int getField() {} @@ -1697,7 +1697,7 @@ class X extends Foo { assert myFixture.lookupElementStrings == ['public int getField'] } - public void "test live template quick doc"() { + void "test live template quick doc"() { myFixture.configureByText "a.java", """ class Cls { void foo() { @@ -1716,7 +1716,7 @@ class Cls { assert docProvider.generateDoc(docElement, docElement).contains('System.out') } - public void "test finishing class reference property value completion with dot opens autopopup"() { + void "test finishing class reference property value completion with dot opens autopopup"() { myFixture.configureByText "a.properties", "myprop=ja" type 'v' myFixture.assertPreferredCompletionItems 0, 'java' @@ -1726,7 +1726,7 @@ class Cls { assert lookup } - public void "test live template without description"() { + void "test live template without description"() { final TemplateManager manager = TemplateManager.getInstance(getProject()); final Template template = manager.createTemplate("tpl", "user", null); final JavaCodeContextType contextType = @@ -1751,7 +1751,7 @@ class Foo { assert p.typeText == " [$tabKeyPresentation] " } - public void "test autopopup after package completion"() { + void "test autopopup after package completion"() { myFixture.addClass("package foo.bar.goo; class Foo {}") myFixture.configureByText "a.java", "class Foo { { foo.b } }" assert myFixture.completeBasic() == null @@ -1762,7 +1762,7 @@ class Foo { assert myFixture.lookupElementStrings == ['goo'] } - public void "test in column selection mode"() { + void "test in column selection mode"() { myFixture.configureByText "a.java", """ class Foo {{ @@ -1771,8 +1771,8 @@ class Foo {{ type 'toStr' assert lookup } - - public void "test show popup with single live template if show_live_tempate_in_completion option is enabled"() { + + void "test show popup with single live template if show_live_tempate_in_completion option is enabled"() { LiveTemplateCompletionContributor.setShowTemplatesInTests(false, getTestRootDisposable()) myFixture.configureByText "a.java", """ class Foo {{ diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavadocCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavadocCompletionTest.groovy index abc3726aa774..7c81092c86de 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavadocCompletionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavadocCompletionTest.groovy @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.codeInsight.completion import com.intellij.JavaTestUtil import com.intellij.codeInsight.CodeInsightSettings @@ -21,7 +36,7 @@ import org.jetbrains.annotations.NotNull /** * @author mike */ -public class JavadocCompletionTest extends LightFixtureCompletionTestCase { +class JavadocCompletionTest extends LightFixtureCompletionTestCase { private CodeStyleSettings settings private JavaCodeStyleSettings javaSettings @@ -44,63 +59,63 @@ public class JavadocCompletionTest extends LightFixtureCompletionTestCase { myFixture.enableInspections(new JavaDocLocalInspection()); } - public void testNamesInPackage() throws Exception { + void testNamesInPackage() throws Exception { myFixture.configureFromExistingVirtualFile(myFixture.copyFileToProject("package-info.java", "p/package-info.java")); complete(); assertStringItems("author", 'author ' + SystemProperties.getUserName(), "deprecated", "see", "since", "version") } - public void testNamesInClass() throws Exception { + void testNamesInClass() throws Exception { configureByFile("ClassTagName.java"); assertStringItems("author", 'author ' + SystemProperties.getUserName(), "deprecated", "param", "see", "serial", "since", "version"); } - public void testNamesInField() throws Exception { + void testNamesInField() throws Exception { configureByFile("FieldTagName.java"); assertStringItems("deprecated", "see", "serial", "serialField", "since"); } - public void testNamesInMethod0() throws Exception { + void testNamesInMethod0() throws Exception { configureByFile("MethodTagName0.java"); assertStringItems("deprecated", "exception", "param", "return", "see", "serialData", "since", "throws"); } - public void testNamesInMethod1() throws Exception { + void testNamesInMethod1() throws Exception { configureByFile("MethodTagName1.java"); assertStringItems("see", "serialData", "since", "throws"); } - public void testParamValueCompletion() throws Exception { + void testParamValueCompletion() throws Exception { configureByFile("ParamValue0.java"); assertStringItems("a", "b", "c"); } - public void testParamValueWithPrefixCompletion() throws Exception { + void testParamValueWithPrefixCompletion() throws Exception { configureByFile("ParamValue1.java"); assertStringItems("a1", "a2", "a3"); } - public void testDescribedParameters() throws Exception { + void testDescribedParameters() throws Exception { configureByFile("ParamValue2.java"); assertStringItems("a2", "a3"); } - public void testSee0() throws Exception { + void testSee0() throws Exception { configureByFile("See0.java"); myFixture.assertPreferredCompletionItems(0, "foo", "clone", "equals", "hashCode"); } - public void testSee1() throws Exception { + void testSee1() throws Exception { configureByFile("See1.java"); assertStringItems("notify", "notifyAll"); } - public void testSee2() throws Exception { + void testSee2() throws Exception { configureByFile("See2.java"); assertStringItems("notify", "notifyAll"); } - public void testSee3() throws Exception { + void testSee3() throws Exception { configureByFile("See3.java"); assertTrue(getLookupElementStrings().containsAll(Arrays.asList("foo", "myField"))); @@ -111,46 +126,46 @@ public class JavadocCompletionTest extends LightFixtureCompletionTestCase { return ObjectUtils.assertNotNull(myFixture.getLookupElementStrings()); } - public void testSee4() throws Exception { + void testSee4() throws Exception { configureByFile("See4.java"); assertTrue(getLookupElementStrings().containsAll(Arrays.asList("A", "B", "C"))); } - public void testSee5() throws Exception { + void testSee5() throws Exception { configureByFile("See5.java"); assertTrue(getLookupElementStrings().containsAll(Arrays.asList("foo", "myName"))); } - public void testIDEADEV10620() throws Exception { + void testIDEADEV10620() throws Exception { configureByFile("IDEADEV10620.java"); checkResultByFile("IDEADEV10620-after.java"); } - public void testException0() throws Exception { + void testException0() throws Exception { configureByFile("Exception0.java"); assertStringItems("deprecated", "exception", "param", "see", "serialData", "since", "throws"); } - public void testException1() throws Exception { + void testException1() throws Exception { configureByFile("Exception1.java"); assertTrue(myItems.length > 18); } - public void testException2() throws Exception { + void testException2() throws Exception { myFixture.configureByFile("Exception2.java"); myFixture.complete(CompletionType.SMART); assertStringItems("IllegalStateException", "IOException"); } - public void testInlineLookup() throws Exception { + void testInlineLookup() throws Exception { configureByFile("InlineTagName.java"); assertStringItems("code", "docRoot", "inheritDoc", "link", "linkplain", "literal", "value"); } - public void testFinishWithSharp() throws Throwable { + void testFinishWithSharp() throws Throwable { boolean old = CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION; CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION = false; try { @@ -171,32 +186,33 @@ public class JavadocCompletionTest extends LightFixtureCompletionTestCase { assertEquals("foo", items.get(1).getLookupString()); } - public void testShortenClassName() throws Throwable { + void testShortenClassName() throws Throwable { javaSettings.CLASS_NAMES_IN_JAVADOC = JavaCodeStyleSettings.SHORTEN_NAMES_ALWAYS_AND_ADD_IMPORT; doTest(); } - public void testMethodBeforeSharp() throws Throwable { + void testMethodBeforeSharp() throws Throwable { doTest(); } - public void testFieldReferenceInInnerClassJavadoc() throws Throwable { + void testFieldReferenceInInnerClassJavadoc() throws Throwable { doTest(); } - public void testShortenClassReference() throws Throwable { + void testShortenClassReference() throws Throwable { javaSettings.CLASS_NAMES_IN_JAVADOC = JavaCodeStyleSettings.SHORTEN_NAMES_ALWAYS_AND_ADD_IMPORT doTest() } - public void testQualifiedClassReference() throws Throwable { + + void testQualifiedClassReference() throws Throwable { configureByFile(getTestName(false) + ".java"); myFixture.complete(CompletionType.BASIC, 2); checkResultByFile(getTestName(false) + "_after.java"); } - public void testQualifiedImportedClassReference() throws Throwable { doTest() } + void testQualifiedImportedClassReference() throws Throwable { doTest() } - public void testThrowsNonImported() throws Throwable { + void testThrowsNonImported() throws Throwable { configureByFile(getTestName(false) + ".java"); myFixture.complete(CompletionType.BASIC, 2); checkResultByFile(getTestName(false) + "_after.java"); @@ -207,18 +223,18 @@ public class JavadocCompletionTest extends LightFixtureCompletionTestCase { checkResultByFile(getTestName(false) + "_after.java"); } - public void testInlinePackageReferenceCompletion() throws Exception { + void testInlinePackageReferenceCompletion() throws Exception { configureByFile("InlineReference.java"); assertTrue(getLookupElementStrings().containsAll(Arrays.asList("io", "lang", "util"))); } - public void testQualifyClassReferenceInPackageStatement() throws Exception { + void testQualifyClassReferenceInPackageStatement() throws Exception { configureByFile(getTestName(false) + ".java"); myFixture.type('\n'); checkResultByFile(getTestName(false) + "_after.java"); } - public void "test suggest param names"() { + void "test suggest param names"() { myFixture.configureByText "a.java", ''' class Foo { /** @@ -235,7 +251,7 @@ class Foo { myFixture.assertPreferredCompletionItems 0, 'param', 'param param2' } - public void "test fqns in package info"() { + void "test fqns in package info"() { myFixture.configureByText "package-info.java", ''' /** * {@link java.util.Map#putA} @@ -249,7 +265,7 @@ class Foo { ''' } - public void "test suggest same param descriptions"() { + void "test suggest same param descriptions"() { myFixture.configureByText "a.java", ''' class Foo { /** @@ -283,7 +299,7 @@ class Foo { ''' } - public void "test suggest same param descriptions with no text after param name"() { + void "test suggest same param descriptions with no text after param name"() { myFixture.configureByText "a.java", ''' class Foo { /** @@ -302,7 +318,7 @@ class Foo { myFixture.assertPreferredCompletionItems 0, 'some integer param' } - public void "test see super class"() { + void "test see super class"() { myFixture.addClass("package foo; public interface Foo {}") myFixture.addClass("package bar; public class Bar {} ") myFixture.configureByText "a.java", ''' @@ -318,7 +334,7 @@ class Impl extends Bar implements Foo {} myFixture.assertPreferredCompletionItems 0, 'see', 'see bar.Bar', 'see foo.Foo' } - public void testShortenMethodParameterTypes() { + void testShortenMethodParameterTypes() { javaSettings.CLASS_NAMES_IN_JAVADOC = JavaCodeStyleSettings.SHORTEN_NAMES_ALWAYS_AND_ADD_IMPORT myFixture.addClass("package foo; public class Foo {}") myFixture.addClass("package bar; public class Bar {}") @@ -335,7 +351,7 @@ class Goo { void goo(Foo foo, Bar bar) {} } assert myFixture.editor.document.text.contains('@link #goo(Foo, Bar)') } - public void testNoMethodsAfterClassDot() { + void testNoMethodsAfterClassDot() { def text = ''' /** * @see java.util.List. @@ -346,8 +362,8 @@ class Goo { void goo(Foo foo, Bar bar) {} } assert !myFixture.completeBasic() myFixture.checkResult(text) } - - public void testShortNameInJavadocIfWasImported() { + + void testShortNameInJavadocIfWasImported() { javaSettings.CLASS_NAMES_IN_JAVADOC = JavaCodeStyleSettings.FULLY_QUALIFY_NAMES_IF_NOT_IMPORTED def text = ''' import java.util.Map; @@ -372,7 +388,7 @@ class Test { ''' } - public void testFqnInJavadocIfWasNotImported() { + void testFqnInJavadocIfWasNotImported() { javaSettings.CLASS_NAMES_IN_JAVADOC = JavaCodeStyleSettings.FULLY_QUALIFY_NAMES_IF_NOT_IMPORTED def text = ''' import java.util.Map; @@ -398,7 +414,7 @@ class Test { } - public void testFqnNameInJavadocIfWasImported() { + void testFqnNameInJavadocIfWasImported() { javaSettings.CLASS_NAMES_IN_JAVADOC = JavaCodeStyleSettings.FULLY_QUALIFY_NAMES_ALWAYS def text = ''' import java.util.Map; @@ -423,7 +439,7 @@ class Test { ''' } - public void testShortNameInJavadoc() { + void testShortNameInJavadoc() { javaSettings.CLASS_NAMES_IN_JAVADOC = JavaCodeStyleSettings.SHORTEN_NAMES_ALWAYS_AND_ADD_IMPORT def text = ''' import java.util.Map; @@ -448,7 +464,7 @@ class Test { ''' } - public void testShortNameInJavadocIfWasImportOnDemand() { + void testShortNameInJavadocIfWasImportOnDemand() { javaSettings.CLASS_NAMES_IN_JAVADOC = JavaCodeStyleSettings.FULLY_QUALIFY_NAMES_IF_NOT_IMPORTED def text = ''' import java.util.*; @@ -473,7 +489,7 @@ class Test { ''' } - public void testNullQualifiedName() { + void testNullQualifiedName() { def text = ''' public class Test { @@ -509,8 +525,8 @@ public class Test { ''' } - - public void testShortNameIfImplicitlyImported() { + + void testShortNameIfImplicitlyImported() { javaSettings.CLASS_NAMES_IN_JAVADOC = JavaCodeStyleSettings.FULLY_QUALIFY_NAMES_IF_NOT_IMPORTED def text = ''' /** @@ -531,7 +547,7 @@ class Test { ''' } - public void testShortNameIfInnerClass() { + void testShortNameIfInnerClass() { javaSettings.CLASS_NAMES_IN_JAVADOC = JavaCodeStyleSettings.FULLY_QUALIFY_NAMES_IF_NOT_IMPORTED def text = ''' package pkg; @@ -566,23 +582,23 @@ class Foo { ''' } - public void testCustomReferenceProvider() throws Exception { + void testCustomReferenceProvider() throws Exception { PsiReferenceRegistrarImpl registrar = (PsiReferenceRegistrarImpl) ReferenceProvidersRegistry.getInstance().getRegistrar(StdLanguages.JAVA); PsiReferenceProvider provider = new PsiReferenceProvider() { @Override @NotNull - public PsiReference[] getReferencesByElement(@NotNull final PsiElement element, @NotNull final ProcessingContext context) { + PsiReference[] getReferencesByElement(@NotNull final PsiElement element, @NotNull final ProcessingContext context) { def ref = new PsiReferenceBase(element) { @Override - public PsiElement resolve() { + PsiElement resolve() { return element; } @Override @NotNull - public Object[] getVariants() { + Object[] getVariants() { return ["1", "2", "3"] } } @@ -599,7 +615,7 @@ class Foo { } } - public void "test complete author name"() { + void "test complete author name"() { def userName = SystemProperties.userName assert userName myFixture.configureByText 'a.java', "/** @author */" @@ -608,46 +624,46 @@ class Foo { myFixture.checkResult "/** @author $userName */" } - public void "test insert link to class"() { + void "test insert link to class"() { myFixture.configureByText 'a.java', "/** FileNotFoEx */" myFixture.completeBasic() myFixture.checkResult "/** {@link java.io.FileNotFoundException} */" } - public void "test insert link to inner class"() { + void "test insert link to inner class"() { myFixture.addClass('package zoo; public class Outer { public static class FooBarGoo{}}') myFixture.configureByText 'a.java', "/** FooBarGo */" myFixture.completeBasic() myFixture.checkResult "/** {@link zoo.Outer.FooBarGoo} */" } - public void "test insert link to imported class"() { + void "test insert link to imported class"() { myFixture.configureByText 'a.java', "import java.io.*; /** FileNotFoEx */ class A{}" myFixture.completeBasic() myFixture.checkResult "import java.io.*; /** {@link FileNotFoundException} */ class A{}" } - public void "test insert link to method"() { + void "test insert link to method"() { myFixture.configureByText 'a.java', "/** a. #fo */ interface Foo { void foo(int a); }}" myFixture.completeBasic() myFixture.type('\n') myFixture.checkResult "/** a. {@link #foo(int)} */ interface Foo { void foo(int a); }}" } - public void "test insert link to field"() { + void "test insert link to field"() { myFixture.configureByText 'a.java', "/** a. #fo */ interface Foo { int foo; }}" myFixture.completeBasic() myFixture.type('\n') myFixture.checkResult "/** a. {@link #foo} */ interface Foo { int foo; }}" } - public void "test wrap null into code tag"() { + void "test wrap null into code tag"() { myFixture.configureByText 'a.java', "/** nul */" myFixture.completeBasic() myFixture.checkResult "/** {@code null} */" } - public void "test completing inside qualified name"() { + void "test completing inside qualified name"() { myFixture.configureByText 'a.java', "/** @see java.io. */" myFixture.completeBasic() myFixture.lookup.currentItem = myFixture.lookupElements.find { it.lookupString == 'IOException' } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/MagicConstantCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/MagicConstantCompletionTest.groovy index fcdd3a794120..ff1b26a23470 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/MagicConstantCompletionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/MagicConstantCompletionTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase */ class MagicConstantCompletionTest extends LightCodeInsightFixtureTestCase { - public void "test in method argument"() { + void "test in method argument"() { addModifierList() myFixture.configureByText "a.java", """ class Foo { @@ -37,7 +37,7 @@ class Foo { myFixture.assertPreferredCompletionItems 0, 'PROTECTED', 'PUBLIC' } - public void "test nothing after dot"() { + void "test nothing after dot"() { addModifierList() myFixture.configureByText "a.java", """ class Foo { @@ -49,7 +49,7 @@ class Foo { assert !myFixture.complete(CompletionType.SMART) } - public void "test magic constant in equality"() { + void "test magic constant in equality"() { addMagicConstant() myFixture.configureByText "a.java", """ @@ -75,7 +75,7 @@ interface Foo { myFixture.assertPreferredCompletionItems 0, 'BAR', 'FOO' } - public void "test magic constant in equality before another equality"() { + void "test magic constant in equality before another equality"() { addMagicConstant() myFixture.configureByText "a.java", """ diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/Normal17CompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/Normal17CompletionTest.groovy index aa8ecaa28156..c7c946aa938f 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/Normal17CompletionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/Normal17CompletionTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ import com.intellij.JavaTestUtil import com.intellij.testFramework.LightProjectDescriptor import org.jetbrains.annotations.NotNull -public class Normal17CompletionTest extends LightFixtureCompletionTestCase { +class Normal17CompletionTest extends LightFixtureCompletionTestCase { @Override protected String getBasePath() { return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/completion/normal/" @@ -31,19 +31,25 @@ public class Normal17CompletionTest extends LightFixtureCompletionTestCase { return JAVA_LATEST } - public void testOnlyExceptionsInMultiCatch1() { doTest() } - public void testOnlyExceptionsInMultiCatch2() { doTest() } + void testOnlyExceptionsInMultiCatch1() { doTest() } - public void testOnlyResourcesInResourceList1() { doTest() } - public void testOnlyResourcesInResourceList2() { doTest() } - public void testOnlyResourcesInResourceList3() { doTest() } - public void testOnlyResourcesInResourceList4() { doTest() } - public void testOnlyResourcesInResourceList5() { doTest() } + void testOnlyExceptionsInMultiCatch2() { doTest() } - public void testMethodReferenceNoStatic() { doTest() } - public void testMethodReferenceCallContext() { doTest() } + void testOnlyResourcesInResourceList1() { doTest() } - public void testResourceParentInResourceList() { + void testOnlyResourcesInResourceList2() { doTest() } + + void testOnlyResourcesInResourceList3() { doTest() } + + void testOnlyResourcesInResourceList4() { doTest() } + + void testOnlyResourcesInResourceList5() { doTest() } + + void testMethodReferenceNoStatic() { doTest() } + + void testMethodReferenceCallContext() { doTest() } + + void testResourceParentInResourceList() { configureByFile(getTestName(false) + ".java") assert 'MyOuterResource' == myFixture.lookupElementStrings[0] assert 'MyClass' in myFixture.lookupElementStrings @@ -57,7 +63,7 @@ public class Normal17CompletionTest extends LightFixtureCompletionTestCase { checkResultByFile(getTestName(false) + "_after.java") } - public void testAfterTryWithResources() { + void testAfterTryWithResources() { configureByFile(getTestName(false) + ".java") def strings = myFixture.lookupElementStrings assert strings.containsAll(['final', 'finally', 'int', 'Util']) diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/Normal8CompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/Normal8CompletionTest.groovy index e6428ea3733f..6175a1567fa5 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/Normal8CompletionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/Normal8CompletionTest.groovy @@ -22,16 +22,16 @@ import com.intellij.testFramework.LightProjectDescriptor /** * @author anna */ -public class Normal8CompletionTest extends LightFixtureCompletionTestCase { +class Normal8CompletionTest extends LightFixtureCompletionTestCase { final LightProjectDescriptor projectDescriptor = JAVA_8 final String basePath = JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/daemonCodeAnalyzer/lambda/completion/normal/" - public void testSelfStaticsOnly() { + void testSelfStaticsOnly() { configureByFile("SelfStaticsOnly.java"); assertStringItems("ba", "bar"); } - public void testFinishWithColon() { + void testFinishWithColon() { myFixture.configureByText "a.java", """ class Foo {{ Object o = Fox }} """ @@ -42,7 +42,7 @@ class Foo {{ Object o = Foo::x }} """ } - public void testNoSuggestionsAfterMethodReferenceAndDot() { + void testNoSuggestionsAfterMethodReferenceAndDot() { String text = """ class Foo {{ Object o = StringBuilder::append. }} """ @@ -51,7 +51,7 @@ class Foo {{ Object o = StringBuilder::append. }} myFixture.checkResult(text) } - public void "test suggest lambda signature"() { + void "test suggest lambda signature"() { myFixture.configureByText "a.java", """ interface I { void m(int x); @@ -66,7 +66,7 @@ class Test { assert LookupElementPresentation.renderElement(items[0]).itemText == 'x1 -> {}' } - public void "test lambda signature duplicate parameter name"() { + void "test lambda signature duplicate parameter name"() { myFixture.configureByText "a.java", """ import java.util.function.Function; @@ -92,7 +92,7 @@ class InterestingClass {} assert LookupElementPresentation.renderElement(items[0]).itemText == 'interestingClass -> {}' } - public void "test suggest this method references"() { + void "test suggest this method references"() { myFixture.configureByText "a.java", """ interface I { void m(int x); @@ -109,7 +109,7 @@ class Test { assert items.find { LookupElementPresentation.renderElement(it).itemText.contains('this::bar') } != null } - public void "test suggest receiver method reference"() { + void "test suggest receiver method reference"() { myFixture.configureByText "a.java", """ class MethodRef { @@ -131,7 +131,7 @@ class MethodRef { assert items.find {LookupElementPresentation.renderElement(it).itemText.contains('MethodRef::boo')} } - public void "test constructor ref"() { + void "test constructor ref"() { myFixture.configureByText "a.java", """ interface Foo9 { Bar test(int p); @@ -167,12 +167,12 @@ class Test88 { """ } - public void testInheritorConstructorRef() { + void testInheritorConstructorRef() { configureByTestName() myFixture.assertPreferredCompletionItems 0, 'ArrayList::new', 'ArrayList' } - public void "test constructor ref without start"() { + void "test constructor ref without start"() { myFixture.configureByText "a.java", """ interface Foo9 { Bar test(int p); @@ -191,8 +191,8 @@ class Test88 { def items = myFixture.completeBasic() assert items.find {LookupElementPresentation.renderElement(it).itemText.contains('Bar::new')} } - - public void "test new array ref"() { + + void "test new array ref"() { myFixture.configureByText "a.java", """ interface Foo9 { T test(int p); @@ -208,53 +208,55 @@ class Test88 { assert items.find {LookupElementPresentation.renderElement(it).itemText.contains('String[]::new')} } - public void testCollectorsToList() { + void testCollectorsToList() { configureByTestName() selectItem(myItems.find { it.lookupString.contains('toList') }) checkResultByFile(getTestName(false) + "_after.java") } - public void testStaticallyImportedCollectorsToList() { + void testStaticallyImportedCollectorsToList() { configureByTestName() selectItem(myItems.find { it.lookupString.contains('collect(toList())') }) checkResultByFile(getTestName(false) + "_after.java") } - public void testAllCollectors() { + void testAllCollectors() { configureByTestName() myFixture.assertPreferredCompletionItems 0, 'collect', 'collect', 'collect(Collectors.toCollection())', 'collect(Collectors.toList())', 'collect(Collectors.toSet())' selectItem(myItems.find { it.lookupString.contains('toCollection') }) checkResultByFile(getTestName(false) + "_after.java") } - public void testCollectorsToSet() { + void testCollectorsToSet() { configureByTestName() selectItem(myItems.find { it.lookupString.contains('toSet') }) checkResultByFile(getTestName(false) + "_after.java") } - public void testNoExplicitTypeArgsInTernary() { + void testNoExplicitTypeArgsInTernary() { configureByTestName() selectItem(myItems.find { it.lookupString.contains('empty') }) checkResultByFile(getTestName(false) + "_after.java") } - public void testCallBeforeLambda() { + void testCallBeforeLambda() { configureByTestName() checkResultByFile(getTestName(false) + "_after.java") } - public void testLambdaInAmbiguousCall() { + void testLambdaInAmbiguousCall() { configureByTestName() myFixture.assertPreferredCompletionItems(0, 'toString', 'wait') } - public void testLambdaWithSuperWildcardInAmbiguousCall() { + void testLambdaWithSuperWildcardInAmbiguousCall() { configureByTestName() myFixture.assertPreferredCompletionItems(0, 'substring', 'substring', 'subSequence') } - public void testUnexpectedLambdaInAmbiguousCall() { doAntiTest() } - public void testNoCollectorsInComment() { doAntiTest() } - public void testNoContinueInsideLambdaInLoop() { doAntiTest(); } + void testUnexpectedLambdaInAmbiguousCall() { doAntiTest() } + + void testNoCollectorsInComment() { doAntiTest() } + + void testNoContinueInsideLambdaInLoop() { doAntiTest(); } } \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionDfaTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionDfaTest.groovy index 219c8a821877..5be8861464e6 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionDfaTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionDfaTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,7 +68,8 @@ public class FooImpl extends Foo { checkResultByFile(getTestName(false) + "_after.java") } - public void testCastInstanceofedQualifierInLambda() { doTest() } - public void testCastInstanceofedQualifierInLambda2() { doTest() } + void testCastInstanceofedQualifierInLambda() { doTest() } + + void testCastInstanceofedQualifierInLambda2() { doTest() } } 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 21ad3efae894..d11492697482 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,10 +30,10 @@ import com.intellij.psi.PsiMethod import com.intellij.psi.statistics.StatisticsManager import com.intellij.ui.JBColor -public class NormalCompletionOrderingTest extends CompletionSortingTestCase { +class NormalCompletionOrderingTest extends CompletionSortingTestCase { private static final String BASE_PATH = "/codeInsight/completion/normalSorting"; - public NormalCompletionOrderingTest() { + NormalCompletionOrderingTest() { super(CompletionType.BASIC); } @@ -41,46 +41,46 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase { return JavaTestUtil.getRelativeJavaTestDataPath() + BASE_PATH; } - public void testDontPreferRecursiveMethod() throws Throwable { + void testDontPreferRecursiveMethod() throws Throwable { checkPreferredItems(0, "registrar", "register"); } - public void testDontPreferRecursiveMethod2() throws Throwable { + void testDontPreferRecursiveMethod2() throws Throwable { checkPreferredItems(0, "return", "register"); } - public void testDelegatingConstructorCall() { + void testDelegatingConstructorCall() { checkPreferredItems 0, 'element' } - public void testPreferAnnotationMethods() throws Throwable { + void testPreferAnnotationMethods() throws Throwable { checkPreferredItems(0, "name", "value", "Foo", "Anno"); } - public void testPreferSuperMethods() throws Throwable { + void testPreferSuperMethods() throws Throwable { checkPreferredItems(0, "foo", "bar"); } - public void testSubstringVsSubSequence() throws Throwable { + void testSubstringVsSubSequence() throws Throwable { checkPreferredItems(0, "substring", "substring", "subSequence"); } - public void testReturnF() throws Throwable { + void testReturnF() throws Throwable { checkPreferredItems(0, "false", "float", "finalize"); } - public void testPreferDefaultTypeToExpected() throws Throwable { + void testPreferDefaultTypeToExpected() throws Throwable { checkPreferredItems(0, "getName", "getNameIdentifier"); } - public void testShorterPrefixesGoFirst() throws Throwable { + void testShorterPrefixesGoFirst() throws Throwable { final LookupImpl lookup = invokeCompletion(getTestName(false) + ".html"); assertPreferredItems(0, "p", "param", "pre"); incUseCount(lookup, 2); assertPreferredItems(0, "p", "pre", "param"); } - public void testUppercaseMatters2() throws Throwable { + void testUppercaseMatters2() throws Throwable { final int old = CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE; try { CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE = CodeInsightSettings.ALL; @@ -91,48 +91,48 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase { } } - public void testShorterShouldBePreselected() throws Throwable { + void testShorterShouldBePreselected() throws Throwable { checkPreferredItems(0, "foo", "fooLongButOfDefaultType"); } - public void testGenericMethodsWithBoundParametersAreStillBetterThanClassLiteral() throws Throwable { + void testGenericMethodsWithBoundParametersAreStillBetterThanClassLiteral() throws Throwable { checkPreferredItems(0, "getService", "getService", "class"); } - public void testGenericityDoesNotMatterWhenNoTypeIsExpected() { + void testGenericityDoesNotMatterWhenNoTypeIsExpected() { checkPreferredItems 0, "generic", "nonGeneric", "clone", "equals" } - public void testClassStaticMembersInVoidContext() throws Throwable { + void testClassStaticMembersInVoidContext() throws Throwable { checkPreferredItems(0, "booleanMethod", "voidMethod", "AN_OBJECT", "BOOLEAN", "class"); } - public void testJComponentInstanceMembers() throws Throwable { + void testJComponentInstanceMembers() throws Throwable { checkPreferredItems(0, "getAccessibleContext", "getUI"); } - public void testClassStaticMembersInBooleanContext() throws Throwable { + void testClassStaticMembersInBooleanContext() throws Throwable { final String path = getTestName(false) + ".java"; myFixture.configureByFile(path); myFixture.complete(CompletionType.BASIC, 2); assertPreferredItems(0, "BOOLEAN", "booleanMethod", "AN_OBJECT", "voidMethod"); } - public void testDispreferDeclared() throws Throwable { + void testDispreferDeclared() throws Throwable { checkPreferredItems(0, "aabbb", "aaa"); } - public void testDispreferImpls() throws Throwable { + void testDispreferImpls() throws Throwable { myFixture.addClass("package foo; public class Xxx {}"); configureSecondCompletion(); assertPreferredItems(0, "Xxx", "XxxEx", "XxxImpl", "Xxy"); } - public void testPreferOwnInnerClasses() throws Throwable { + void testPreferOwnInnerClasses() throws Throwable { checkPreferredItems(0, "YyyXxx", "YyyZzz"); } - public void testPreferTopLevelClasses() throws Throwable { + void testPreferTopLevelClasses() throws Throwable { configureSecondCompletion(); assertPreferredItems(0, "XxxYyy", "XxzYyy"); } @@ -142,27 +142,28 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase { myFixture.complete(CompletionType.BASIC, 2); } - public void testImplsAfterNew() { + void testImplsAfterNew() { myFixture.addClass("package foo; public interface Xxx {}"); configureSecondCompletion(); assertPreferredItems(0, "XxxImpl", "Xxx"); } - public void testPreferLessHumps() throws Throwable { + void testPreferLessHumps() throws Throwable { myFixture.addClass("package foo; public interface XaYa {}"); myFixture.addClass("package foo; public interface XyYa {}"); configureSecondCompletion(); assertPreferredItems(0, "XaYa", "XaYaEx", "XaYaImpl", "XyYa", "XyYaXa"); } - public void testPreferLessParameters() throws Throwable { + void testPreferLessParameters() throws Throwable { checkPreferredItems(0, "foo", "foo", "foo", "fox"); final List items = getLookup().getItems(); assertEquals(0, ((PsiMethod)items.get(0).getObject()).getParameterList().getParametersCount()); assertEquals(1, ((PsiMethod)items.get(1).getObject()).getParameterList().getParametersCount()); assertEquals(2, ((PsiMethod)items.get(2).getObject()).getParameterList().getParametersCount()); } - public void testStatsForClassNameInExpression() throws Throwable { + + void testStatsForClassNameInExpression() throws Throwable { myFixture.addClass("package foo; public interface FooBar {}"); myFixture.addClass("package foo; public interface FooBee {}"); @@ -172,7 +173,7 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase { assertPreferredItems(0, "FooBee", "FooBar"); } - public void testSameStatsForDifferentQualifiers() throws Throwable { + void testSameStatsForDifferentQualifiers() throws Throwable { invokeCompletion("SameStatsForDifferentQualifiersJLabel.java"); assertPreferredItems(0, "getComponent"); incUseCount(getLookup(), myFixture.lookupElementStrings.indexOf('getComponents')); @@ -185,7 +186,7 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase { assertPreferredItems(0, "getComponents", "getComponent"); } - public void testSameStatsForDifferentQualifiers2() throws Throwable { + void testSameStatsForDifferentQualifiers2() throws Throwable { invokeCompletion("SameStatsForDifferentQualifiersJComponent.java"); assertPreferredItems(0, "getComponent"); incUseCount(getLookup(), myFixture.lookupElementStrings.indexOf('getComponents')); @@ -198,7 +199,7 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase { assertPreferredItems(0, "getComponents", "getComponent"); } - public void testAbandonSameStatsForDifferentQualifiers() throws Throwable { + void testAbandonSameStatsForDifferentQualifiers() throws Throwable { invokeCompletion(getTestName(false) + ".java"); assertPreferredItems 0, "method1", "equals" myFixture.type('eq\n2);\nf2.') @@ -219,11 +220,11 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase { assertPreferredItems 0, "method3", "equals" } - public void testDispreferFinalize() throws Throwable { + void testDispreferFinalize() throws Throwable { checkPreferredItems(0, "final", "finalize"); } - public void testPreferNewExpectedInner() throws Throwable { + void testPreferNewExpectedInner() throws Throwable { checkPreferredItems(0, "Foooo.Bar", "Foooo"); /*final LookupElementPresentation presentation = new LookupElementPresentation(); @@ -231,21 +232,21 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase { assertEquals("Foooo.Bar", presentation.getItemText());*/ } - public void testDeclaredMembersGoFirst() throws Exception { + void testDeclaredMembersGoFirst() throws Exception { invokeCompletion(getTestName(false) + ".java"); assertStringItems("fromThis", "overridden", "fromSuper", "equals", "hashCode", "toString", "getClass", "notify", "notifyAll", "wait", "wait", "wait"); } - public void testLocalVarsOverMethods() { + void testLocalVarsOverMethods() { checkPreferredItems(0, "value", "validate", "validateTree"); } - public void testCurrentClassBest() { + void testCurrentClassBest() { checkPreferredItems(0, "XcodeProjectTemplate", "XcodeConfigurable"); } - public void testFqnStats() { + void testFqnStats() { myFixture.addClass("public interface Baaaaaaar {}"); myFixture.addClass("package zoo; public interface Baaaaaaar {}"); @@ -260,71 +261,71 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase { assertEquals("Baaaaaaar", ((JavaPsiClassReferenceElement)lookup.getItems().get(1)).getQualifiedName()); } - public void testSkipLifted() { + void testSkipLifted() { checkPreferredItems(0, "hashCodeMine", "hashCode") } - public void testDispreferInnerClasses() { + void testDispreferInnerClasses() { checkPreferredItems(0); //no chosen items assertFalse(getLookup().getItems().get(0).getObject() instanceof PsiClass); } - public void testPreferSameNamedMethods() { + void testPreferSameNamedMethods() { checkPreferredItems(0, "foo", "boo", "doo", "hashCode"); } - public void testPreferInterfacesInImplements() { + void testPreferInterfacesInImplements() { checkPreferredItems(0, "XFooIntf", "XFoo", "XFooClass"); assert LookupElementPresentation.renderElement(lookup.items[0]).itemTextForeground == JBColor.foreground() assert LookupElementPresentation.renderElement(lookup.items[1]).itemTextForeground == JBColor.RED assert LookupElementPresentation.renderElement(lookup.items[2]).itemTextForeground == JBColor.RED } - public void testPreferClassesInExtends() { + void testPreferClassesInExtends() { checkPreferredItems(0, "FooClass", "Foo_Intf"); } - public void testPreferClassStaticMembers() { + void testPreferClassStaticMembers() { checkPreferredItems(0, "Zoo.A", "Zoo", "Zoo.B", "Zoo.C", "Zoo.D", "Zoo.E", "Zoo.F", "Zoo.G", "Zoo.H"); } - public void testPreferFinallyToFinal() { + void testPreferFinallyToFinal() { checkPreferredItems(0, "finally", "final"); } - public void testPreferReturn() { + void testPreferReturn() { checkPreferredItems(0, "return", "rLocal", "rParam", "rMethod"); } - public void testPreferReturnBeforeExpression() { + void testPreferReturnBeforeExpression() { checkPreferredItems(0, "return", "rLocal", "rParam", "rMethod"); } - public void testPreferReturnInSingleStatementPlace() { + void testPreferReturnInSingleStatementPlace() { checkPreferredItems 0, "return", "registerKeyboardAction" } - public void testPreferContinueInsideLoops() { + void testPreferContinueInsideLoops() { checkPreferredItems 0, "continue", "color", "computeVisibleRect" } - public void testPreferModifiers() { + void testPreferModifiers() { checkPreferredItems(0, "private", "protected", "public"); } - public void testPreferEnumConstants() { + void testPreferEnumConstants() { checkPreferredItems(0, "MyEnum.bar", "MyEnum", "MyEnum.foo"); } - public void testPreferElse() { + void testPreferElse() { checkPreferredItems(0, "else", "element"); } - public void testPreferMoreMatching() { + void testPreferMoreMatching() { checkPreferredItems(0, "FooOCSomething", "FooObjectCollector"); } - public void testPreferSamePackageOverImported() { + void testPreferSamePackageOverImported() { myFixture.addClass("package bar; public class Bar1 {}"); myFixture.addClass("package bar; public class Bar2 {}"); myFixture.addClass("package bar; public class Bar3 {}"); @@ -335,7 +336,7 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase { checkPreferredItems(0, "Bar9", "Bar1", "Bar2", "Bar3", "Bar4"); } - public void testPreselectMostRelevantInTheMiddleAlpha() { + void testPreselectMostRelevantInTheMiddleAlpha() { UISettings.getInstance().SORT_LOOKUP_ELEMENTS_LEXICOGRAPHICALLY = true; myFixture.addClass("package foo; public class ELXaaaaaaaaaaaaaaaaaaaa {}"); @@ -347,14 +348,14 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase { assertEquals("ELXEMENT_A", lookup.getCurrentItem().getLookupString()); } - public void testReallyAlphaSorting() { + void testReallyAlphaSorting() { UISettings.getInstance().SORT_LOOKUP_ELEMENTS_LEXICOGRAPHICALLY = true; invokeCompletion(getTestName(false) + ".java"); assert myFixture.lookupElementStrings.sort() == myFixture.lookupElementStrings } - public void testAlphaSortPackages() { + void testAlphaSortPackages() { UISettings.getInstance().SORT_LOOKUP_ELEMENTS_LEXICOGRAPHICALLY = true def pkgs = ['bar', 'foo', 'goo', 'roo', 'zoo'] @@ -367,12 +368,12 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase { } } - public void testAlphaSortingStartMatchesFirst() { + void testAlphaSortingStartMatchesFirst() { UISettings.getInstance().SORT_LOOKUP_ELEMENTS_LEXICOGRAPHICALLY = true checkPreferredItems 0, 'xxbar', 'xxfoo', 'xxgoo', 'barxx', 'fooxx', 'gooxx' } - public void testSortSameNamedVariantsByProximity() { + void testSortSameNamedVariantsByProximity() { myFixture.addClass("public class Bar {}"); for (int i = 0; i < 10; i++) { myFixture.addClass("public class Bar" + i + " {}"); @@ -387,27 +388,27 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase { assertEquals(((JavaPsiClassReferenceElement)items.get(1)).getQualifiedName(), "bar.Bar"); } - public void testCaseInsensitivePrefixMatch() { + void testCaseInsensitivePrefixMatch() { CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE = CodeInsightSettings.NONE; checkPreferredItems(1, "Foo", "foo1", "foo2"); } - public void testExpectedTypeIsMoreImportantThanCase() { + void testExpectedTypeIsMoreImportantThanCase() { CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE = CodeInsightSettings.NONE; checkPreferredItems 0, "enable", "ENABLED" incUseCount(lookup, 1) assertPreferredItems 0, "ENABLED", "enable" } - public void testPreferKeywordsToVoidMethodsInExpectedTypeContext() { + void testPreferKeywordsToVoidMethodsInExpectedTypeContext() { checkPreferredItems 0, 'noo', 'new', 'null', 'noo2', 'notify', 'notifyAll' } - public void testPreferBetterMatchingConstantToMethods() { + void testPreferBetterMatchingConstantToMethods() { checkPreferredItems 0, 'serial', 'superExpressionInIllegalContext' } - public void testPreferApplicableAnnotations() throws Throwable { + void testPreferApplicableAnnotations() throws Throwable { myFixture.addClass ''' import java.lang.annotation.ElementType; import java.lang.annotation.Target; @@ -420,7 +421,7 @@ import java.lang.annotation.Target; checkPreferredItems 0, 'TMetaAnno', 'Target', 'TabLayoutPolicy', 'TabPlacement' } - public void testPreferApplicableAnnotationsMethod() throws Throwable { + void testPreferApplicableAnnotationsMethod() throws Throwable { myFixture.addClass ''' import java.lang.annotation.ElementType; import java.lang.annotation.Target; @@ -436,29 +437,30 @@ interface TxANotAnno {} assert !('TxANotAnno' in myFixture.lookupElementStrings) } - public void testJComponentAddNewWithStats() throws Throwable { + void testJComponentAddNewWithStats() throws Throwable { final LookupImpl lookup = invokeCompletion("/../smartTypeSorting/JComponentAddNew.java"); assertPreferredItems(0, "FooBean3", "JComponent", "Component"); incUseCount(lookup, 2); //Component assertPreferredItems(0, "Component", "FooBean3", "JComponent"); } - public void testDispreferReturnBeforeStatement() { + void testDispreferReturnBeforeStatement() { checkPreferredItems 0, 'reaction', 'rezet', 'return' } - public void testDispreferReturnInConstructor() { + void testDispreferReturnInConstructor() { checkPreferredItems 0, 'reaction', 'rezet', 'return' } - public void testDispreferReturnInVoidMethodTopLevel() { - checkPreferredItems 0, 'reaction', 'rezet', 'return' - } - public void testDispreferReturnInVoidLambda() { + void testDispreferReturnInVoidMethodTopLevel() { checkPreferredItems 0, 'reaction', 'rezet', 'return' } - public void testDoNotPreferGetClass() { + void testDispreferReturnInVoidLambda() { + checkPreferredItems 0, 'reaction', 'rezet', 'return' + } + + void testDoNotPreferGetClass() { checkPreferredItems 0, 'get', 'getClass' incUseCount(lookup, 1) assertPreferredItems 0, 'getClass', 'get' @@ -466,7 +468,7 @@ interface TxANotAnno {} assertPreferredItems 0, 'get', 'getClass' } - public void testEqualsStats() { + void testEqualsStats() { checkPreferredItems 0, 'equals', 'equalsIgnoreCase' incUseCount(lookup, 1) assertPreferredItems 0, 'equalsIgnoreCase', 'equals' @@ -474,11 +476,11 @@ interface TxANotAnno {} checkPreferredItems 0, 'equals', 'equalsIgnoreCase' } - public void testPreferClassToItsConstants() { + void testPreferClassToItsConstants() { checkPreferredItems 0, 'Calendar.FIELD_COUNT', 'Calendar', 'Calendar.AM' } - public void testPreferLocalsToStaticsInSecondCompletion() { + void testPreferLocalsToStaticsInSecondCompletion() { myFixture.addClass('public class FooZoo { public static void fooBar() {} }') myFixture.addClass('public class fooAClass {}') configureNoCompletion(getTestName(false) + ".java"); @@ -486,7 +488,7 @@ interface TxANotAnno {} assertPreferredItems(0, 'fooy', 'foox', 'fooAClass', 'fooBar'); } - public void testChangePreselectionOnSecondInvocation() { + void testChangePreselectionOnSecondInvocation() { configureNoCompletion(getTestName(false) + ".java"); myFixture.complete(CompletionType.BASIC); assertPreferredItems(0, 'fooZooGoo', 'fooZooImpl'); @@ -494,16 +496,16 @@ interface TxANotAnno {} assertPreferredItems(0, 'fooZoo', 'fooZooGoo', 'fooZooImpl'); } - public void testUnderscoresDontMakeMatchMiddle() { + void testUnderscoresDontMakeMatchMiddle() { CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE = CodeInsightSettings.NONE; checkPreferredItems(0, 'fooBar', '_fooBar', 'FooBar') } - public void testDispreferUnderscoredCaseMismatch() { + void testDispreferUnderscoredCaseMismatch() { checkPreferredItems(0, 'fooBar', '__FOO_BAR') } - public void testStatisticsMattersOnNextCompletion() { + void testStatisticsMattersOnNextCompletion() { configureByFile(getTestName(false) + ".java") myFixture.completeBasic(); assert lookup @@ -514,7 +516,7 @@ interface TxANotAnno {} assert lookup.currentItem.lookupString == 'JComponent' } - public void testStatisticsByPrefix() { + void testStatisticsByPrefix() { Closure repeatCompletion = { String letter -> String var1 = "_${letter}oo1" String var2 = "_${letter}oo2" @@ -549,13 +551,13 @@ interface TxANotAnno {} assertPreferredItems(0, '_goo2', '_goo1') } - public void testPreferFieldToMethod() { + void testPreferFieldToMethod() { checkPreferredItems(0, 'size', 'size') assert lookup.items[0].object instanceof PsiField assert lookup.items[1].object instanceof PsiMethod } - public void testPreselectLastChosen() { + void testPreselectLastChosen() { checkPreferredItems(0, 'add', 'addAll') for (i in 0..10) { incUseCount(lookup, 1) @@ -565,18 +567,18 @@ interface TxANotAnno {} assertPreferredItems 0, 'add', 'addAll' } - public void testDontPreselectLastChosenWithUnrelatedPrefix() { + void testDontPreselectLastChosenWithUnrelatedPrefix() { invokeCompletion(getTestName(false) + ".java") myFixture.type(';\nmycl') myFixture.completeBasic() assertPreferredItems 0, 'myClass', 'myExtendsClause' } - public void testCommonPrefixMoreImportantThanExpectedType() { + void testCommonPrefixMoreImportantThanExpectedType() { checkPreferredItems 0, 'myStep', 'myCurrentStep' } - public void testStatsMoreImportantThanExpectedType() { + void testStatsMoreImportantThanExpectedType() { invokeCompletion(getTestName(false) + ".java") assertPreferredItems 0, 'getNumber', 'getNumProvider' lookup.currentItem = lookup.items[1] @@ -585,7 +587,7 @@ interface TxANotAnno {} assertPreferredItems 0, 'getNumProvider', 'getNumber' } - public void testIfConditionStats() { + void testIfConditionStats() { invokeCompletion(getTestName(false) + ".java") myFixture.completeBasic() myFixture.type('cont') @@ -597,7 +599,7 @@ interface TxANotAnno {} assertPreferredItems 0, 'contains', 'containsAll' } - public void testDeepestSuperMethodStats() { + void testDeepestSuperMethodStats() { invokeCompletion(getTestName(false) + ".java") assertPreferredItems 0, 'addX', 'addY' myFixture.type('y\n;set1.ad') @@ -610,23 +612,23 @@ interface TxANotAnno {} assertPreferredItems 0, 'addX', 'addY' } - public void testCommonPrefixMoreImportantThanKind() { + void testCommonPrefixMoreImportantThanKind() { CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE = CodeInsightSettings.NONE; checkPreferredItems(0, 'PsiElement', 'psiElement') } - public void testNoExpectedTypeInStringConcatenation() { + void testNoExpectedTypeInStringConcatenation() { checkPreferredItems(0, 'vx') } - public void testLocalVarsOverStats() { + void testLocalVarsOverStats() { CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE = CodeInsightSettings.NONE; checkPreferredItems 0, 'psiElement', 'PsiElement' incUseCount lookup, 1 assertPreferredItems 0, 'psiElement', 'PsiElement' } - public void testHonorRecency() { + void testHonorRecency() { invokeCompletion(getTestName(false) + ".java") myFixture.completeBasic() myFixture.type('setou\nz.') @@ -643,41 +645,41 @@ interface TxANotAnno {} assertPreferredItems 0, 'setText', 'setOurText' } - public void testPreferString() { + void testPreferString() { checkPreferredItems 0, 'String', 'System', 'Set' } - public void testAnnotationEnum() { + void testAnnotationEnum() { checkPreferredItems 0, 'MyEnum.BAR', 'MyEnum', 'MyEnum.FOO' } - public void testPreferClassesOfExpectedClassType() { + void testPreferClassesOfExpectedClassType() { myFixture.addClass "class XException extends Exception {}" checkPreferredItems 0, 'XException', 'XClass', 'XIntf' } - public void testNoNumberValueOf() { + void testNoNumberValueOf() { checkPreferredItems 0, 'value' } - public void testNoBooleansInMultiplication() { + void testNoBooleansInMultiplication() { checkPreferredItems 0, 'fact' } - public void testPreferAnnotationsToInterfaceKeyword() { + void testPreferAnnotationsToInterfaceKeyword() { checkPreferredItems 0, 'Deprecated', 'Override' } - public void testPreferThrownExceptionsInCatch() { + void testPreferThrownExceptionsInCatch() { checkPreferredItems 0, 'final', 'FileNotFoundException', 'File' } - public void testHonorFirstLetterCase() { + void testHonorFirstLetterCase() { CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE = CodeInsightSettings.NONE; checkPreferredItems 0, 'posIdMap', 'PImageDecoder', 'PNGImageDecoder' } - public void testGlobalStaticMemberStats() { + void testGlobalStaticMemberStats() { configureNoCompletion(getTestName(false) + ".java") myFixture.complete(CompletionType.BASIC, 2) assertPreferredItems 0, 'newLinkedSet0', 'newLinkedSet1', 'newLinkedSet2' @@ -685,11 +687,11 @@ interface TxANotAnno {} assertPreferredItems 0, 'newLinkedSet1', 'newLinkedSet0', 'newLinkedSet2' } - public void testStaticMemberTypes() { + void testStaticMemberTypes() { checkPreferredItems 0, 'newMap', 'newList' } - public void testNoStatsInSuperInvocation() { + void testNoStatsInSuperInvocation() { checkPreferredItems 0, 'put', 'putAll' myFixture.type('\n') @@ -701,17 +703,17 @@ interface TxANotAnno {} assertPreferredItems 0, 'get' } - public void testLiveTemplateOrdering() { + void testLiveTemplateOrdering() { LiveTemplateCompletionContributor.setShowTemplatesInTests(true, getTestRootDisposable()) checkPreferredItems(0, 'return') assert lookup.items.find { it.lookupString == 'ritar'} != null } - public void testPreferLocalToExpectedTypedMethod() { + void testPreferLocalToExpectedTypedMethod() { checkPreferredItems 0, 'event', 'equals' } - public void testDispreferJustUsedEnumConstantsInSwitch() { + void testDispreferJustUsedEnumConstantsInSwitch() { checkPreferredItems 0, 'BAR', 'FOO', 'GOO' myFixture.type('\nbreak;\ncase ') @@ -722,29 +724,29 @@ interface TxANotAnno {} assert LookupElementPresentation.renderElement(items.find { it.lookupString == 'BAR' }).itemTextForeground == JBColor.RED } - public void testPreferValueTypesReturnedFromMethod() { + void testPreferValueTypesReturnedFromMethod() { checkPreferredItems 0, 'StringBuffer', 'String', 'Serializable', 'SomeInterface', 'SomeInterface', 'SomeOtherClass' assert 'SomeInterface' == LookupElementPresentation.renderElement(myFixture.lookupElements[3]).itemText assert 'SomeInterface' == LookupElementPresentation.renderElement(myFixture.lookupElements[4]).itemText } - public void testPreferCastTypesHavingSpecifiedMethod() { + void testPreferCastTypesHavingSpecifiedMethod() { checkPreferredItems 0, 'MainClass1', 'MainClass2', 'Maa' } - public void testNaturalSorting() { + void testNaturalSorting() { checkPreferredItems 0, 'fun1', 'fun2', 'fun10' } - public void testPreferVarsHavingReferencedMember() { + void testPreferVarsHavingReferencedMember() { checkPreferredItems 0, 'xzMap', 'xaString' } - public void testPreferCollectionsStaticOfExpectedType() { + void testPreferCollectionsStaticOfExpectedType() { checkPreferredItems 0, 'unmodifiableList', 'unmodifiableCollection' } - public void testDispreferDeprecatedMethodWithUnresolvedQualifier() { + void testDispreferDeprecatedMethodWithUnresolvedQualifier() { myFixture.addClass("package foo; public class Assert { public static void assertTrue() {} }") myFixture.addClass("package bar; @Deprecated public class Assert { public static void assertTrue() {}; public static void assertTrue2() {} }") checkPreferredItems 0, 'Assert.assertTrue', 'Assert.assertTrue', 'Assert.assertTrue2' @@ -758,15 +760,15 @@ interface TxANotAnno {} assert p.strikeout } - public void testPreferClassKeywordWhenExpectedClassType() { + void testPreferClassKeywordWhenExpectedClassType() { checkPreferredItems 0, 'class' } - public void testPreferBooleanKeywordsWhenExpectedBoolean() { + void testPreferBooleanKeywordsWhenExpectedBoolean() { checkPreferredItems 0, 'false', 'factory' } - public void testPreferExplicitlyImportedStaticMembers() { + void testPreferExplicitlyImportedStaticMembers() { myFixture.addClass(""" class ContainerUtilRt { static void newHashSet(); @@ -781,7 +783,7 @@ class ContainerUtil extends ContainerUtilRt { assert (myFixture.lookupElements[0].psiElement as PsiMethod).containingClass.name == 'ContainerUtil' } - public void testPreferCatchAndFinallyAfterTry() { + void testPreferCatchAndFinallyAfterTry() { checkPreferredItems 0, 'catch', 'finally' } 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 be03b3d4266d..7e92e7dd742c 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,18 +33,18 @@ import com.intellij.psi.impl.PsiDocumentManagerBase import com.intellij.util.ui.UIUtil import com.siyeh.ig.style.UnqualifiedFieldAccessInspection -public class NormalCompletionTest extends LightFixtureCompletionTestCase { +class NormalCompletionTest extends LightFixtureCompletionTestCase { @Override protected String getBasePath() { return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/completion/normal/"; } - public void testSimple() throws Exception { + void testSimple() throws Exception { configureByFile("Simple.java"); assertStringItems("_local1", "_local2", "_field", "_method", "_baseField", "_baseMethod"); } - public void testCastToPrimitive1() throws Exception { + void testCastToPrimitive1() throws Exception { configureByFile("CastToPrimitive1.java"); for (final LookupElement item : myItems) { @@ -53,7 +53,7 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { assertTrue(false); } - public void testCastToPrimitive2() throws Exception { + void testCastToPrimitive2() throws Exception { configureByFile("CastToPrimitive2.java"); for (final LookupElement item : myItems) { @@ -62,7 +62,7 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { assertTrue(false); } - public void testCastToPrimitive3() throws Exception { + void testCastToPrimitive3() throws Exception { configureByFile("CastToPrimitive3.java"); for (final LookupElement item : myItems) { @@ -71,27 +71,27 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { assertTrue(false); } - public void testWriteInInvokeLater() throws Exception { + void testWriteInInvokeLater() throws Exception { configureByFile("WriteInInvokeLater.java"); } - public void testQualifiedNew1() throws Exception { + void testQualifiedNew1() throws Exception { configure() assertStringItems "IInner", "Inner" } - public void testQualifiedNew2() throws Exception { + void testQualifiedNew2() throws Exception { configure() assertStringItems "AnInner", "Inner" } - public void testKeywordsInName() throws Exception { + void testKeywordsInName() throws Exception { doTest 'a\n' } - public void testSimpleVariable() throws Exception { doTest('\n') } + void testSimpleVariable() throws Exception { doTest('\n') } - public void testTypeParameterItemPresentation() { + void testTypeParameterItemPresentation() { configure() LookupElementPresentation presentation = renderElement(myItems[0]) assert "Param" == presentation.itemText @@ -104,8 +104,8 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { assert "Param2" == presentation.itemText assert presentation.tailText == " (type parameter of goo)" } - - public void testDisplayDefaultValueInAnnotationMethods() { + + void testDisplayDefaultValueInAnnotationMethods() { configure() LookupElementPresentation presentation = renderElement(myItems[0]) assert "myBool" == presentation.itemText @@ -119,7 +119,7 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { assert presentation.tailText == ' default "unknown"' } - public void testMethodItemPresentation() { + void testMethodItemPresentation() { configure() LookupElementPresentation presentation = renderElement(myItems[0]) assert "equals" == presentation.itemText @@ -134,7 +134,7 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { return LookupElementPresentation.renderElement(element) } - public void testFieldItemPresentationGenerics() { + void testFieldItemPresentationGenerics() { configure() LookupElementPresentation presentation = renderElement(myItems[0]) assert "target" == presentation.itemText @@ -142,7 +142,7 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { assert "String" == presentation.typeText } - public void testMethodItemPresentationGenerics() { + void testMethodItemPresentationGenerics() { configure() LookupElementPresentation presentation = renderElement(myItems[0]) assert "add" == presentation.itemText @@ -157,7 +157,7 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { assert presentation.itemTextBold } - public void testPreferLongerNamesOption() throws Exception { + void testPreferLongerNamesOption() throws Exception { configureByFile("PreferLongerNamesOption.java"); assertEquals(3, myItems.length); @@ -181,33 +181,34 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { } } - public void testSCR7208() throws Exception { + void testSCR7208() throws Exception { configureByFile("SCR7208.java"); } - public void testProtectedFromSuper() throws Exception { + void testProtectedFromSuper() throws Exception { configureByFile("ProtectedFromSuper.java"); Arrays.sort(myItems); assertTrue("Exception not found", Arrays.binarySearch(myItems, "xxx") > 0); } - public void testBeforeInitialization() throws Exception { + void testBeforeInitialization() throws Exception { configureByFile("BeforeInitialization.java"); assertNotNull(myItems); assertTrue(myItems.length > 0); } - public void testProtectedFromSuper2() throws Exception { + void testProtectedFromSuper2() throws Exception { configureByFile("ProtectedFromSuper.java"); Arrays.sort(myItems); assertTrue("Exception not found", Arrays.binarySearch(myItems, "xxx") > 0); } - public void testClassLiteralInArrayAnnoInitializer() throws Throwable { doTest(); } - public void testClassLiteralInArrayAnnoInitializer2() throws Throwable { doTest(); } + void testClassLiteralInArrayAnnoInitializer() throws Throwable { doTest(); } - public void testReferenceParameters() throws Exception { + void testClassLiteralInArrayAnnoInitializer2() throws Throwable { doTest(); } + + void testReferenceParameters() throws Exception { configureByFile("ReferenceParameters.java"); assertNotNull(myItems); myFixture.assertPreferredCompletionItems 0, 'AAAA', 'AAAB' @@ -220,25 +221,25 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { super.tearDown() } - public void testConstructorName1() throws Exception{ + void testConstructorName1() throws Exception { CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION = false configure(); assert 'ABCDE' in myFixture.lookupElementStrings } - public void testConstructorName2() throws Exception{ + void testConstructorName2() throws Exception { CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION = false configure(); assert 'ABCDE' in myFixture.lookupElementStrings } - public void testObjectsInThrowsBlock() throws Exception { + void testObjectsInThrowsBlock() throws Exception { configureByFile("InThrowsCompletion.java"); assert "C" == myFixture.lookupElementStrings[0] assert "B" in myFixture.lookupElementStrings } - public void testAnnoParameterValue() throws Exception { + void testAnnoParameterValue() throws Exception { configure() def strings = myFixture.lookupElementStrings assert 'AssertionError' in strings @@ -252,89 +253,90 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { assert !('null' in strings) } - public void testAfterInstanceof() throws Exception { + void testAfterInstanceof() throws Exception { configureByFile("AfterInstanceof.java"); assert "A" in myFixture.lookupElementStrings } - public void testAfterCast1() throws Exception { + void testAfterCast1() throws Exception { configureByFile("AfterCast1.java"); assertNotNull(myItems); assertEquals(2, myItems.length); } - public void testAfterCast2() throws Exception { + void testAfterCast2() throws Exception { configureByFile("AfterCast2.java"); checkResultByFile("AfterCast2-result.java"); } - public void testMethodCallForTwoLevelSelection() throws Exception { + void testMethodCallForTwoLevelSelection() throws Exception { configureByFile("MethodLookup.java"); assertEquals(2, myItems.length); } - public void testMethodCallBeforeAnotherStatementWithParen() throws Exception { + void testMethodCallBeforeAnotherStatementWithParen() throws Exception { configureByFile("MethodLookup2.java"); checkResultByFile("MethodLookup2_After.java"); } - public void testMethodCallBeforeAnotherStatementWithParen2() throws Exception { + void testMethodCallBeforeAnotherStatementWithParen2() throws Exception { codeStyleSettings.METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE = true; configureByFile("MethodLookup2.java"); checkResultByFile("MethodLookup2_After2.java"); } - public void testSwitchEnumLabel() throws Exception { + void testSwitchEnumLabel() throws Exception { configureByFile("SwitchEnumLabel.java"); assertEquals(3, myItems.length); } - public void testSwitchCaseWithEnumConstant() { doTest() } - public void testSecondSwitchCaseWithEnumConstant() { doTest() } + void testSwitchCaseWithEnumConstant() { doTest() } - public void testMethodInAnnotation() throws Exception { + void testSecondSwitchCaseWithEnumConstant() { doTest() } + + void testMethodInAnnotation() throws Exception { configureByFile("Annotation.java"); checkResultByFile("Annotation_after.java"); } - public void testMethodInAnnotation2() throws Exception { + void testMethodInAnnotation2() throws Exception { configureByFile("Annotation2.java"); checkResultByFile("Annotation2_after.java"); } - public void testMethodInAnnotation3() throws Exception { + void testMethodInAnnotation3() throws Exception { configureByFile("Annotation3.java"); checkResultByFile("Annotation3_after.java"); } - public void testMethodInAnnotation5() throws Exception { + void testMethodInAnnotation5() throws Exception { configureByFile("Annotation5.java"); checkResultByFile("Annotation5_after.java"); } - public void testMethodInAnnotation7() throws Exception { + void testMethodInAnnotation7() throws Exception { configureByFile("Annotation7.java"); selectItem(myItems[0]); checkResultByFile("Annotation7_after.java"); } - public void testEnumInAnnotation() throws Exception { + void testEnumInAnnotation() throws Exception { configureByFile("Annotation4.java"); checkResultByFile("Annotation4_after.java"); } - public void testSecondAttribute() throws Exception { + void testSecondAttribute() throws Exception { configureByFile("Annotation6.java"); checkResultByFile("Annotation6_after.java"); } - public void testIDEADEV6408() throws Exception { + void testIDEADEV6408() throws Exception { configureByFile("IDEADEV6408.java"); assertFirstStringItems "boolean", "byte" } - public void testMethodWithLeftParTailType() throws Exception { + void testMethodWithLeftParTailType() throws Exception { configureByFile("MethodWithLeftParTailType.java"); type('('); checkResultByFile("MethodWithLeftParTailType_after.java"); @@ -344,12 +346,12 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { checkResultByFile("MethodWithLeftParTailType2_after.java"); } - public void testSuperErasure() throws Exception { + void testSuperErasure() throws Exception { configureByFile("SuperErasure.java"); checkResultByFile("SuperErasure_after.java"); } - public void testMethodWithLeftParTailTypeNoPairBrace() throws Exception { + void testMethodWithLeftParTailTypeNoPairBrace() throws Exception { final boolean old = CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET; CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET = false; @@ -363,7 +365,7 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { } } - public void testMethodWithLeftParTailTypeNoPairBrace2() throws Exception { + void testMethodWithLeftParTailTypeNoPairBrace2() throws Exception { final boolean old = CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET; CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET = false; @@ -378,7 +380,7 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { } } - public void testMethodNoPairBrace() throws Exception { + void testMethodNoPairBrace() throws Exception { final boolean old = CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET; CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET = false; @@ -390,35 +392,35 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { } } - public void testExcessSpaceInTypeCast() throws Throwable { + void testExcessSpaceInTypeCast() throws Throwable { configure() selectItem(myItems[0]); checkResult() } - public void testFieldType() { doTest(); } + void testFieldType() { doTest(); } - public void testPackageInAnnoParam() throws Throwable { + void testPackageInAnnoParam() throws Throwable { doTest(); } - public void testAnonymousTypeParameter() throws Throwable { doTest(); } + void testAnonymousTypeParameter() throws Throwable { doTest(); } - public void testClassLiteralInAnnoParam() throws Throwable { + void testClassLiteralInAnnoParam() throws Throwable { doTest(); } - public void testNoForceBraces() { + void testNoForceBraces() { codeStyleSettings.IF_BRACE_FORCE = CommonCodeStyleSettings.FORCE_BRACES_ALWAYS doTest('\n') } - public void testExcludeStringBuffer() throws Throwable { + void testExcludeStringBuffer() throws Throwable { JavaProjectCodeInsightSettings.setExcludedNames(project, testRootDisposable, StringBuffer.name) doAntiTest() } - public void testExcludeInstanceInnerClasses() throws Throwable { + void testExcludeInstanceInnerClasses() throws Throwable { JavaProjectCodeInsightSettings.setExcludedNames(project, testRootDisposable, "foo") myFixture.addClass 'package foo; public class Outer { public class Inner {} }' myFixture.addClass 'package bar; public class Inner {}' @@ -427,7 +429,7 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { assert myFixture.lookupElementStrings == ['Inner'] } - public void testExcludedInstanceInnerClassCreation() throws Throwable { + void testExcludedInstanceInnerClassCreation() throws Throwable { JavaProjectCodeInsightSettings.setExcludedNames(project, testRootDisposable, "foo") myFixture.addClass 'package foo; public class Outer { public class Inner {} }' myFixture.addClass 'package bar; public class Inner {}' @@ -436,7 +438,7 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { assert myFixture.lookupElementStrings == ['Inner'] } - public void testExcludedInstanceInnerClassQualifiedReference() throws Throwable { + void testExcludedInstanceInnerClassQualifiedReference() throws Throwable { JavaProjectCodeInsightSettings.setExcludedNames(project, testRootDisposable, "foo") myFixture.addClass 'package foo; public class Outer { public class Inner {} }' myFixture.addClass 'package bar; public class Inner {}' @@ -445,48 +447,51 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { assert myFixture.lookupElementStrings == ['Inner'] } - public void testStaticMethodOfExcludedClass() { + void testStaticMethodOfExcludedClass() { JavaProjectCodeInsightSettings.setExcludedNames(project, testRootDisposable, "foo") myFixture.addClass 'package foo; public class Outer { public static void method() {} }' configure() assert myFixture.lookupElementStrings == ['method'] } - public void testAtUnderClass() throws Throwable { + void testAtUnderClass() throws Throwable { doTest('\n'); } - public void testLocalClassName() throws Throwable { doTest(); } - public void testAssigningFieldForTheFirstTime() throws Throwable { doTest(); } + void testLocalClassName() throws Throwable { doTest(); } - public void testClassTypeParameters() throws Throwable { + void testAssigningFieldForTheFirstTime() throws Throwable { doTest(); } + + void testClassTypeParameters() throws Throwable { configure() assert 'K' in myFixture.lookupElementStrings } - public void testClassTypeParametersGenericBounds() throws Throwable { + void testClassTypeParametersGenericBounds() throws Throwable { configure() assert 'K' in myFixture.lookupElementStrings } - public void testLocalClassTwice() throws Throwable { + void testLocalClassTwice() throws Throwable { configure() assertOrderedEquals myFixture.lookupElementStrings, 'Zoooz', 'Zooooo' } - public void testLocalTopLevelConflict() throws Throwable { + void testLocalTopLevelConflict() throws Throwable { configure() assertOrderedEquals myFixture.lookupElementStrings, 'Zoooz', 'Zooooo' } - public void testFinalBeforeMethodCall() throws Throwable { + void testFinalBeforeMethodCall() throws Throwable { configure() assertStringItems 'final', 'finalize' } - public void testMethodCallAfterFinally() { doTest() } - public void testPrivateInAnonymous() throws Throwable { doTest() } - public void testStaticMethodFromOuterClass() { + void testMethodCallAfterFinally() { doTest() } + + void testPrivateInAnonymous() throws Throwable { doTest() } + + void testStaticMethodFromOuterClass() { configure() assertStringItems 'foo', 'A.foo', 'for' assert LookupElementPresentation.renderElement(myItems[1]).itemText == 'A.foo' @@ -494,7 +499,7 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { checkResult() } - public void testInstanceMethodFromOuterClass() { + void testInstanceMethodFromOuterClass() { configure() assertStringItems 'foo', 'A.this.foo', 'for' assert LookupElementPresentation.renderElement(myItems[1]).itemText == 'A.this.foo' @@ -502,45 +507,46 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { checkResult() } - public void testMethodParenthesesSpaces() throws Throwable { + void testMethodParenthesesSpaces() throws Throwable { codeStyleSettings.SPACE_BEFORE_METHOD_CALL_PARENTHESES = true codeStyleSettings.SPACE_WITHIN_METHOD_CALL_PARENTHESES = true doTest(); } - public void testMethodParenthesesSpacesArgs() throws Throwable { + void testMethodParenthesesSpacesArgs() throws Throwable { codeStyleSettings.SPACE_BEFORE_METHOD_CALL_PARENTHESES = true codeStyleSettings.SPACE_WITHIN_METHOD_CALL_PARENTHESES = true doTest(); } - public void testAtUnderClassNoModifiers() throws Throwable { + void testAtUnderClassNoModifiers() throws Throwable { doTest(); } - public void testBreakInIfCondition() throws Throwable { doTest(); } - public void testAccessStaticViaInstance() throws Throwable { doTest(); } + void testBreakInIfCondition() throws Throwable { doTest(); } - public void testIfConditionLt() { + void testAccessStaticViaInstance() throws Throwable { doTest(); } + + void testIfConditionLt() { configure() myFixture.assertPreferredCompletionItems 0, 'getAnnotationsAreaOffset' } - public void testAccessStaticViaInstanceSecond() throws Throwable { + void testAccessStaticViaInstanceSecond() throws Throwable { configure() myFixture.complete(CompletionType.BASIC, 2) checkResult() } - public void testAccessInstanceFromStaticSecond() throws Throwable { + void testAccessInstanceFromStaticSecond() throws Throwable { configure() myFixture.complete(CompletionType.BASIC, 2) checkResult() } - public void testContinueLabel() throws Throwable { doTest(); } + void testContinueLabel() throws Throwable { doTest(); } - public void testAnonymousProcess() { + void testAnonymousProcess() { myFixture.addClass 'package java.lang; public class Process {}' myFixture.addClass ''' import java.util.*; @@ -555,68 +561,69 @@ public class ListUtils { checkResult() } - public void testNoThisInComment() throws Throwable { doAntiTest() } - public void testIncNull() throws Throwable { + void testNoThisInComment() throws Throwable { doAntiTest() } + + void testIncNull() throws Throwable { configure() checkResultByFile(getTestName(false) + ".java") assert !('null' in myFixture.lookupElementStrings) } - public void testLastExpressionInFor() throws Throwable { doTest(); } + void testLastExpressionInFor() throws Throwable { doTest(); } - public void testOnlyKeywordsInsideSwitch() throws Throwable { + void testOnlyKeywordsInsideSwitch() throws Throwable { configureByFile(getTestName(false) + ".java"); assertStringItems("case", "default"); } - public void testBooleanLiterals() throws Throwable { + void testBooleanLiterals() throws Throwable { doTest('\n'); } - public void testDoubleBooleanInParameter() throws Throwable { + void testDoubleBooleanInParameter() throws Throwable { configure() assertFirstStringItems("boolean", "byte") } - public void testDoubleConstant() throws Throwable { + void testDoubleConstant() throws Throwable { configure() assertStringItems("XFOO") } - public void testNotOnlyKeywordsInsideSwitch() throws Throwable { + void testNotOnlyKeywordsInsideSwitch() throws Throwable { doTest(); } - public void testChainedCallOnNextLine() throws Throwable { + void testChainedCallOnNextLine() throws Throwable { configureByFile(getTestName(false) + ".java"); selectItem(myItems[0]); checkResult() } - public void testFinishWithDot() throws Throwable { + void testFinishWithDot() throws Throwable { configureByFile(getTestName(false) + ".java"); type('.'); checkResult() } - public void testEnclosingThis() throws Throwable { doTest(); } + void testEnclosingThis() throws Throwable { doTest(); } - public void testSeamlessConstant() throws Throwable { + void testSeamlessConstant() throws Throwable { configureByFile(getTestName(false) + ".java"); selectItem(myItems[0]); checkResult() } - public void testDefaultAnnoParam() throws Throwable { doTest(); } + void testDefaultAnnoParam() throws Throwable { doTest(); } - public void testSpaceAfterLookupString() throws Throwable { + void testSpaceAfterLookupString() throws Throwable { configureByFile(getTestName(false) + ".java"); type(' '); assertNull(getLookup()); checkResult() } - public void testNoSpaceInParensWithoutParams() throws Throwable { + void testNoSpaceInParensWithoutParams() throws Throwable { codeStyleSettings.SPACE_WITHIN_METHOD_CALL_PARENTHESES = true; try { doTest(); @@ -625,98 +632,101 @@ public class ListUtils { codeStyleSettings.SPACE_WITHIN_METHOD_CALL_PARENTHESES = false; } } - - public void testTwoSpacesInParensWithParams() throws Throwable { + + void testTwoSpacesInParensWithParams() throws Throwable { codeStyleSettings.SPACE_WITHIN_METHOD_CALL_PARENTHESES = true; doTest(); } - public void testQualifierAsPackage() throws Throwable { + void testQualifierAsPackage() throws Throwable { configureByFile(getTestName(false) + ".java"); selectItem(myItems[0]); checkResult() } - public void testQualifierAsPackage2() throws Throwable { - doTest(); - } - - public void testQualifierAsPackage3() throws Throwable { + void testQualifierAsPackage2() throws Throwable { doTest(); } - public void testPreselectEditorSelection() { + void testQualifierAsPackage3() throws Throwable { + doTest(); + } + + void testPreselectEditorSelection() { configure() assert lookup.currentItem != myFixture.lookupElements[0] assert 'finalize' == lookup.currentItem.lookupString } - public void testNoMethodsInNonStaticImports() { + void testNoMethodsInNonStaticImports() { configure() assertStringItems("*") } - public void testMembersInStaticImports() { doTest() } - - public void testPackageNamedVariableBeforeAssignment() throws Throwable { + void testMembersInStaticImports() { doTest() } + + void testPackageNamedVariableBeforeAssignment() throws Throwable { doTest(); } - public void testInnerEnumConstant() throws Throwable { doTest('\n'); } + void testInnerEnumConstant() throws Throwable { doTest('\n'); } - public void testNoExpectedReturnTypeDuplication() { + void testNoExpectedReturnTypeDuplication() { configure() assert myFixture.lookupElementStrings == ['boolean', 'byte'] } - public void testMethodReturnType() throws Throwable { + void testMethodReturnType() throws Throwable { doTest(); } - public void testMethodReturnTypeNoSpace() throws Throwable { + void testMethodReturnTypeNoSpace() throws Throwable { configureByFile(getTestName(false) + ".java"); selectItem(myItems[0]); checkResult() } - public void testEnumWithoutConstants() throws Throwable { + void testEnumWithoutConstants() throws Throwable { doTest(); } - public void testDoWhileMethodCall() throws Throwable { + void testDoWhileMethodCall() throws Throwable { doTest(); } - public void testSecondTypeParameterExtends() throws Throwable { + void testSecondTypeParameterExtends() throws Throwable { doTest(); } - public void testGetterWithExistingNonEmptyParameterList() throws Throwable { + void testGetterWithExistingNonEmptyParameterList() throws Throwable { doTest(); } - public void testNothingAfterNumericLiteral() throws Throwable { doAntiTest(); } - public void testNothingAfterTypeParameterQualifier() { doAntiTest(); } - public void testExcludeVariableBeingDeclared() { doAntiTest(); } - public void testExcludeVariableBeingDeclared2() { doAntiTest(); } + void testNothingAfterNumericLiteral() throws Throwable { doAntiTest(); } - public void testSpacesAroundEq() throws Throwable { doTest('='); } + void testNothingAfterTypeParameterQualifier() { doAntiTest(); } - public void _testClassBeforeCast() throws Throwable { doTest '\n' } + void testExcludeVariableBeingDeclared() { doAntiTest(); } - public void testNoAllClassesOnQualifiedReference() throws Throwable { + void testExcludeVariableBeingDeclared2() { doAntiTest(); } + + void testSpacesAroundEq() throws Throwable { doTest('='); } + + void _testClassBeforeCast() throws Throwable { doTest '\n' } + + void testNoAllClassesOnQualifiedReference() throws Throwable { doAntiTest() } - public void testFinishClassNameWithDot() throws Throwable { + void testFinishClassNameWithDot() throws Throwable { doTest('.') } - public void testFinishClassNameWithLParen() throws Throwable { + void testFinishClassNameWithLParen() throws Throwable { doTest('(') } - public void testSelectNoParameterSignature() throws Throwable { + void testSelectNoParameterSignature() throws Throwable { configureByFile(getTestName(false) + ".java"); final int parametersCount = ((PsiMethod)getLookup().getCurrentItem().getObject()).getParameterList().getParametersCount(); assertEquals(0, parametersCount); @@ -724,122 +734,131 @@ public class ListUtils { checkResult() } - public void testCompletionInsideClassLiteral() throws Throwable { + void testCompletionInsideClassLiteral() throws Throwable { configureByFile(getTestName(false) + ".java"); type('\n') checkResult() } - public void testFieldNegation() throws Throwable { doTest('!');} - public void testDefaultInSwitch() throws Throwable { doTest()} - public void testBreakInSwitch() throws Throwable { doTest() } + void testFieldNegation() throws Throwable { doTest('!'); } - public void testSuperInConstructor() throws Throwable { + void testDefaultInSwitch() throws Throwable { doTest() } + + void testBreakInSwitch() throws Throwable { doTest() } + + void testSuperInConstructor() throws Throwable { doTest(); } - public void testSuperInConstructorWithParams() throws Throwable { + void testSuperInConstructorWithParams() throws Throwable { doTest(); } - public void testSuperInMethod() throws Throwable { + void testSuperInMethod() throws Throwable { doTest(); } - public void testSecondMethodParameterName() throws Throwable { + void testSecondMethodParameterName() throws Throwable { doTest(); } - public void testAnnotationAsUsualObject() throws Throwable { + void testAnnotationAsUsualObject() throws Throwable { doTest(); } - public void testAnnotationAsUsualObjectFromJavadoc() throws Throwable { + void testAnnotationAsUsualObjectFromJavadoc() throws Throwable { doTest(); } - public void testAnnotationAsUsualObjectInsideClass() throws Throwable { + void testAnnotationAsUsualObjectInsideClass() throws Throwable { doTest(); } - public void testAnnotationOnNothingParens() throws Throwable { + void testAnnotationOnNothingParens() throws Throwable { doTest(); } - public void testMultiResolveQualifier() throws Throwable { + void testMultiResolveQualifier() throws Throwable { doTest(); } - public void testSecondMethodParameter() throws Throwable { doTest(); } - public void testReturnInCase() throws Throwable { doTest(); } - public void testUnboxedConstantsInCase() throws Throwable { doTest(); } + void testSecondMethodParameter() throws Throwable { doTest(); } - public void testAnnotationWithoutValueMethod() throws Throwable { + void testReturnInCase() throws Throwable { doTest(); } + + void testUnboxedConstantsInCase() throws Throwable { doTest(); } + + void testAnnotationWithoutValueMethod() throws Throwable { configureByFile(getTestName(false) + ".java"); assertStringItems("bar", "foo"); } - public void testAddExplicitValueInAnnotation() throws Throwable { + void testAddExplicitValueInAnnotation() throws Throwable { configureByTestName() assertStringItems("bar", "goo") selectItem(myItems[0]) checkResult() } - public void testUnnecessaryMethodMerging() throws Throwable { + void testUnnecessaryMethodMerging() throws Throwable { configureByFile(getTestName(false) + ".java"); assertStringItems("fofoo", "fofoo"); } - public void testMethodMergingMinimalTail() { doTest() } + void testMethodMergingMinimalTail() { doTest() } - public void testAnnotationQualifiedName() throws Throwable { + void testAnnotationQualifiedName() throws Throwable { doTest(); } - public void testClassNameGenerics() throws Throwable { + void testClassNameGenerics() throws Throwable { doTest('\n') } - public void testClassNameAnonymous() throws Throwable { + void testClassNameAnonymous() throws Throwable { doTest('\n') } - public void testClassNameWithInner() throws Throwable { + void testClassNameWithInner() throws Throwable { configure() assertStringItems 'Zzoo', 'Zzoo.Impl' type '\n' checkResult() } - public void testClassNameWithInner2() throws Throwable { doTest('\n') } - public void testClassNameWithInstanceInner() throws Throwable { doTest('\n') } + void testClassNameWithInner2() throws Throwable { doTest('\n') } - public void testDoubleFalse() throws Throwable { + void testClassNameWithInstanceInner() throws Throwable { doTest('\n') } + + void testDoubleFalse() throws Throwable { configureByFile(getTestName(false) + ".java"); assertFirstStringItems("false", "fefefef", "float", "finalize"); } - public void testSameNamedVariableInNestedClasses() throws Throwable { + void testSameNamedVariableInNestedClasses() throws Throwable { doTest(); } - public void testHonorUnderscoreInPrefix() throws Throwable { + void testHonorUnderscoreInPrefix() throws Throwable { doTest(); } - public void testNoSemicolonAfterExistingParenthesesEspeciallyIfItsACast() throws Throwable { doTest(); } - public void testReturningTypeVariable() throws Throwable { doTest(); } - public void testReturningTypeVariable2() throws Throwable { doTest(); } - public void testReturningTypeVariable3() throws Throwable { doTest(); } - public void testImportInGenericType() throws Throwable { + void testNoSemicolonAfterExistingParenthesesEspeciallyIfItsACast() throws Throwable { doTest(); } + + void testReturningTypeVariable() throws Throwable { doTest(); } + + void testReturningTypeVariable2() throws Throwable { doTest(); } + + void testReturningTypeVariable3() throws Throwable { doTest(); } + + void testImportInGenericType() throws Throwable { configure() myFixture.complete(CompletionType.BASIC, 2) myFixture.type('\n') checkResult(); } - public void testCaseTailType() throws Throwable { doTest(); } + void testCaseTailType() throws Throwable { doTest(); } def doPrimitiveTypeTest() { configure() @@ -851,40 +870,45 @@ public class ListUtils { configureByTestName() } - public void testFinalInForLoop() throws Throwable { + void testFinalInForLoop() throws Throwable { configure() assertStringItems 'final' } - public void testFinalInForLoop2() throws Throwable { + void testFinalInForLoop2() throws Throwable { configure() myFixture.assertPreferredCompletionItems 0, 'finalize', 'final' } - public void testOnlyClassesInExtends() throws Throwable { + void testOnlyClassesInExtends() throws Throwable { configure() assertStringItems 'Inner' } - public void testNoThisClassInExtends() throws Throwable { + void testNoThisClassInExtends() throws Throwable { configure() assertStringItems 'Fooxxxx2' } - public void testPrimitiveTypesInForLoop() throws Throwable { doPrimitiveTypeTest() } - public void testPrimitiveTypesInForLoop2() throws Throwable { doPrimitiveTypeTest() } - public void testPrimitiveTypesInForLoop3() throws Throwable { doPrimitiveTypeTest() } - public void testPrimitiveTypesInForLoop4() throws Throwable { doPrimitiveTypeTest() } - public void testPrimitiveTypesInForLoop5() throws Throwable { doPrimitiveTypeTest() } - public void testPrimitiveTypesInForLoop6() throws Throwable { doPrimitiveTypeTest() } + void testPrimitiveTypesInForLoop() throws Throwable { doPrimitiveTypeTest() } - public void testPrimitiveTypesInForLoopSpace() throws Throwable { + void testPrimitiveTypesInForLoop2() throws Throwable { doPrimitiveTypeTest() } + + void testPrimitiveTypesInForLoop3() throws Throwable { doPrimitiveTypeTest() } + + void testPrimitiveTypesInForLoop4() throws Throwable { doPrimitiveTypeTest() } + + void testPrimitiveTypesInForLoop5() throws Throwable { doPrimitiveTypeTest() } + + void testPrimitiveTypesInForLoop6() throws Throwable { doPrimitiveTypeTest() } + + void testPrimitiveTypesInForLoopSpace() throws Throwable { configure() myFixture.type ' ' checkResultByFile(getTestName(false) + "_after.java") } - public void testSuggestInaccessibleOnSecondInvocation() throws Throwable { + void testSuggestInaccessibleOnSecondInvocation() throws Throwable { configure() assertStringItems("_bar", "_goo"); complete(); @@ -894,21 +918,21 @@ public class ListUtils { checkResult() } - public void testNoCommonPrefixInsideIdentifier() throws Throwable { + void testNoCommonPrefixInsideIdentifier() throws Throwable { final String path = getTestName(false) + ".java"; configureByFile(path); checkResultByFile(path); assertStringItems("fai1", "fai2"); } - public void testProtectedInaccessibleOnSecondInvocation() throws Throwable { + void testProtectedInaccessibleOnSecondInvocation() throws Throwable { myFixture.configureByFile(getTestName(false) + ".java"); myFixture.complete(CompletionType.BASIC, 2); myFixture.type('\n') checkResult() } - public void testPropertyReferencePrefix() throws Throwable { + void testPropertyReferencePrefix() throws Throwable { myFixture.addFileToProject("test.properties", "foo.bar=Foo! Bar!").getVirtualFile(); doAntiTest() } @@ -924,9 +948,9 @@ public class ListUtils { checkResult(); } - public void testSecondAnonymousClassParameter() { doTest(); } + void testSecondAnonymousClassParameter() { doTest(); } - public void testSpaceAfterReturn() throws Throwable { + void testSpaceAfterReturn() throws Throwable { configure() type '\n' checkResult() @@ -936,132 +960,163 @@ public class ListUtils { checkResultByFile(getTestName(false) + "_after.java") } - public void testIntersectionTypeMembers() throws Throwable { + void testIntersectionTypeMembers() throws Throwable { configure() assertStringItems "fooa", "foob" } - public void testNoReturnInTernary() throws Throwable { doTest(); } + void testNoReturnInTernary() throws Throwable { doTest(); } - public void testWildcardsInLookup() throws Exception { + void testWildcardsInLookup() throws Exception { configure() assertNotNull(getLookup()); type('*fz'); assert !lookup } - public void testSmartEnterWrapsConstructorCall() throws Throwable { doTest(Lookup.COMPLETE_STATEMENT_SELECT_CHAR as String) } - public void testSmartEnterNoNewLine() { doTest(Lookup.COMPLETE_STATEMENT_SELECT_CHAR as String) } - public void testSmartEnterWithNewLine() { doTest(Lookup.COMPLETE_STATEMENT_SELECT_CHAR as String) } - public void testSmartEnterGuessArgumentCount() throws Throwable { doTest(Lookup.COMPLETE_STATEMENT_SELECT_CHAR as String) } - public void testSmartEnterInsideArrayBrackets() { doTest(Lookup.COMPLETE_STATEMENT_SELECT_CHAR as String) } + void testSmartEnterWrapsConstructorCall() throws Throwable { doTest(Lookup.COMPLETE_STATEMENT_SELECT_CHAR as String) } - public void testTabReplacesMethodNameWithLocalVariableName() throws Throwable { doTest('\t'); } - public void testMethodParameterAnnotationClass() throws Throwable { doTest(); } - public void testInnerAnnotation() { doTest('\n'); } - public void testPrimitiveCastOverwrite() throws Throwable { doTest() } - public void testClassReferenceInFor() throws Throwable { doTest ' ' } - public void testClassReferenceInFor2() throws Throwable { doTest ' ' } - public void testClassReferenceInFor3() throws Throwable { + void testSmartEnterNoNewLine() { doTest(Lookup.COMPLETE_STATEMENT_SELECT_CHAR as String) } + + void testSmartEnterWithNewLine() { doTest(Lookup.COMPLETE_STATEMENT_SELECT_CHAR as String) } + + void testSmartEnterGuessArgumentCount() throws Throwable { doTest(Lookup.COMPLETE_STATEMENT_SELECT_CHAR as String) } + + void testSmartEnterInsideArrayBrackets() { doTest(Lookup.COMPLETE_STATEMENT_SELECT_CHAR as String) } + + void testTabReplacesMethodNameWithLocalVariableName() throws Throwable { doTest('\t'); } + + void testMethodParameterAnnotationClass() throws Throwable { doTest(); } + + void testInnerAnnotation() { doTest('\n'); } + + void testPrimitiveCastOverwrite() throws Throwable { doTest() } + + void testClassReferenceInFor() throws Throwable { doTest ' ' } + + void testClassReferenceInFor2() throws Throwable { doTest ' ' } + + void testClassReferenceInFor3() throws Throwable { CodeInsightSettings.instance.COMPLETION_CASE_SENSITIVE = CodeInsightSettings.NONE doTest ' ' } - public void testEnumConstantFromEnumMember() throws Throwable { doTest(); } + void testEnumConstantFromEnumMember() throws Throwable { doTest(); } - public void testPrimitiveMethodParameter() throws Throwable { doTest(); } + void testPrimitiveMethodParameter() throws Throwable { doTest(); } - public void testNewExpectedClassParens() throws Throwable { doTest('\n'); } + void testNewExpectedClassParens() throws Throwable { doTest('\n'); } - public void testQualifyInnerMembers() throws Throwable { doTest('\n') } + void testQualifyInnerMembers() throws Throwable { doTest('\n') } - public void testDeepInner() throws Throwable { + void testDeepInner() throws Throwable { configure() assert myFixture.lookupElementStrings == ['ClassInner1', 'ClassInner1.ClassInner2'] selectItem(lookup.items[1]) checkResult() } - public void testSuggestExpectedTypeMembers() throws Throwable { doTest('\n') } - public void testSuggestExpectedTypeMembersInCall() throws Throwable { doTest('\n') } - public void testSuggestExpectedTypeMembersInAnno() throws Throwable { doTest('\n') } - public void testExpectedTypesDotSelectsItem() throws Throwable { doTest('.') } + void testSuggestExpectedTypeMembers() throws Throwable { doTest('\n') } - public void testExpectedTypeMembersVersusStaticImports() throws Throwable { + void testSuggestExpectedTypeMembersInCall() throws Throwable { doTest('\n') } + + void testSuggestExpectedTypeMembersInAnno() throws Throwable { doTest('\n') } + + void testExpectedTypesDotSelectsItem() throws Throwable { doTest('.') } + + void testExpectedTypeMembersVersusStaticImports() throws Throwable { configure() assertStringItems('XFOO', 'XFOX') } - public void testDoubleExpectedTypeFactoryMethod() throws Throwable { + void testDoubleExpectedTypeFactoryMethod() throws Throwable { configure() assertStringItems('Key', 'create', 'create') assert renderElement(myItems[1]).itemText == 'Key.create' assert renderElement(myItems[2]).itemText == 'Key.create' } - public void testSuggestExpectedTypeMembersNonImported() throws Throwable { + void testSuggestExpectedTypeMembersNonImported() throws Throwable { myFixture.addClass("package foo; public class Super { public static final Super FOO = null; }") myFixture.addClass("package foo; public class Usage { public static void foo(Super s) {} }") doTest('\n') } - public void testStaticallyImportedInner() throws Throwable { + void testStaticallyImportedInner() throws Throwable { configure() assertStringItems('AIOInner', 'ArrayIndexOutOfBoundsException') } - public void testClassNameInIfBeforeIdentifier() throws Throwable { + void testClassNameInIfBeforeIdentifier() throws Throwable { myFixture.addClass("public class ABCDEFFFFF {}") doTest('\n') } - public void testClassNameWithInnersTab() throws Throwable { doTest('\t') } + void testClassNameWithInnersTab() throws Throwable { doTest('\t') } - public void testClassNameWithGenericsTab() throws Throwable {doTest('\t') } - public void testClassNameWithGenericsTab2() throws Throwable {doTest('\t') } + void testClassNameWithGenericsTab() throws Throwable { doTest('\t') } - public void testLiveTemplatePrefixTab() throws Throwable {doTest('\t') } + void testClassNameWithGenericsTab2() throws Throwable { doTest('\t') } - public void testOnlyAnnotationsAfterAt() throws Throwable { doTest() } - public void testOnlyAnnotationsAfterAt2() throws Throwable { doTest('\n') } - public void testAnnotationBeforeIdentifier() { doTest('\n') } - public void testAnnotationBeforeQualifiedReference() { doTest('\n') } - public void testAnnotationBeforeIdentifierFinishWithSpace() { doTest(' ') } + void testLiveTemplatePrefixTab() throws Throwable { doTest('\t') } - public void testOnlyExceptionsInCatch1() throws Exception { doTest('\n') } - public void testOnlyExceptionsInCatch2() throws Exception { doTest('\n') } - public void testOnlyExceptionsInCatch3() throws Exception { doTest('\n') } - public void testOnlyExceptionsInCatch4() throws Exception { doTest('\n') } + void testOnlyAnnotationsAfterAt() throws Throwable { doTest() } - public void testCommaAfterVariable() throws Throwable { doTest(',') } + void testOnlyAnnotationsAfterAt2() throws Throwable { doTest('\n') } - public void testClassAngleBracket() throws Throwable { doTest('<') } - public void testNoArgsMethodSpace() throws Throwable { doTest(' ') } + void testAnnotationBeforeIdentifier() { doTest('\n') } - public void testClassSquareBracket() throws Throwable { doTest('[') } - public void testPrimitiveSquareBracket() throws Throwable { doTest('[') } - public void testVariableSquareBracket() throws Throwable { doTest('[') } - public void testMethodSquareBracket() throws Throwable { doTest('[') } + void testAnnotationBeforeQualifiedReference() { doTest('\n') } - public void testMethodParameterTypeDot() throws Throwable { doAntiTest() } - public void testNewGenericClass() throws Throwable { doTest('\n') } - public void testNewGenericInterface() throws Throwable { doTest() } - public void testEnumPrivateFinal() throws Throwable { doTest() } - public void testNoFieldsInImplements() throws Throwable { doTest() } + void testAnnotationBeforeIdentifierFinishWithSpace() { doTest(' ') } - public void testSwitchConstantsFromReferencedClass() throws Throwable { doTest('\n') } - public void testSwitchValueFinishWithColon() throws Throwable { doTest(':') } + void testOnlyExceptionsInCatch1() throws Exception { doTest('\n') } - public void testUnfinishedMethodTypeParameter() throws Throwable { - configure() - assertStringItems("MyParameter", "MySecondParameter") - } - public void testUnfinishedMethodTypeParameter2() throws Throwable { + void testOnlyExceptionsInCatch2() throws Exception { doTest('\n') } + + void testOnlyExceptionsInCatch3() throws Exception { doTest('\n') } + + void testOnlyExceptionsInCatch4() throws Exception { doTest('\n') } + + void testCommaAfterVariable() throws Throwable { doTest(',') } + + void testClassAngleBracket() throws Throwable { doTest('<') } + + void testNoArgsMethodSpace() throws Throwable { doTest(' ') } + + void testClassSquareBracket() throws Throwable { doTest('[') } + + void testPrimitiveSquareBracket() throws Throwable { doTest('[') } + + void testVariableSquareBracket() throws Throwable { doTest('[') } + + void testMethodSquareBracket() throws Throwable { doTest('[') } + + void testMethodParameterTypeDot() throws Throwable { doAntiTest() } + + void testNewGenericClass() throws Throwable { doTest('\n') } + + void testNewGenericInterface() throws Throwable { doTest() } + + void testEnumPrivateFinal() throws Throwable { doTest() } + + void testNoFieldsInImplements() throws Throwable { doTest() } + + void testSwitchConstantsFromReferencedClass() throws Throwable { doTest('\n') } + + void testSwitchValueFinishWithColon() throws Throwable { doTest(':') } + + void testUnfinishedMethodTypeParameter() throws Throwable { configure() assertStringItems("MyParameter", "MySecondParameter") } - public void testSuperProtectedMethod() throws Throwable { + void testUnfinishedMethodTypeParameter2() throws Throwable { + configure() + assertStringItems("MyParameter", "MySecondParameter") + } + + void testSuperProtectedMethod() throws Throwable { myFixture.addClass """package foo; public class Bar { protected void foo() { } @@ -1069,13 +1124,13 @@ public class ListUtils { doTest() } - public void testOuterSuperMethodCall() { + void testOuterSuperMethodCall() { configure() assert 'Class2.super.put' == LookupElementPresentation.renderElement(myItems[0]).itemText type '\n' checkResult() } - public void testTopLevelClassesFromPackaged() throws Throwable { + void testTopLevelClassesFromPackaged() throws Throwable { myFixture.addClass "public class Fooooo {}" final text = "package foo; class Bar { Fooo }" def file = myFixture.addFileToProject("foo/Bar.java", text) @@ -1084,12 +1139,12 @@ public class ListUtils { myFixture.checkResult text } - public void testRightShift() throws Throwable { + void testRightShift() throws Throwable { configure() assertStringItems("myField1", "myField2"); } - public void testAfterCommonPrefix() throws Throwable { + void testAfterCommonPrefix() throws Throwable { configure() type 'eq' assertFirstStringItems("equals", "equalsIgnoreCase"); @@ -1099,14 +1154,14 @@ public class ListUtils { checkResult() } - public void testClassNameInsideIdentifierInIf() throws Throwable { + void testClassNameInsideIdentifierInIf() throws Throwable { configure() myFixture.complete(CompletionType.BASIC, 2) type '\n' checkResult() } - public void testKeywordSmartEnter() { + void testKeywordSmartEnter() { configure() myFixture.assertPreferredCompletionItems 0, 'null', 'nullity' myFixture.performEditorAction(IdeActions.ACTION_CHOOSE_LOOKUP_ITEM_COMPLETE_STATEMENT) @@ -1114,7 +1169,7 @@ public class ListUtils { } void testSynchronizedArgumentSmartEnter() { doTest(Lookup.COMPLETE_STATEMENT_SELECT_CHAR as String) } - public void testImportStringValue() throws Throwable { + void testImportStringValue() throws Throwable { myFixture.addClass("package foo; public class StringValue {}") myFixture.addClass("package java.lang; class StringValue {}") configure() @@ -1123,9 +1178,9 @@ public class ListUtils { checkResult() } - public void testPrimitiveArrayWithRBrace() throws Throwable { doTest '[' } + void testPrimitiveArrayWithRBrace() throws Throwable { doTest '[' } - public void testSuggestMembersOfStaticallyImportedClasses() throws Exception { + void testSuggestMembersOfStaticallyImportedClasses() throws Exception { myFixture.addClass("""package foo; public class Foo { public static void foo() {} @@ -1135,7 +1190,7 @@ public class ListUtils { doTest('\n') } - public void testSuggestMembersOfStaticallyImportedClassesUnqualifiedOnly() throws Exception { + void testSuggestMembersOfStaticallyImportedClassesUnqualifiedOnly() throws Exception { myFixture.addClass("""package foo; public class Foo { public static void foo() {} @@ -1149,31 +1204,38 @@ public class ListUtils { checkResult() } - public void testInstanceMagicMethod() throws Exception { doTest() } + void testInstanceMagicMethod() throws Exception { doTest() } - public void testNoDotOverwrite() throws Exception { doTest('.') } + void testNoDotOverwrite() throws Exception { doTest('.') } - public void testStaticInnerExtendingOuter() throws Exception { doTest() } - public void testPrimitiveClass() throws Exception { doTest() } - public void testPrimitiveArrayClass() throws Exception { doTest() } - public void testPrimitiveArrayOnlyClass() throws Exception { doAntiTest() } - public void testPrimitiveArrayInAnno() throws Exception { doTest() } + void testStaticInnerExtendingOuter() throws Exception { doTest() } - public void testNewClassAngleBracket() throws Exception { doTest('<') } - public void testNewClassAngleBracketExpected() throws Exception { doTest('<') } - public void testNewClassSquareBracket() throws Exception { doTest('[') } + void testPrimitiveClass() throws Exception { doTest() } - public void testMethodColon() throws Exception { doTest(':') } - public void testVariableColon() throws Exception { doTest(':') } + void testPrimitiveArrayClass() throws Exception { doTest() } - public void testFinishByClosingParenthesis() throws Exception { doTest(')') } + void testPrimitiveArrayOnlyClass() throws Exception { doAntiTest() } - public void testNoMethodsInParameterType() { + void testPrimitiveArrayInAnno() throws Exception { doTest() } + + void testNewClassAngleBracket() throws Exception { doTest('<') } + + void testNewClassAngleBracketExpected() throws Exception { doTest('<') } + + void testNewClassSquareBracket() throws Exception { doTest('[') } + + void testMethodColon() throws Exception { doTest(':') } + + void testVariableColon() throws Exception { doTest(':') } + + void testFinishByClosingParenthesis() throws Exception { doTest(')') } + + void testNoMethodsInParameterType() { configure() assertFirstStringItems "final", "float" } - public void testNonImportedClassInAnnotation() { + void testNonImportedClassInAnnotation() { myFixture.addClass("package foo; public class XInternalTimerServiceController {}") myFixture.configureByText "a.java", """ class XInternalError {} @@ -1184,22 +1246,22 @@ class XInternalError {} assertFirstStringItems "XInternalError", "XInternalTimerServiceController" } - public void testNonImportedAnnotationClass() { + void testNonImportedAnnotationClass() { myFixture.addClass("package foo; public @interface XAnotherAnno {}") configure() type('X') assertFirstStringItems "XAnno", "XAnotherAnno" } - public void testMetaAnnotation() { + void testMetaAnnotation() { myFixture.configureByText "a.java", "@ @interface Anno {}" myFixture.complete(CompletionType.BASIC) assert myFixture.lookup.items.find { it.lookupString == 'Retention' } } - public void testAnnotationClassFromWithinAnnotation() { doTest() } + void testAnnotationClassFromWithinAnnotation() { doTest() } - public void testStaticallyImportedFieldsTwice() { + void testStaticallyImportedFieldsTwice() { myFixture.addClass(""" class Foo { public static final int aZOO; @@ -1213,9 +1275,10 @@ class XInternalError {} """) assertOneElement myFixture.completeBasic() } - public void testStaticallyImportedFieldsTwiceSwitch() { doTest() } - public void testStatementKeywords() { + void testStaticallyImportedFieldsTwiceSwitch() { doTest() } + + void testStatementKeywords() { myFixture.configureByText("a.java", """ class Bar {{ xxx @@ -1233,7 +1296,7 @@ class XInternalError {} assertFalse 'new' in strings } - public void testExpressionKeywords() { + void testExpressionKeywords() { myFixture.configureByText("a.java", """ class Bar {{ foo(xxx) @@ -1244,14 +1307,14 @@ class XInternalError {} assertTrue 'new' in strings } - public void testImportAsterisk() { + void testImportAsterisk() { myFixture.configureByText "a.java", "import java.lang." myFixture.completeBasic() myFixture.type '*;' myFixture.checkResult "import java.lang.*;" } - public void testDontPreselectCaseInsensitivePrefixMatch() { + void testDontPreselectCaseInsensitivePrefixMatch() { CodeInsightSettings.instance.COMPLETION_CASE_SENSITIVE = CodeInsightSettings.NONE myFixture.configureByText "a.java", "import java.io.*; class Foo {{ int fileSize; filx }}" myFixture.completeBasic() @@ -1263,21 +1326,21 @@ class XInternalError {} assert lookup.currentItem == lookup.items[1] } - public void testNoGenericsWhenChoosingWithParen() { doTest('Ma(') } + void testNoGenericsWhenChoosingWithParen() { doTest('Ma(') } - public void testNoClosingWhenChoosingWithParenBeforeIdentifier() { doTest '(' } + void testNoClosingWhenChoosingWithParenBeforeIdentifier() { doTest '(' } - public void testPackageInMemberType() { doTest() } + void testPackageInMemberType() { doTest() } - public void testConstantInAnno() { doTest() } + void testConstantInAnno() { doTest() } - public void testCharsetName() { + void testCharsetName() { myFixture.addClass("package java.nio.charset; public class Charset { public static Charset forName(String s) {} }") configureByTestName() assert myFixture.lookupElementStrings.contains('UTF-8') } - public void testInnerClassInExtendsGenerics() { + void testInnerClassInExtendsGenerics() { def text = "package bar; class Foo extends List> { public static class Inner {} }" myFixture.configureFromExistingVirtualFile(myFixture.addClass(text).containingFile.virtualFile) myFixture.completeBasic() @@ -1285,9 +1348,9 @@ class XInternalError {} myFixture.checkResult(text.replace('Inne', 'Foo.Inner')) } - public void testClassNameDot() { doTest('.') } + void testClassNameDot() { doTest('.') } - public void testClassNameDotBeforeCall() { + void testClassNameDotBeforeCall() { myFixture.addClass("package foo; public class FileInputStreamSmth {}") myFixture.configureByFile(getTestName(false) + ".java") PsiDocumentManager.getInstance(project).commitAllDocuments() @@ -1299,25 +1362,25 @@ class XInternalError {} checkResult() } - public void testNoReturnAfterDot() { + void testNoReturnAfterDot() { configure() assert !('return' in myFixture.lookupElementStrings) } - public void testDuplicateExpectedTypeInTypeArgumentList() { + void testDuplicateExpectedTypeInTypeArgumentList() { configure() def items = myFixture.lookupElements.findAll { it.lookupString == 'String' } assert items.size() == 1 assert LookupElementPresentation.renderElement(items[0]).tailText == ' (java.lang)' } - public void testDuplicateInnerClass() { + void testDuplicateInnerClass() { configure() def items = myFixture.lookupElements.findAll { it.lookupString == 'Inner' } assert items.size() == 1 } - public void testSameSignature() { + void testSameSignature() { configure() myFixture.assertPreferredCompletionItems(0, 's', 's, file', 's, file, a') lookup.setCurrentItem(lookup.items[2]) @@ -1325,9 +1388,9 @@ class XInternalError {} checkResult() } - public void testNoParenthesesAroundCallQualifier() { doTest() } + void testNoParenthesesAroundCallQualifier() { doTest() } - public void testAllAssertClassesMethods() { + void testAllAssertClassesMethods() { myFixture.addClass 'package foo; public class Assert { public static boolean foo() {} }' myFixture.addClass 'package bar; public class Assert { public static boolean bar() {} }' configure() @@ -1336,7 +1399,7 @@ class XInternalError {} checkResult() } - public void testCastVisually() { + void testCastVisually() { configure() def p = LookupElementPresentation.renderElement(myFixture.lookupElements[0]) assert p.itemText == 'getValue' @@ -1344,14 +1407,14 @@ class XInternalError {} assert p.typeText == 'Foo' } - public void testSuggestEmptySet() { + void testSuggestEmptySet() { configure() assert 'emptySet' == myFixture.lookupElementStrings[0] type '\n' checkResult() } - public void testSuggestAllTypeArguments() { + void testSuggestAllTypeArguments() { configure() assert 'String, List' == lookup.items[0].lookupString assert 'String, List' == LookupElementPresentation.renderElement(lookup.items[0]).itemText @@ -1359,7 +1422,7 @@ class XInternalError {} checkResult() } - public void testMakeMultipleArgumentsFinalWhenInInner() { + void testMakeMultipleArgumentsFinalWhenInInner() { configure() def item = lookup.items.find { 'a, b' == it.lookupString } assert item @@ -1368,29 +1431,34 @@ class XInternalError {} checkResult() } - public void testNoFinalInAnonymousConstructor() { doTest() } - public void testListArrayListCast() { doTest('\n') } - public void testInterfaceImplementationNoCast() { doTest() } - public void testStaticallyImportedMethodsBeforeExpression() { doTest() } - public void testInnerChainedReturnType() { doTest() } - public void testOverwriteGenericsAfterNew() { doTest('\n') } + void testNoFinalInAnonymousConstructor() { doTest() } + + void testListArrayListCast() { doTest('\n') } + + void testInterfaceImplementationNoCast() { doTest() } + + void testStaticallyImportedMethodsBeforeExpression() { doTest() } + + void testInnerChainedReturnType() { doTest() } + + void testOverwriteGenericsAfterNew() { doTest('\n') } private CommonCodeStyleSettings getCodeStyleSettings() { return CodeStyleSettingsManager.getSettings(getProject()).getCommonSettings(JavaLanguage.INSTANCE); } - public void testCompatibleInterfacesCast() { + void testCompatibleInterfacesCast() { configure() assert myFixture.lookupElementStrings.containsAll(['foo', 'bar']) } - public void testDontAutoInsertMiddleMatch() { + void testDontAutoInsertMiddleMatch() { configure() checkResult() assert lookup.items.size() == 1 } - public void testImplementViaCompletion() { + void testImplementViaCompletion() { configure() myFixture.assertPreferredCompletionItems 0, 'private', 'protected', 'public', 'public void run' def item = lookup.items[3] @@ -1405,7 +1473,7 @@ class XInternalError {} checkResult() } - public void testImplementViaOverrideCompletion() { + void testImplementViaOverrideCompletion() { configure() myFixture.assertPreferredCompletionItems 0, 'Override', 'public void run' lookup.currentItem = lookup.items[1] @@ -1413,14 +1481,14 @@ class XInternalError {} checkResult() } - public void testStrikeOutDeprecatedSuperMethods() { + void testStrikeOutDeprecatedSuperMethods() { configure() myFixture.assertPreferredCompletionItems 0, 'void foo1', 'void foo2' assert !LookupElementPresentation.renderElement(lookup.items[0]).strikeout assert LookupElementPresentation.renderElement(lookup.items[1]).strikeout } - public void testAccessorViaCompletion() { + void testAccessorViaCompletion() { configure() def getter = myFixture.lookupElements.find { it.lookupString == 'public int getField' } @@ -1443,25 +1511,25 @@ class XInternalError {} checkResult() } - public void testBraceOnNextLine() { + void testBraceOnNextLine() { codeStyleSettings.BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE doTest() } - public void testDoForceBraces() { + void testDoForceBraces() { codeStyleSettings.DOWHILE_BRACE_FORCE = CommonCodeStyleSettings.FORCE_BRACES_ALWAYS doTest('\n') } - public void testMulticaretSingleItemInsertion() { + void testMulticaretSingleItemInsertion() { doTest() } - public void testMulticaretMethodWithParen() { + void testMulticaretMethodWithParen() { doTest() } - public void testMulticaretTyping() { + void testMulticaretTyping() { configure() assert lookup type('p') @@ -1470,16 +1538,16 @@ class XInternalError {} checkResult() } - public void testMulticaretCompletionFromNonPrimaryCaret() { + void testMulticaretCompletionFromNonPrimaryCaret() { configure() myFixture.assertPreferredCompletionItems(0, "arraycopy") } - public void testMulticaretCompletionFromNonPrimaryCaretWithTab() { + void testMulticaretCompletionFromNonPrimaryCaretWithTab() { doTest '\t' } - public void "test complete lowercase class name"() { + void "test complete lowercase class name"() { myFixture.addClass("package foo; public class myClass {}") myFixture.configureByText "a.java", """ class Foo extends my @@ -1491,7 +1559,7 @@ class Foo extends myClass ''' } - public void "test don't show static inner class after instance qualifier"() { + void "test don't show static inner class after instance qualifier"() { myFixture.configureByText "a.java", """ class Foo { static class Inner {} @@ -1506,7 +1574,7 @@ class Bar { assert !('Inner' in myFixture.lookupElementStrings) } - public void "test show static member after instance qualifier when nothing matches"() { + void "test show static member after instance qualifier when nothing matches"() { myFixture.configureByText "a.java", "class Foo{{ \"\". }}" myFixture.completeBasic() assert !('valueOf' in myFixture.lookupElementStrings) @@ -1516,34 +1584,34 @@ class Bar { assert ('valueOf' in myFixture.lookupElementStrings) } - public void testNoMathTargetMethods() { doAntiTest() } + void testNoMathTargetMethods() { doAntiTest() } - public void testNoLowercaseClasses() { + void testNoLowercaseClasses() { myFixture.addClass("package foo; public class abcdefgXxx {}") doAntiTest() myFixture.complete(CompletionType.BASIC, 2) assertStringItems('abcdefgXxx') } - public void testProtectedFieldInAnotherPackage() { + void testProtectedFieldInAnotherPackage() { myFixture.addClass("package foo; public class Super { protected String myString; }"); doTest() } - public void testUnimportedStaticInnerClass() { + void testUnimportedStaticInnerClass() { myFixture.addClass("package foo; public class Super { public static class Inner {} }"); doTest() } - public void testNoJavaLangPackagesInImport() { doAntiTest() } + void testNoJavaLangPackagesInImport() { doAntiTest() } - public void testNoStaticDuplicatesFromExpectedMemberFactories() { + void testNoStaticDuplicatesFromExpectedMemberFactories() { configure() myFixture.complete(CompletionType.BASIC, 2) myFixture.assertPreferredCompletionItems(0, "xcreateZoo", "xcreateElephant"); } - public void testNoInaccessibleCompiledElements() { + void testNoInaccessibleCompiledElements() { configure() myFixture.complete(CompletionType.BASIC, 2) checkResultByFile(getTestName(false) + ".java"); @@ -1551,7 +1619,7 @@ class Bar { assertNull(getLookup()); } - public void "test code cleanup during completion generation"() { + void "test code cleanup during completion generation"() { myFixture.configureByText "a.java", "class Foo {int i; ge}" myFixture.enableInspections(new UnqualifiedFieldAccessInspection()) myFixture.complete(CompletionType.BASIC) @@ -1563,10 +1631,10 @@ class Bar { } }''' } - - public void testIndentingForSwitchCase() { doTest() } - public void testIncrementalCopyReparse() { + void testIndentingForSwitchCase() { doTest() } + + void testIncrementalCopyReparse() { ((PsiDocumentManagerBase)PsiDocumentManager.getInstance(project)).disableBackgroundCommit(testRootDisposable) myFixture.configureByText('a.java', 'class Fooxxxxxxxxxx { Fooxxxxxa f;\n' + 'public void foo() {}\n' * 10000 + '}') @@ -1585,12 +1653,12 @@ class Bar { assert c1.is(c2) } - public void testShowMostSpecificOverride() { + void testShowMostSpecificOverride() { configure() assert 'B' == LookupElementPresentation.renderElement(myFixture.lookup.items[0]).typeText } - public void testShowVarInitializers() { + void testShowVarInitializers() { configure() assert LookupElementPresentation.renderElement(myFixture.lookup.items[0]).tailText == '( "x")' assert LookupElementPresentation.renderElement(myFixture.lookup.items[1]).tailText == '("y") {...}' @@ -1598,13 +1666,13 @@ class Bar { assert LookupElementPresentation.renderElement(myFixture.lookup.items[3]).tailText == ' = 42' } - public void testSuggestInterfaceArrayWhenObjectIsExpected() { + void testSuggestInterfaceArrayWhenObjectIsExpected() { configure() assert LookupElementPresentation.renderElement(myFixture.lookup.items[0]).tailText.contains('{...}') assert LookupElementPresentation.renderElement(myFixture.lookup.items[1]).tailText.contains('[]') } - public void testSuggestInterfaceArrayWhenObjectArrayIsExpected() { + void testSuggestInterfaceArrayWhenObjectArrayIsExpected() { configure() assert LookupElementPresentation.renderElement(myFixture.lookup.items[0]).tailText.contains('{...}') assert LookupElementPresentation.renderElement(myFixture.lookup.items[1]).tailText.contains('[]') diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SeemsScrambledTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SeemsScrambledTest.groovy index c232078f2061..21f3d871c3d1 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SeemsScrambledTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SeemsScrambledTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,19 +23,19 @@ import static com.intellij.psi.impl.source.tree.java.PsiReferenceExpressionImpl. */ class SeemsScrambledTest extends LightCodeInsightFixtureTestCase { - public void "test Id annotation"() { + void "test Id annotation"() { assert !seemsScrambledByStructure(myFixture.addClass('public @interface Id {}')) } - public void "test inner enum"() { + void "test inner enum"() { assert !seemsScrambledByStructure(myFixture.addClass('public class Foo { enum v1 {} }').innerClasses[0]) } - public void "test scrambled"() { + void "test scrambled"() { assert seemsScrambledByStructure(myFixture.addClass('public class a { void b() {} }')) } - public void "test has non-scrambled method"() { + void "test has non-scrambled method"() { assert !seemsScrambledByStructure(myFixture.addClass('public class a { void doSomething() {} }')) } 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 433142eb4b1b..9be92e2637f4 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionOrderingTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionOrderingTest.groovy @@ -1,5 +1,17 @@ /* - * Copyright (c) 2000-2007 JetBrains s.r.o. All Rights Reserved. + * Copyright 2000-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.intellij.codeInsight.completion; @@ -13,23 +25,23 @@ import com.intellij.psi.PsiClass import com.intellij.psi.statistics.StatisticsManager import com.intellij.openapi.fileEditor.FileDocumentManager -public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase { - private static final String BASE_PATH = "/codeInsight/completion/smartTypeSorting"; +class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase { + private static final String BASE_PATH = "/codeInsight/completion/smartTypeSorting"; - public SmartTypeCompletionOrderingTest() { + SmartTypeCompletionOrderingTest() { super(CompletionType.SMART); } - public void testJComponentAdd() throws Throwable { + void testJComponentAdd() throws Throwable { checkPreferredItems(0, "name", "b", "fooBean239", "foo", "this"); } - - public void testJComponentAddNew() throws Throwable { + + void testJComponentAddNew() throws Throwable { //there's no PopupMenu in mock jdk checkPreferredItems(2, "Component", "String", "FooBean3", "JComponent", "Container"); } - public void testJComponentAddNewWithStats() throws Throwable { + void testJComponentAddNewWithStats() throws Throwable { //there's no PopupMenu in mock jdk final LookupImpl lookup = invokeCompletion("/JComponentAddNew.java"); assertPreferredItems(2, "Component", "String", "FooBean3", "JComponent", "Container"); @@ -50,7 +62,7 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase { assertPreferredItems(1, "String", "Component", "FooBean3"); } - public void testNewListAlwaysFirst() { + void testNewListAlwaysFirst() { def lookup = invokeCompletion(getTestName(false) + ".java") assertPreferredItems 1, 'List', 'ArrayList', 'AbstractList', 'AbstractSequentialList' for (int i = 0; i < StatisticsManager.OBLIVION_THRESHOLD + 10; i++) { @@ -59,8 +71,8 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase { refreshSorting(lookup) assertPreferredItems 1, 'List', 'AbstractSequentialList', 'ArrayList', 'AbstractList' } - - public void testNoStatsOnUnsuccessfulAttempt() { + + void testNoStatsOnUnsuccessfulAttempt() { final LookupImpl lookup = invokeCompletion("/JComponentAddNew.java"); assertPreferredItems(2, "Component", "String", "FooBean3", "JComponent", "Container"); lookup.currentItem = lookup.items[4] //Container @@ -71,108 +83,108 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase { assertPreferredItems(2, "Component", "String", "FooBean3", "JComponent", "Container"); } - public void testMethodStats() throws Throwable { + void testMethodStats() throws Throwable { final LookupImpl lookup = invokeCompletion(getTestName(false) + ".java"); assertPreferredItems(0, "bar", "foo", "goo"); incUseCount(lookup, 2); assertPreferredItems(0, "goo", "bar", "foo"); } - public void testNewRunnable() throws Throwable { + void testNewRunnable() throws Throwable { checkPreferredItems(0, "Runnable", "MyAnotherRunnable", "MyRunnable", "Thread"); } - public void testNewComponent() throws Throwable { + void testNewComponent() throws Throwable { checkPreferredItems(1, "Component", "Foo", "JComponent", "Container"); } - - public void testClassLiteral() throws Throwable { + + void testClassLiteral() throws Throwable { checkPreferredItems(0, "String.class"); } - public void testMethodsWithSubstitutableReturnType() throws Throwable { + void testMethodsWithSubstitutableReturnType() throws Throwable { checkPreferredItems(0, "foo", "toString", "bar"); } - public void testDontPreferKeywords() throws Throwable { + void testDontPreferKeywords() throws Throwable { checkPreferredItems(0, "o1", "foo", "name", "this"); } - public void testEnumValueOf() throws Throwable { + void testEnumValueOf() throws Throwable { checkPreferredItems(0, "e", "MyEnum.BAR", "MyEnum.FOO", "valueOf", "valueOf"); } - public void testEnumValueOf2() throws Throwable { + void testEnumValueOf2() throws Throwable { checkPreferredItems(0, "e", "MyEnum.BAR", "MyEnum.FOO", "bar", "valueOf"); } - public void testPreferMatchedWords() throws Throwable { + void testPreferMatchedWords() throws Throwable { checkPreferredItems(0, "getVersionString", "getTitle"); } - public void testPreferImportedClasses() throws Throwable { + void testPreferImportedClasses() throws Throwable { //there's no PopupMenu in mock jdk checkPreferredItems(2, "Component", "String", "FooBean3", "JPanel", "JComponent"); } - - public void testPreferNestedClasses() throws Throwable { + + void testPreferNestedClasses() throws Throwable { //there's no PopupMenu in mock jdk checkPreferredItems(2, "Component", "String", "FooBean3", "NestedClass", "JComponent"); } - public void testSmartCollections() throws Throwable { + void testSmartCollections() throws Throwable { checkPreferredItems(0, "s"); } - public void testSmartEquals() throws Throwable { + void testSmartEquals() throws Throwable { checkPreferredItems(0, "s"); } - public void testSmartEquals2() throws Throwable { + void testSmartEquals2() throws Throwable { checkPreferredItems(0, "foo", "this", "o", "s"); } - public void testSmartEquals3() throws Throwable { + void testSmartEquals3() throws Throwable { checkPreferredItems(0, "b", "this", "a", "z"); } - public void testSmartCollectionsNew() throws Throwable { + void testSmartCollectionsNew() throws Throwable { checkPreferredItems(1, "Foo", "Bar"); } - public void testSmartEqualsNew() throws Throwable { + void testSmartEqualsNew() throws Throwable { checkPreferredItems(1, "Foo", "Bar"); } - - public void testSmartEqualsNew2() throws Throwable { + + void testSmartEqualsNew2() throws Throwable { checkPreferredItems(0, "Foo"); } - public void testBooleanValueOf() throws Throwable { + void testBooleanValueOf() throws Throwable { checkPreferredItems(0, "b", "Boolean.FALSE", "Boolean.TRUE", "equals", "false", "true", "valueOf", "valueOf"); } - - public void testXmlTagGetAttribute() throws Throwable { + + void testXmlTagGetAttribute() throws Throwable { checkPreferredItems(0, "getAttributeValue", "getNamespace", "toString"); } - public void testPreferFieldsToMethods() throws Throwable { + void testPreferFieldsToMethods() throws Throwable { checkPreferredItems(0, "myVersion", "getVersion", "getSelectedVersion", "calculateVersion"); } - public void testPreferFieldsToConstants() { + void testPreferFieldsToConstants() { checkPreferredItems(0, "dateField", "LocalDate.MAX", "LocalDate.MIN"); } - public void testPreferParametersToGetters() throws Throwable { + void testPreferParametersToGetters() throws Throwable { checkPreferredItems(0, "a", "I._1", "getLastI", "valueOf"); } - public void testExpectedInterfaceShouldGoFirst() throws Throwable { + void testExpectedInterfaceShouldGoFirst() throws Throwable { checkPreferredItems(0, "MyProcessor", "Proc1"); } - public void testStatisticsAffectsNonPreferableExpectedItems() throws Throwable { + void testStatisticsAffectsNonPreferableExpectedItems() throws Throwable { final LookupImpl lookup = invokeCompletion(getTestName(false) + ".java"); assertPreferredItems(1, "List", "ArrayList", "AbstractList", "AbstractSequentialList"); incUseCount(lookup, 0); @@ -181,11 +193,11 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase { assertPreferredItems(0, "List", "ArrayList", "AbstractList", "AbstractSequentialList"); } - public void testPreferNonRecursiveMethodParams() throws Throwable { + void testPreferNonRecursiveMethodParams() throws Throwable { checkPreferredItems(0, "b", "s", "a", "hashCode"); } - public void testPreferDelegatingMethodParams() throws Throwable { + void testPreferDelegatingMethodParams() throws Throwable { //there's no PopupMenu in mock jdk final LookupImpl lookup = invokeCompletion(getTestName(false) + ".java"); assertPreferredItems(0, "xyz", "abc"); @@ -193,55 +205,55 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase { assertPreferredItems(0, "xyz", "abc"); } - public void testGwtButtons() throws Throwable { + void testGwtButtons() throws Throwable { checkPreferredItems(0, "Button", "ButtonBase"); } - public void testNewArrayList() throws Throwable { + void testNewArrayList() throws Throwable { checkPreferredItems(0, "ArrayList", "OtherList"); } - public void testPassingQualifierToMethodCall() throws Throwable { + void testPassingQualifierToMethodCall() throws Throwable { checkPreferredItems(0, "this", "param"); } - public void testPassingThisToUnqualifiedMethodCall() throws Throwable { + void testPassingThisToUnqualifiedMethodCall() throws Throwable { checkPreferredItems(0, "param", "this"); } - public void testPreferAccessibleMembers() throws Throwable { + void testPreferAccessibleMembers() throws Throwable { checkPreferredItems(0, "Foo.C_NORMAL", "Foo.B_DEPRECATED"); } - public void testNoSkippingInSmartCast() throws Throwable { + void testNoSkippingInSmartCast() throws Throwable { checkPreferredItems(0, "Foo", "Bar", "Goo"); } - public void testLiteralInReturn() throws Throwable { + void testLiteralInReturn() throws Throwable { checkPreferredItems(0, "false", "true", "equals"); } - public void testLiteralInIf() throws Throwable { + void testLiteralInIf() throws Throwable { checkPreferredItems(0, "equals", "false", "true"); } - public void testFactoryMethodForDefaultType() throws Throwable { + void testFactoryMethodForDefaultType() throws Throwable { checkPreferredItems(0, "create", "this"); } - public void testLocalVarsBeforeClassLiterals() throws Throwable { + void testLocalVarsBeforeClassLiterals() throws Throwable { checkPreferredItems(0, "local", "Foo.class", "Bar.class"); } - public void testPreferInstanceofed() throws Throwable { + void testPreferInstanceofed() throws Throwable { checkPreferredItems(0, "_o", "b"); } - public void testInnerClassesProximity() throws Throwable { + void testInnerClassesProximity() throws Throwable { checkPreferredItems(0, "Goo", "InnerGoo", "Bar", "AGoo"); } - public void testLocalVariablesOutweighStats() throws Throwable { + void testLocalVariablesOutweighStats() throws Throwable { final LookupImpl lookup = invokeCompletion(getTestName(false) + ".java"); assertPreferredItems(0, "foo", "param", "this", "bar", "goo"); incUseCount(lookup, 4); @@ -253,7 +265,7 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase { assertPreferredItems(0, "foo", "param", "this", "goo", "bar"); } - public void testPreferredByNameDontChangeStatistics() throws Throwable { + void testPreferredByNameDontChangeStatistics() throws Throwable { invokeCompletion(getTestName(false) + ".java"); assertPreferredItems(0, "foo", "false"); myFixture.type(','); @@ -261,18 +273,18 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase { assertPreferredItems(0, "bar", "foo", "equals", "false", "true"); } - public void testExpectedNameDependentStats() throws Throwable { + void testExpectedNameDependentStats() throws Throwable { final LookupImpl lookup = invokeCompletion(getTestName(false) + ".java"); assertPreferredItems(0, "myFoo", "myBar"); incUseCount(lookup, 1); //myBar assertPreferredItems(0, "myBar", "myFoo"); } - public void testPreferSameNamedMethods() { + void testPreferSameNamedMethods() { checkPreferredItems(0, "foo", "boo", "doo", "hashCode"); } - public void testErasureNotAffectingProximity() { + void testErasureNotAffectingProximity() { myFixture.addClass("package foo; public interface Foo {}"); myFixture.addClass("package bar; public class Bar implements foo.Foo {}"); myFixture.addClass("public class Bar implements foo.Foo {}"); @@ -292,12 +304,12 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase { assertEquals("Bar", presentation.getItemText()); } - public void testAssertEquals() throws Throwable { + void testAssertEquals() throws Throwable { myFixture.addClass("package junit.framework; public class Assert { public static void assertEquals(Object a, Object b) {} }"); checkPreferredItems(0, "boo", "bar") } - public void testPreferCollectionsEmptyList() throws Throwable { + void testPreferCollectionsEmptyList() throws Throwable { myFixture.addClass("package foo; public class FList implements java.util.List { public static FList emptyList() {} }"); configureNoCompletion(getTestName(false) + ".java"); myFixture.complete(CompletionType.SMART, 2); @@ -305,37 +317,43 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase { assertPreferredItems(0, "local", "local.subList", "locMethod") } - public void testDispreferGetterInSetterCall() { + void testDispreferGetterInSetterCall() { checkPreferredItems 0, 'color', 'getZooColor', 'getColor', 'hashCode' } - public void testPreferOtherGetterInSetterCall() { + + void testPreferOtherGetterInSetterCall() { checkPreferredItems 0, 'color', 'getColor', 'getZooColor', 'hashCode' } - public void testPreferLocalOverFactoryMatchingName() { + + void testPreferLocalOverFactoryMatchingName() { checkPreferredItems 0, 'e', 'createEvent' } - public void testPreferLocalOverThis() { + + void testPreferLocalOverThis() { checkPreferredItems 0, 'value', 'this', 'hashCode' } - public void testGetLogger() { + void testGetLogger() { checkPreferredItems 0, 'Foo.class', 'forName' } - public void testGetWildcardLogger() { + + void testGetWildcardLogger() { checkPreferredItems 0, 'Foo.class', 'forName' } - public void testGetWildcardFactoryLogger() { + + void testGetWildcardFactoryLogger() { checkPreferredItems 0, 'Foo.class', 'forName' } - public void testPreferLocalWildcardClassOverObject() { + + void testPreferLocalWildcardClassOverObject() { checkPreferredItems 0, 'type', 'Object.class' } - public void testPreferStringsInStringConcatenation() { + void testPreferStringsInStringConcatenation() { checkPreferredItems 0, 'toString' } - public void testGlobalStaticMemberStats() { + void testGlobalStaticMemberStats() { configureNoCompletion(getTestName(false) + ".java") myFixture.complete(CompletionType.SMART, 2) assertPreferredItems 0, 'newLinkedSet0', 'newLinkedSet1', 'newLinkedSet2' @@ -343,7 +361,7 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase { assertPreferredItems 0, 'newLinkedSet1', 'newLinkedSet0', 'newLinkedSet2' } - public void testPreferExpectedTypeMembers() { + void testPreferExpectedTypeMembers() { configureNoCompletion(getTestName(false) + ".java") myFixture.complete(CompletionType.SMART, 2) assertPreferredItems 0, 'MyColor.RED', 'Another.RED' diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/VariablesCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/VariablesCompletionTest.groovy index 426414f245f6..185a7242c0bc 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/VariablesCompletionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/VariablesCompletionTest.groovy @@ -1,10 +1,25 @@ +/* + * Copyright 2000-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.codeInsight.completion import com.intellij.JavaTestUtil import com.intellij.ide.highlighter.JavaFileType import com.intellij.psi.codeStyle.CodeStyleSettings import com.intellij.psi.codeStyle.CodeStyleSettingsManager -public class VariablesCompletionTest extends LightFixtureCompletionTestCase { +class VariablesCompletionTest extends LightFixtureCompletionTestCase { public static final String FILE_PREFIX = "/codeInsight/completion/variables/"; @Override @@ -12,72 +27,73 @@ public class VariablesCompletionTest extends LightFixtureCompletionTestCase { return JavaTestUtil.getRelativeJavaTestDataPath(); } - public void testObjectVariable() throws Exception { + void testObjectVariable() throws Exception { configureByFile(FILE_PREFIX + "locals/" + getTestName(false) + ".java"); checkResultByFile(FILE_PREFIX + "locals/" + getTestName(false) + "_after.java"); } - public void testStringVariable() throws Exception { + void testStringVariable() throws Exception { configureByFile(FILE_PREFIX + "locals/" + getTestName(false) + ".java"); checkResultByFile(FILE_PREFIX + "locals/" + getTestName(false) + "_after.java"); } - public void testInputMethodEventVariable() throws Exception { + void testInputMethodEventVariable() throws Exception { myFixture.addClass("package java.awt.event; public interface InputMethodEvent {}"); configureByFile(FILE_PREFIX + "locals/" + getTestName(false) + ".java"); checkResultByFile(FILE_PREFIX + "locals/" + getTestName(false) + "_after.java"); } - public void testLocals1() throws Exception { + void testLocals1() throws Exception { doSelectTest("TestSource1.java", "TestResult1.java"); } - public void testInterfaceMethod() throws Exception { + void testInterfaceMethod() throws Exception { configureByFile(FILE_PREFIX + "locals/" + "InterfaceMethod.java"); assertStringItems("calcGooBarDoo", "calcBarDoo", "calcDoo"); } - public void testLocals2() throws Exception { + void testLocals2() throws Exception { configureByFile(FILE_PREFIX + "locals/" + "TestSource2.java"); myFixture.assertPreferredCompletionItems 0, 'abc', 'aaa' checkResultByFile(FILE_PREFIX + "locals/" + "TestResult2.java"); } - public void testLocals3() throws Exception { + void testLocals3() throws Exception { doTest("TestSource3.java", "TestResult3.java"); } - public void testLocals4() throws Exception { + void testLocals4() throws Exception { doSelectTest("TestSource4.java", "TestResult4.java"); } - public void testLocals5() throws Exception { + void testLocals5() throws Exception { doTest("TestSource5.java", "TestResult5.java"); } - public void testLocals6() throws Exception { + void testLocals6() throws Exception { doSelectTest("TestSource6.java", "TestResult6.java"); } - public void testLocals7() throws Exception { + void testLocals7() throws Exception { doTest("TestSource7.java", "TestResult7.java"); } - public void testLocalReserved() throws Exception { + void testLocalReserved() throws Exception { doTest("LocalReserved.java", "LocalReserved_after.java"); } - public void testLocalReserved2() throws Exception { + void testLocalReserved2() throws Exception { configureByFile(FILE_PREFIX + "locals/" + "LocalReserved2.java") checkResultByFile(FILE_PREFIX + "locals/" + "LocalReserved2.java"); assert !myFixture.lookupElementStrings } - public void testUniqueNameInFor() throws Exception { + void testUniqueNameInFor() throws Exception { doTest(getTestName(false) + ".java", getTestName(false) + "_after.java"); } - public void testWithBuilderParameter() throws Exception { + + void testWithBuilderParameter() throws Exception { doTest(getTestName(false) + ".java", getTestName(false) + "_after.java"); } @@ -92,16 +108,16 @@ public class VariablesCompletionTest extends LightFixtureCompletionTestCase { checkResultByFile(FILE_PREFIX + "locals/" + after); } - public void testLocals8() throws Exception { + void testLocals8() throws Exception { doTest("TestSource8.java", "TestResult8.java"); } - public void testUnresolvedReference() throws Exception { + void testUnresolvedReference() throws Exception { configureByFile(FILE_PREFIX + "locals/" + getTestName(false) + ".java"); assertStringItems("o", "psiClass"); } - public void testFieldNameCompletion1() throws Exception { + void testFieldNameCompletion1() throws Exception { CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject()); String oldPrefix = settings.FIELD_NAME_PREFIX; settings.FIELD_NAME_PREFIX = "my"; @@ -113,7 +129,7 @@ public class VariablesCompletionTest extends LightFixtureCompletionTestCase { } } - public void testFieldNameCompletion2() throws Exception { + void testFieldNameCompletion2() throws Exception { CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(project); String oldPrefix = settings.FIELD_NAME_PREFIX; settings.FIELD_NAME_PREFIX = "my"; @@ -122,7 +138,7 @@ public class VariablesCompletionTest extends LightFixtureCompletionTestCase { checkResultByFile(FILE_PREFIX + "locals/" + "FieldNameCompletion2-result.java"); } - public void testFieldNameCompletion3() throws Exception { + void testFieldNameCompletion3() throws Exception { CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(project); String oldPrefix = settings.FIELD_NAME_PREFIX; settings.FIELD_NAME_PREFIX = "my"; @@ -132,71 +148,71 @@ public class VariablesCompletionTest extends LightFixtureCompletionTestCase { checkResultByFile(FILE_PREFIX + "locals/" + "FieldNameCompletion3-result.java"); } - public void testLocals9() throws Exception { + void testLocals9() throws Exception { doSelectTest("TestSource9.java", "TestResult9.java"); } - public void testFieldOutOfAnonymous() throws Exception { + void testFieldOutOfAnonymous() throws Exception { doTest("TestFieldOutOfAnonymous.java", "TestFieldOutOfAnonymousResult.java"); } - public void testUnresolvedMethodName() throws Exception { + void testUnresolvedMethodName() throws Exception { configureByFile(FILE_PREFIX + "locals/" + "UnresolvedMethodName.java"); complete(); checkResultByFile(FILE_PREFIX + "locals/" + "UnresolvedMethodName_after.java"); } - public void testArrayMethodName() throws Throwable { + void testArrayMethodName() throws Throwable { doTest("ArrayMethodName.java", "ArrayMethodName-result.java"); } - public void testInitializerMatters() throws Exception { + void testInitializerMatters() throws Exception { myFixture.configureByText(JavaFileType.INSTANCE, "class Foo {{ String fx = getFoo(); }; String getFoo() {}; }"); complete(); assertStringItems("foo"); } - public void testFieldInitializerMatters() throws Exception { + void testFieldInitializerMatters() throws Exception { myFixture.configureByText(JavaFileType.INSTANCE, "class Foo { String fx = getFoo(); String getFoo() {}; }"); complete(); assertStringItems("foo", "fString"); } - public void testNoKeywordsInForLoopVariableName() throws Throwable { + void testNoKeywordsInForLoopVariableName() throws Throwable { configure() assertStringItems("stringBuffer", "buffer"); } - public void testDontIterateOverLoopVariable() throws Throwable { + void testDontIterateOverLoopVariable() throws Throwable { configure() myFixture.assertPreferredCompletionItems 0, 'nodes', 'new', 'null' } - public void testDuplicateSuggestionsFromUsage() { + void testDuplicateSuggestionsFromUsage() { configure(); assertStringItems("preferencePolicy", "policy", "aPreferencePolicy"); } - public void testSuggestVariablesInTypePosition() { + void testSuggestVariablesInTypePosition() { configure(); assertStringItems("myField", "myField2"); } - public void configure() { + void configure() { configureByFile(FILE_PREFIX + getTestName(false) + ".java") } - public void testAnnotationValue() { + void testAnnotationValue() { configure() checkResultByFile(FILE_PREFIX + getTestName(false) + "_after.java") } - public void testConstructorParameterName() { + void testConstructorParameterName() { configure() assertStringItems("color"); } - public void testConstructorParameterNameWithPrefix() { + void testConstructorParameterNameWithPrefix() { CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(project); String oldField = settings.FIELD_NAME_PREFIX; String oldParam = settings.PARAMETER_NAME_PREFIX; @@ -211,7 +227,7 @@ public class VariablesCompletionTest extends LightFixtureCompletionTestCase { assertStringItems("pColor"); } - public void "test finish with ="() { + void "test finish with ="() { myFixture.configureByText 'a.java', ''' class FooFoo { FooFoo f @@ -227,7 +243,7 @@ class FooFoo { ''' } - public void "test suggest variable names by non-getter initializer call"() { + void "test suggest variable names by non-getter initializer call"() { myFixture.configureByText 'a.java', ''' class FooFoo { { long x = System.nanoTime(); } @@ -237,7 +253,7 @@ class FooFoo { myFixture.assertPreferredCompletionItems 0, 'l', 'nanoTime', 'time' } - public void "test use superclass for inner class variable name suggestion"() { + void "test use superclass for inner class variable name suggestion"() { myFixture.configureByText 'a.java', ''' class FooFoo { { Rectangle2D.Double x } @@ -250,7 +266,7 @@ class Rectangle2D { myFixture.assertPreferredCompletionItems 0, 'aDouble', 'rectangle2D' } - public void "test suggest field-shadowing parameter name"() { + void "test suggest field-shadowing parameter name"() { myFixture.configureByText 'a.java', ''' class FooFoo { private final Collection materialQualities; diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/RehighlightingTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/RehighlightingTest.groovy index b97c0d6e4a17..08acf4253882 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/RehighlightingTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/RehighlightingTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase */ class RehighlightingTest extends JavaCodeInsightFixtureTestCase { - public void testDeleteClassCaptionUndo() { + void testDeleteClassCaptionUndo() { myFixture.addClass('package java.lang.reflect; public class Modifier {}') myFixture.configureByText 'a.java', ''' diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateConstantFieldFromUsageTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateConstantFieldFromUsageTest.groovy index 827cef5aa5bd..3ad416390ae4 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateConstantFieldFromUsageTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateConstantFieldFromUsageTest.groovy @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.codeInsight.daemon.quickFix import com.intellij.codeInsight.template.impl.TemplateManagerImpl import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase @@ -6,7 +21,7 @@ import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase */ class CreateConstantFieldFromUsageTest extends LightCodeInsightFixtureTestCase { - public void "test add import when there is a single type variant"() { + void "test add import when there is a single type variant"() { TemplateManagerImpl.setTemplateTesting(project, testRootDisposable) myFixture.addClass "package foo; public class Foo { public void someMethod() {} }" myFixture.configureByText "a.java", ''' @@ -25,8 +40,8 @@ class Test { ''' assert !myFixture.lookup } - - public void "test inside annotation argument with braces"() { + + void "test inside annotation argument with braces"() { TemplateManagerImpl.setTemplateTesting(project, testRootDisposable) myFixture.configureByText "a.java", ''' interface A {} @@ -41,9 +56,9 @@ interface A { @SuppressWarnings({A.CONST}) class Test {} ''' - } + } - public void "test inside annotation argument no braces"() { + void "test inside annotation argument no braces"() { TemplateManagerImpl.setTemplateTesting(project, testRootDisposable) myFixture.configureByText "a.java", ''' interface A {} @@ -60,7 +75,7 @@ class Test {} ''' } - public void "test insert presentable name when showing type lookup"() { + void "test insert presentable name when showing type lookup"() { TemplateManagerImpl.setTemplateTesting(project, testRootDisposable) myFixture.addClass "package foo; public class Foo { public void someMethod() {} }" myFixture.addClass "package bar; public class Bar { public void someMethod() {} }" diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateMethodFromUsageTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateMethodFromUsageTest.groovy index c285cd4fd716..9694b80172bd 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateMethodFromUsageTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateMethodFromUsageTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,10 +28,10 @@ import com.intellij.psi.util.PsiTreeUtil /** * @author ven */ -public class CreateMethodFromUsageTest extends LightQuickFixTestCase { - public void test() throws Exception { doAllTests(); } +class CreateMethodFromUsageTest extends LightQuickFixTestCase { + void test() throws Exception { doAllTests(); } - public void testTemplateAssertions() throws Exception { + void testTemplateAssertions() throws Exception { configureFromFileText "a.java", """ class SomeOuterClassWithLongName { void foo(PropertyDescriptorWithVeryLongName.Group group, PropertyDescriptorWithVeryLongName.Group child) { @@ -81,7 +81,7 @@ class SomeOuterClassWithLongName { } - public void "test prefer nearby return types"() { + void "test prefer nearby return types"() { configureFromFileText "a.java", """ class Singleton { boolean add(Object o) {} @@ -100,8 +100,8 @@ class Usage { // parameter type assert LookupManager.getActiveLookup(editor)?.currentItem?.lookupString == 'Singleton' } - - public void "test delete created modifiers"() { + + void "test delete created modifiers"() { configureFromFileText "a.java", """ interface Singleton { default boolean add(Object o) {} @@ -130,7 +130,7 @@ class Usage { state.gotoEnd(false) } - public void "test prefer outer class when static is not applicable for inner"() { + void "test prefer outer class when static is not applicable for inner"() { configureFromFileText "a.java", """ class A { int x; diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceFromOfNullableFixTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceFromOfNullableFixTest.groovy index 213258fa48ef..373785c557ca 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceFromOfNullableFixTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceFromOfNullableFixTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,14 +24,14 @@ import com.intellij.openapi.vfs.VfsUtil import com.intellij.openapi.vfs.VirtualFile import org.jetbrains.annotations.NotNull -public class ReplaceFromOfNullableFixTest extends LightQuickFixParameterizedTestCase { +class ReplaceFromOfNullableFixTest extends LightQuickFixParameterizedTestCase { @NotNull @Override protected LocalInspectionTool[] configureLocalInspectionTools() { return [new DataFlowInspection()] as LocalInspectionTool[] } - public void test() throws Exception { + void test() throws Exception { doAllTests(); } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/folding/JavaFolding8Test.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/folding/JavaFolding8Test.groovy index 4e143c20e658..ab18420b714a 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/folding/JavaFolding8Test.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/folding/JavaFolding8Test.groovy @@ -27,7 +27,7 @@ import org.jetbrains.annotations.NotNull /** * @author peter */ -public class JavaFolding8Test extends LightCodeInsightFixtureTestCase { +class JavaFolding8Test extends LightCodeInsightFixtureTestCase { JavaCodeFoldingSettingsImpl myFoldingSettings JavaCodeFoldingSettingsImpl myFoldingStateToRestore @@ -39,7 +39,7 @@ public class JavaFolding8Test extends LightCodeInsightFixtureTestCase { } @Override - public void setUp() { + void setUp() { super.setUp() myFoldingSettings = JavaCodeFoldingSettings.instance as JavaCodeFoldingSettingsImpl myFoldingStateToRestore = new JavaCodeFoldingSettingsImpl() @@ -52,7 +52,7 @@ public class JavaFolding8Test extends LightCodeInsightFixtureTestCase { super.tearDown() } - public void "test no plain lambda folding where anonymous class can be real lambda but fold otherwise"() { + void "test no plain lambda folding where anonymous class can be real lambda but fold otherwise"() { myFixture.addClass('interface Runnable2 { void run(); }') myFixture.addClass('abstract class MyAction { public void run(); public void update() {} }') def text = """\ diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/highlighting/HighlightUsagesHandlerTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/highlighting/HighlightUsagesHandlerTest.groovy index c970ecd0cdec..c2ab607e4459 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/highlighting/HighlightUsagesHandlerTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/highlighting/HighlightUsagesHandlerTest.groovy @@ -24,80 +24,80 @@ import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase /** * @author cdr */ -public class HighlightUsagesHandlerTest extends LightCodeInsightFixtureTestCase { +class HighlightUsagesHandlerTest extends LightCodeInsightFixtureTestCase { final String basePath = JavaTestUtil.relativeJavaTestDataPath - public void testHighlightImport() { + void testHighlightImport() { configureFile() ctrlShiftF7() assertRangeText 'import', 'List', 'List', 'List', 'List', 'List' checkUnselect() } - public void testHighlightStaticImport() { + void testHighlightStaticImport() { configureFile() ctrlShiftF7() assertRangeText 'import', 'abs', 'abs', 'pow' checkUnselect() } - public void testSimpleThrows() { + void testSimpleThrows() { configureFile() ctrlShiftF7() assertRangeText 'throws', 'Exception' checkUnselect() } - public void testThrowsExpression() { + void testThrowsExpression() { configureFile() ctrlShiftF7() assertRangeText 'throws', '(Exception)detail' checkUnselect() } - public void testThrowsReference() { + void testThrowsReference() { configureFile() ctrlShiftF7() assertRangeText 'throws', 'detail' checkUnselect() } - public void testUnselectUsage() { + void testUnselectUsage() { configureFile() ctrlShiftF7() assertRangeText 'foo', 'foo', 'foo' checkUnselect() } - public void testHighlightOverridden() { + void testHighlightOverridden() { configureFile() ctrlShiftF7() assertRangeText 'extends', 'foo' checkUnselect() } - public void testHighlightOverriddenImplements() { + void testHighlightOverriddenImplements() { configureFile() ctrlShiftF7() assertRangeText 'implements', 'foo' checkUnselect() } - public void testHighlightOverriddenNothing() { + void testHighlightOverriddenNothing() { configureFile() ctrlShiftF7() assertRangeText() checkUnselect() } - public void testHighlightOverriddenMultiple() { + void testHighlightOverriddenMultiple() { configureFile() ctrlShiftF7() assertRangeText 'implements', 'foo', 'other' checkUnselect() } - public void testIDEADEV28822() { + void testIDEADEV28822() { myFixture.configureByText 'Foo.java', ''' public class Foo { public String foo(String s) { @@ -116,7 +116,7 @@ public class HighlightUsagesHandlerTest extends LightCodeInsightFixtureTestCase assertRangeText 'return s;' } - public void testReturnsInTryFinally() { + void testReturnsInTryFinally() { // See IDEADEV-14028 myFixture.configureByText 'Foo.java', ''' public class Foo { @@ -134,7 +134,7 @@ public class HighlightUsagesHandlerTest extends LightCodeInsightFixtureTestCase assertRangeText 'return 1;', 'return 2;', 'return 3;' } - public void testReturnsInLambda() { + void testReturnsInLambda() { // See IDEADEV-14028 myFixture.configureByText 'Foo.java', ''' public class Foo { @@ -149,7 +149,7 @@ public class HighlightUsagesHandlerTest extends LightCodeInsightFixtureTestCase assertRangeText 'return;', 'return;' } - public void testSuppressedWarningsHighlights() { + void testSuppressedWarningsHighlights() { myFixture.configureByText 'Foo.java', ''' public class Foo { @SuppressWarnings({"SillyAssignment"}) @@ -163,7 +163,7 @@ public class HighlightUsagesHandlerTest extends LightCodeInsightFixtureTestCase assertRangeText 'i' } - public void "test statically imported overloads from usage"() { + void "test statically imported overloads from usage"() { myFixture.addClass ''' class Foo { static void foo(int a) {} @@ -181,7 +181,7 @@ public class HighlightUsagesHandlerTest extends LightCodeInsightFixtureTestCase assertRangeText 'foo', 'foo' } - public void "test statically imported overloads from import"() { + void "test statically imported overloads from import"() { myFixture.addClass ''' class Foo { static void foo(int a) {} @@ -199,7 +199,7 @@ public class HighlightUsagesHandlerTest extends LightCodeInsightFixtureTestCase assertRangeText 'foo', 'foo', 'foo' //import highlighted twice: for each overloaded usage target } - public void "test identifier highlighter for static imports"() { + void "test identifier highlighter for static imports"() { myFixture.addClass ''' class Foo { static void foo(int a) {} @@ -223,7 +223,7 @@ public class HighlightUsagesHandlerTest extends LightCodeInsightFixtureTestCase } } - public void testExceptionsInTryWithResources() { + void testExceptionsInTryWithResources() { myFixture.configureByText 'A.java', ''' import java.io.*; class A { @@ -236,7 +236,7 @@ public class HighlightUsagesHandlerTest extends LightCodeInsightFixtureTestCase assertRangeText 'FileInputStream', 'catch' } - public void testExceptionsResourceCloser() { + void testExceptionsResourceCloser() { myFixture.configureByText 'A.java', ''' import java.io.*; class A { diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddImportActionHeavyTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddImportActionHeavyTest.groovy index 4b801758a40d..e19971d403cc 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddImportActionHeavyTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddImportActionHeavyTest.groovy @@ -23,7 +23,7 @@ import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase */ class AddImportActionHeavyTest extends JavaCodeInsightFixtureTestCase { - public void "test prefer junit in tests"() { + void "test prefer junit in tests"() { myFixture.addClass 'package org.junit; public @interface Before {}' myFixture.addClass 'package org.aspectj.lang.annotation; public @interface Before {}' PsiTestUtil.addSourceRoot(myModule, myFixture.tempDirFixture.findOrCreateDir('tests'), true) diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddImportActionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddImportActionTest.groovy index c046856b0d25..8f9295b96202 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddImportActionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddImportActionTest.groovy @@ -25,10 +25,10 @@ import com.intellij.psi.statistics.impl.StatisticsManagerImpl import com.intellij.testFramework.IdeaTestUtil import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase -public class AddImportActionTest extends LightCodeInsightFixtureTestCase { +class AddImportActionTest extends LightCodeInsightFixtureTestCase { private CodeStyleSettings settings - public void testMap15() { + void testMap15() { IdeaTestUtil.withLevel(myModule, LanguageLevel.JDK_1_5, { myFixture.configureByText 'a.java', '''\ public class Foo { @@ -49,7 +49,7 @@ public class Foo { }) } - public void testMapLatestLanguageLevel() { + void testMapLatestLanguageLevel() { myFixture.configureByText 'a.java', '''\ public class Foo { void foo() { @@ -68,7 +68,7 @@ public class Foo { ''' } - public void testStringValue() { + void testStringValue() { myFixture.addClass 'package java.lang; class StringValue {}' myFixture.addClass 'package foo; public class StringValue {}' myFixture.configureByText 'a.java', '''\ @@ -85,7 +85,7 @@ public class Foo { ''' } - public void testPackageLocalInner() { + void testPackageLocalInner() { myFixture.addClass 'package foo; class Outer { static class Inner {static String FOO = "";}}' myFixture.configureByText 'a.java', '''\ @@ -108,7 +108,7 @@ class Usage { ''' } - public void testWrongTypeParams() throws Exception { + void testWrongTypeParams() throws Exception { myFixture.addClass 'package f; public class Foo {}' myFixture.configureByText 'a.java', '''\ public class Bar { @@ -125,7 +125,7 @@ public class Bar { ''' } - public void testUseContext() { + void testUseContext() { myFixture.addClass 'package foo; public class Log {}' myFixture.addClass 'package bar; public class Log {}' myFixture.addClass 'package bar; public class LogFactory { public static Log log(){} }' @@ -143,7 +143,7 @@ public class Foo { ''' } - public void "test use initializer"() { + void "test use initializer"() { myFixture.addClass 'package foo; public class Map {}' myFixture.configureByText 'a.java', '''\ import java.util.HashMap; @@ -156,7 +156,7 @@ public class Foo { assert intention.classesToImport.collect { it.qualifiedName } == ['java.util.Map'] } - public void testUseOverrideContext() { + void testUseOverrideContext() { myFixture.addClass 'package foo; public class Log {}' myFixture.addClass 'package bar; public class Log {}' myFixture.addClass 'package goo; public class Super { public void foo(foo.Log log) {} }' @@ -176,7 +176,7 @@ public class Foo extends goo.Super { ''' } - public void testImportFoldingWithConflicts() { + void testImportFoldingWithConflicts() { myFixture.addClass 'package p1; public class B {}' myFixture.addClass 'package p1; public class A1 {}' @@ -227,7 +227,7 @@ class C { ''' } - public void testAnnotatedImport() { + void testAnnotatedImport() { myFixture.addClass ''' import java.lang.annotation.*; @Target(ElementType.TYPE_USE) @interface TA { }'''.stripIndent().trim() @@ -249,7 +249,7 @@ class C { }'''.stripIndent().trim() } - public void testAnnotatedQualifiedImport() { + void testAnnotatedQualifiedImport() { myFixture.addClass ''' import java.lang.annotation.*; @Target(ElementType.TYPE_USE) @interface TA { }'''.stripIndent().trim() @@ -269,7 +269,7 @@ class C { }'''.stripIndent().trim() } - public void testUnresolvedAnnotatedImport() { + void testUnresolvedAnnotatedImport() { myFixture.configureByText 'a.java', ''' class Test { @Nullable Collection c; @@ -286,7 +286,7 @@ class C { }'''.stripIndent().trim() } - public void "test import class in class reference expression"() { + void "test import class in class reference expression"() { myFixture.configureByText 'a.java', ''' class Test { { @@ -305,7 +305,7 @@ class Test { ''' } - public void "test import class in qualifier expression"() { + void "test import class in qualifier expression"() { myFixture.configureByText 'a.java', ''' class Test { { @@ -324,7 +324,7 @@ class Test { ''' } - public void "test don't import class in method call argument"() { + void "test don't import class in method call argument"() { myFixture.configureByText 'a.java', ''' class Test { { @@ -335,7 +335,7 @@ class Test { assert !myFixture.filterAvailableIntentions("Import class") } - public void "test don't import class if qualified name is not valid"() { + void "test don't import class if qualified name is not valid"() { myFixture.addClass(''' package a..p; public class MMM {} @@ -350,7 +350,7 @@ class Test { assert !myFixture.filterAvailableIntentions("Import class") } - public void "test don't import class in assignment"() { + void "test don't import class in assignment"() { myFixture.configureByText 'a.java', ''' class Test { { @@ -361,7 +361,7 @@ class Test { assert !myFixture.filterAvailableIntentions("Import class") } - public void "test don't import class in qualified reference at reference name"() { + void "test don't import class in qualified reference at reference name"() { myFixture.configureByText 'a.java', ''' class Test { { @@ -372,7 +372,7 @@ class Test { assert !myFixture.filterAvailableIntentions("Import class") } - public void "test don't import class in qualified reference at foreign place"() { + void "test don't import class in qualified reference at foreign place"() { myFixture.configureByText 'a.java', ''' class Test { { @@ -385,7 +385,7 @@ class Test { assert !myFixture.filterAvailableIntentions("Import class") } - public void "test allow to add import from javadoc"() { + void "test allow to add import from javadoc"() { myFixture.configureByText 'a.java', ''' class Test { @@ -411,7 +411,7 @@ class Test { ''' } - public void "test do not add import for default package"() { + void "test do not add import for default package"() { myFixture.configureByText 'a.java', ''' class Test { @@ -435,7 +435,7 @@ class Test { ''' } - public void "test do not allow to add import in package-info file"() { + void "test do not allow to add import in package-info file"() { myFixture.configureByText 'package-info.java', ''' /** @@ -447,7 +447,7 @@ package com.rocket.test; } - public void "test keep methods formatting on add import"() { + void "test keep methods formatting on add import"() { settings.getCommonSettings(JavaLanguage.INSTANCE).ALIGN_GROUP_FIELD_DECLARATIONS = true; myFixture.configureByText 'Tq.java', ''' @@ -485,14 +485,14 @@ class Tq { } @Override - public void setUp() throws Exception { + void setUp() throws Exception { super.setUp(); settings = new CodeStyleSettings() CodeStyleSettingsManager.getInstance(myFixture.project).setTemporarySettings(settings); } @Override - public void tearDown() throws Exception { + void tearDown() throws Exception { CodeStyleSettingsManager.getInstance(myFixture.project).dropTemporarySettings(); settings = null super.tearDown(); @@ -506,7 +506,7 @@ class Tq { myFixture.launchAction(myFixture.findSingleIntention("Replace qualified name with 'import'")) } - public void "test disprefer deprecated classes"() { + void "test disprefer deprecated classes"() { myFixture.addClass 'package foo; public class Log {}' myFixture.addClass 'package bar; @Deprecated public class Log {}' myFixture.configureByText 'a.java', '''\ @@ -524,7 +524,7 @@ public class Foo { } - public void "prefer from imported package"() { + void "prefer from imported package"() { myFixture.addClass 'package foo; public class Log {}' myFixture.addClass 'package foo; public class Imported {}' myFixture.addClass 'package bar; public class Log {}' @@ -545,7 +545,7 @@ public class Foo { ''' } - public void "test prefer from imported package sibling"() { + void "test prefer from imported package sibling"() { myFixture.addClass 'package com.foo.doo; public class Log {}' myFixture.addClass 'package com.foo.imported; public class Imported {}' myFixture.addClass 'package com.bar; public class Log {}' @@ -568,7 +568,7 @@ public class Foo { } - public void "test remember chosen variants"() { + void "test remember chosen variants"() { ((StatisticsManagerImpl)StatisticsManager.getInstance()).enableStatistics(getTestRootDisposable()); myFixture.addClass 'package foo; public class Log {}' myFixture.addClass 'package bar; public class Log {}' diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/psi/AnnotatedTypeTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/psi/AnnotatedTypeTest.groovy index ec5ab5fcd0c5..a649f3fbf678 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/psi/AnnotatedTypeTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/psi/AnnotatedTypeTest.groovy @@ -24,7 +24,7 @@ class AnnotatedTypeTest extends LightCodeInsightFixtureTestCase { private PsiElementFactory factory private PsiElement context - public void setUp() { + void setUp() { super.setUp() factory = myFixture.javaFacade.elementFactory @@ -42,63 +42,63 @@ class AnnotatedTypeTest extends LightCodeInsightFixtureTestCase { @SuppressWarnings("ExceptionClassNameDoesntEndWithException") class E2 extends Exception { }""".stripIndent()) } - public void testPrimitiveArrayType() { + void testPrimitiveArrayType() { doTest("@A @TA(1) int @TA(2) [] a", "@pkg.TA(1) int @pkg.TA(2) []", "int[]") } - public void testEllipsisType() { + void testEllipsisType() { doTest("@TA int @TA ... p", "@pkg.TA int @pkg.TA ...", "int...") } - public void testClassReferenceType() { + void testClassReferenceType() { doTest("@A @TA(1) String s", "java.lang.@pkg.TA(1) String", "java.lang.String") } - public void testQualifiedClassReferenceType() { + void testQualifiedClassReferenceType() { doTest("@A java.lang.@TA(1) String s", "java.lang.@pkg.TA(1) String", "java.lang.String") } - public void testQualifiedPackageClassReferenceType() { + void testQualifiedPackageClassReferenceType() { doTest("@A @TA java.lang.String s", "java.lang.String", "java.lang.String") // packages cannot have type annotations } - public void testPartiallyQualifiedClassReferenceType() { + void testPartiallyQualifiedClassReferenceType() { doTest("@TA(1) O.@TA(2) I i", "pkg.@pkg.TA(1) O.@pkg.TA(2) I", "pkg.O.I") } - public void testCStyleArrayType() { + void testCStyleArrayType() { doTest("@A @TA(1) String @TA(2) [] f @TA(3) []", "java.lang.@pkg.TA(1) String @pkg.TA(2) [] @pkg.TA(3) []", "java.lang.String[][]") } - public void testWildcardType() { + void testWildcardType() { doTest("Class<@TA(1) ?> c", "java.lang.Class<@pkg.TA(1) ?>", "java.lang.Class") } - public void testDisjunctionType() { + void testDisjunctionType() { def psi = factory.createStatementFromText("try { } catch (@A @TA(1) E1 | @TA(2) E2 e) { }", context) as PsiTryStatement assertTypeText psi.catchBlockParameters[0].type, "pkg.@pkg.TA(1) E1 | pkg.@pkg.TA(2) E2", "pkg.E1 | pkg.E2" } - public void testDiamondType() { + void testDiamondType() { def psi = factory.createStatementFromText("Class<@TA String> cs = new Class<>()", context) as PsiDeclarationStatement def var = psi.declaredElements[0] as PsiVariable assertTypeText var.initializer.type, "java.lang.Class", "java.lang.Class" } - public void testImmediateClassType() { + void testImmediateClassType() { def aClass = myFixture.javaFacade.findClass(CommonClassNames.JAVA_LANG_OBJECT) def annotations = factory.createParameterFromText("@TA int x", context).modifierList.annotations def type = new PsiImmediateClassType(aClass, PsiSubstitutor.EMPTY, LanguageLevel.JDK_1_8, annotations) assertTypeText type, "java.lang.@pkg.TA Object", CommonClassNames.JAVA_LANG_OBJECT } - public void testFieldType() { + void testFieldType() { def psi = factory.createFieldFromText("@A @TA(1) String f;", context) assertTypeText psi.type, "java.lang.@pkg.TA(1) String", "java.lang.String" assertAnnotations psi.type, "@TA(1)" } - public void testMethodReturnType() { + void testMethodReturnType() { def psi = factory.createMethodFromText("@A @TA(1) @TA(2) String m() { return null; }", context) assertTypeText psi.returnType, "java.lang.@pkg.TA(1) @pkg.TA(2) String", "java.lang.String" assertAnnotations psi.returnType, "@TA(1)", "@TA(2)" diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/template/LiveTemplateTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/template/LiveTemplateTest.groovy index 7e1024eca226..e6a6d31f9db5 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/template/LiveTemplateTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/template/LiveTemplateTest.groovy @@ -45,7 +45,7 @@ import static com.intellij.testFramework.EdtTestUtil.runInEdtAndWait * @author spleaner */ @SuppressWarnings("SpellCheckingInspection") -public class LiveTemplateTest extends LightCodeInsightFixtureTestCase { +class LiveTemplateTest extends LightCodeInsightFixtureTestCase { @Override protected String getBasePath() { return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/template/"; @@ -87,7 +87,7 @@ public class LiveTemplateTest extends LightCodeInsightFixtureTestCase { checkResultByText(expected); } - public void testDependentSegmentsAtTheSamePosition() { + void testDependentSegmentsAtTheSamePosition() { configureFromFileText("dummy.java", "class A { void test() { } }") TemplateManager manager = TemplateManager.getInstance(getProject()) final Template template = manager.createTemplate("test_template", "user_group", '$A$$B$ then "$A$.$B$"') @@ -102,15 +102,15 @@ public class LiveTemplateTest extends LightCodeInsightFixtureTestCase { checkResultByText("class A { void test() { HELLOTHERE then \"HELLO.THERE\" } }"); } - public void testTemplateWithSegmentsAtTheSamePosition_1() { + void testTemplateWithSegmentsAtTheSamePosition_1() { doTestTemplateWithThreeVariables("", "", "", "class A { void test() { for(TestValue1TestValue2TestValue3) {} } }") } - public void testTemplateWithSegmentsAtTheSamePosition_2() { + void testTemplateWithSegmentsAtTheSamePosition_2() { doTestTemplateWithThreeVariables("Def1", "Def2", "DefaultValue", "class A { void test() { for(Def1Def2DefaultValue) {} } }") } - public void testTemplateWithSegmentsAtTheSamePosition_3() { + void testTemplateWithSegmentsAtTheSamePosition_3() { doTestTemplateWithThreeVariables("", "DefaultValue", "", "class A { void test() { for(TestValue1DefaultValueTestValue3) {} } }") } @@ -137,19 +137,19 @@ public class LiveTemplateTest extends LightCodeInsightFixtureTestCase { checkResultByText(expectedText); } - public void testTemplateWithArg1() throws IOException { + void testTemplateWithArg1() throws IOException { doTestTemplateWithArg("tst", 'wrap($ARG$)', "tst arg", "wrap(arg)"); } - public void testTemplateWithArg2() throws IOException { + void testTemplateWithArg2() throws IOException { doTestTemplateWithArg("tst#", 'wrap($ARG$)', "tst#arg", "wrap(arg)"); } - public void testTemplateWithArg3() throws IOException { + void testTemplateWithArg3() throws IOException { doTestTemplateWithArg("tst#", 'wrap($ARG$)', "tst# arg", "tst# arg"); } - public void testTemplateAtEndOfFile() { + void testTemplateAtEndOfFile() { configureFromFileText("empty.java", ""); final TemplateManager manager = TemplateManager.getInstance(getProject()); final Template template = manager.createTemplate("empty", "user", '$VAR$'); @@ -159,7 +159,7 @@ public class LiveTemplateTest extends LightCodeInsightFixtureTestCase { checkResultByText(""); } - public void testTemplateWithEnd() { + void testTemplateWithEnd() { configureFromFileText("empty.java", ""); final TemplateManager manager = TemplateManager.getInstance(getProject()); final Template template = manager.createTemplate("empty", "user", '$VAR$$END$'); @@ -171,7 +171,7 @@ public class LiveTemplateTest extends LightCodeInsightFixtureTestCase { checkResultByText("foo"); } - public void testTemplateWithIndentedEnd() { + void testTemplateWithIndentedEnd() { configureFromFileText("empty.java", "class C {\n" + " bar() {\n" + " \n" + @@ -193,7 +193,7 @@ public class LiveTemplateTest extends LightCodeInsightFixtureTestCase { } - public void testTemplateWithEndOnEmptyLine() { + void testTemplateWithEndOnEmptyLine() { configureFromFileText("empty.java", "class C {\n" + " bar() {\n" + " \n" + @@ -222,7 +222,7 @@ public class LiveTemplateTest extends LightCodeInsightFixtureTestCase { myFixture.configureByText(name, text); } - public void testEndInTheMiddle() { + void testEndInTheMiddle() { configure(); final TemplateManager manager = TemplateManager.getInstance(getProject()); final Template template = manager.createTemplate("frm", "user", "javax.swing.JFrame frame = new javax.swing.JFrame();\n" + @@ -236,7 +236,7 @@ public class LiveTemplateTest extends LightCodeInsightFixtureTestCase { checkResult(); } - public void "test honor custom completion caret placement"() { + void "test honor custom completion caret placement"() { myFixture.configureByText 'a.java', ''' class Foo { void foo(int a) {} @@ -257,7 +257,7 @@ class Foo { assert !state.finished } - public void "test cancel template when completion placed caret outside the variable"() { + void "test cancel template when completion placed caret outside the variable"() { myFixture.configureByText 'a.java', ''' class Foo { void foo(int a) {} @@ -278,7 +278,7 @@ class Foo { assert !state } - public void "test not to go to next tab after insert if element is a psi package"() { + void "test not to go to next tab after insert if element is a psi package"() { myFixture.configureByText 'a.java', ''' ''' @@ -294,7 +294,7 @@ import java.util.; assert !state.finished } - public void "test not to go to next tab after insert if element has call arguments"() { + void "test not to go to next tab after insert if element has call arguments"() { myFixture.configureByText 'a.java', ''' import java.util.*; public class Main { @@ -330,7 +330,7 @@ public class Main { assert !state.finished } - public void "test go to next tab after insert if element does not have call arguments"() { + void "test go to next tab after insert if element does not have call arguments"() { myFixture.configureByText 'a.java', ''' import java.util.*; public class Main { @@ -366,7 +366,7 @@ public class Main { assert !state.finished } - public void "test non-imported classes in className macro"() { + void "test non-imported classes in className macro"() { myFixture.addClass('package bar; public class Bar {}') myFixture.configureByText 'a.java', ''' class Foo { @@ -382,7 +382,7 @@ class Foo { assert 'Bar' in myFixture.lookupElementStrings } - public void "test variableOfType suggests inner static classes"() { + void "test variableOfType suggests inner static classes"() { myFixture.addClass('public interface MyCallback {}') myFixture.addClass(''' class MyUtils { @@ -426,7 +426,7 @@ class Outer { myFixture.checkResultByFile(s); } - public void testToar() throws Throwable { + void testToar() throws Throwable { configure(); startTemplate("toar", "other") state.gotoEnd(false); @@ -455,7 +455,7 @@ class Outer { myFixture.configureByFile(getTestName(false) + ".java"); } - public void testIter() throws Throwable { + void testIter() throws Throwable { configure(); startTemplate("iter", "iterations") writeCommand { state.nextTab() } @@ -463,7 +463,7 @@ class Outer { checkResult(); } - public void testPreferStartMatchesInLookups() throws Throwable { + void testPreferStartMatchesInLookups() throws Throwable { configure(); startTemplate("iter", "iterations") myFixture.type('ese\n') //for entrySet @@ -473,7 +473,7 @@ class Outer { assert LookupManager.getActiveLookup(editor).currentItem.lookupString == 'entry' } - public void testClassNameDotInTemplate() { + void testClassNameDotInTemplate() { CodeInsightSettings.instance.COMPLETION_CASE_SENSITIVE = CodeInsightSettings.NONE configure(); startTemplate("soutv", "output") @@ -484,7 +484,7 @@ class Outer { assert !state.finished } - public void testFinishTemplateVariantWithDot() { + void testFinishTemplateVariantWithDot() { CodeInsightSettings.instance.SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS = true configure(); startTemplate("soutv", "output") @@ -495,7 +495,7 @@ class Outer { assert !state.finished } - public void testAllowTypingRandomExpressionsWithLookupOpen() { + void testAllowTypingRandomExpressionsWithLookupOpen() { configure(); startTemplate("iter", "iterations") myFixture.type('file.') @@ -507,14 +507,14 @@ class Outer { editor?.with { TemplateManagerImpl.getTemplateState(it) } } - public void testIter1() throws Throwable { + void testIter1() throws Throwable { configure(); startTemplate("iter", "iterations") myFixture.performEditorAction("NextTemplateVariable") checkResult(); } - public void "_testIterForceBraces"() { + void "_testIterForceBraces"() { CodeStyleSettingsManager.getSettings(getProject()).IF_BRACE_FORCE = CommonCodeStyleSettings.FORCE_BRACES_ALWAYS; try { @@ -535,40 +535,40 @@ class Outer { PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); } - public void testIterParameterizedInner() { + void testIterParameterizedInner() { configure(); startTemplate("iter", "iterations") stripTrailingSpaces(); checkResult(); } - public void testIterParameterizedInnerInMethod() { + void testIterParameterizedInnerInMethod() { configure(); startTemplate("iter", "iterations") stripTrailingSpaces(); checkResult(); } - public void testAsListToar() { + void testAsListToar() { configure(); startTemplate("toar", "other") myFixture.type('\n\t') checkResult(); } - public void testVarargToar() { + void testVarargToar() { configure(); startTemplate("toar", "other") checkResult(); } - public void testSoutp() { + void testSoutp() { configure(); startTemplate("soutp", "output") checkResult(); } - public void testJavaStatementContext() { + void testJavaStatementContext() { final TemplateImpl template = TemplateSettings.getInstance().getTemplate("inst", "other"); assertFalse(isApplicable("class Foo {{ if (a inst) }}", template)); assertTrue(isApplicable("class Foo {{ inst }}", template)); @@ -582,7 +582,7 @@ class Outer { assertTrue(isApplicable("class Foo {{ Runnable r = () -> System.out.println(\"foo\"); ) }}", template)); } - public void testJavaExpressionContext() { + void testJavaExpressionContext() { final TemplateImpl template = TemplateSettings.getInstance().getTemplate("toar", "other"); assertFalse(isApplicable("class Foo {{ if (a toar) }}", template)); assertTrue(isApplicable("class Foo {{ toar }}", template)); @@ -592,7 +592,7 @@ class Outer { assertTrue(isApplicable("class Foo {{ Runnable r = () -> System.out.println(\"foo\"); ) }}", template)); } - public void testJavaDeclarationContext() { + void testJavaDeclarationContext() { final TemplateImpl template = TemplateSettings.getInstance().getTemplate("psvm", "other"); assertFalse(isApplicable("class Foo {{ xxx }}", template)); assertFalse(isApplicable("class Foo {{ xxx }}", template)); @@ -616,7 +616,7 @@ class Outer { assertTrue(isApplicable("xxx package foo; class Foo {}", template)); } - public void testOtherContext() throws IOException { + void testOtherContext() throws IOException { configureFromFileText("a.java", "class Foo { xxx }"); assertInstanceOf( assertOneElement(TemplateManagerImpl.getApplicableContextTypes(myFixture.getFile(), getEditor().getCaretModel().getOffset())), @@ -628,7 +628,7 @@ class Outer { EverywhereContextType.class); } - public void testJavaOtherContext() throws IOException { + void testJavaOtherContext() throws IOException { def manager = (TemplateManagerImpl)TemplateManager.getInstance(project) def stmtContext = TemplateContextType.EP_NAME.findExtension(JavaCodeContextType.Statement) @@ -649,7 +649,7 @@ class Outer { } } - public void testDontSaveDefaultContexts() { + void testDontSaveDefaultContexts() { def defElement = JDOMUtil.loadDocument('''\