Cleanup (warnings; formatting)

This commit is contained in:
Roman Shevchenko
2017-01-05 16:43:14 +01:00
parent f2fb910730
commit 31fa709cef
2 changed files with 21 additions and 18 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 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.
@@ -25,14 +25,15 @@ import com.intellij.openapi.module.ModuleUtilCore
import com.intellij.openapi.module.StdModuleTypes
import com.intellij.openapi.roots.ModuleRootModificationUtil
import com.intellij.openapi.util.io.FileUtil
import com.intellij.psi.PsiElement
import com.intellij.testFramework.PsiTestUtil
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase
import org.jetbrains.annotations.NotNull
/**
* @author peter
*/
class ChooseByNameHddTest extends JavaCodeInsightFixtureTestCase {
void "test go to file by full path"() {
def psiFile = myFixture.addFileToProject("foo/index.html", "foo")
def vFile = psiFile.virtualFile
@@ -59,7 +60,9 @@ class ChooseByNameHddTest extends JavaCodeInsightFixtureTestCase {
def place = myFixture.addClass("class A {}")
def popup = ReadAction.compute { ChooseByNamePopup.createPopup(project, new GotoClassModel2(project), place) }
def resultModules = ChooseByNameTest.calcPopupElements(popup, 'Foo').collect { ModuleUtilCore.findModuleForPsiElement(it).name }
def resultModules = ChooseByNameTest.calcPopupElements(popup, 'Foo').collect {
ModuleUtilCore.findModuleForPsiElement(it as PsiElement).name
}
assert resultModules[0] == 'mod2'
popup.close(false)
}
@@ -84,4 +87,4 @@ class ChooseByNameHddTest extends JavaCodeInsightFixtureTestCase {
protected void invokeTestRunnable(@NotNull Runnable runnable) throws Exception {
runnable.run()
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 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.
@@ -35,6 +35,7 @@ import org.jetbrains.plugins.groovy.lang.psi.GroovyFile
import javax.swing.*
import static com.intellij.testFramework.EdtTestUtil.runInEdtAndWait
/**
* @author peter
*/
@@ -113,8 +114,8 @@ class Intf {
def elements = getPopupElements(new GotoSymbolModel2(project), "xxx")
def xxx1
def xxx2
def xxx1 = null
def xxx2 = null
runInEdtAndWait {
xxx1 = intf.findMethodsByName('_xxx1', false)
xxx2 = intf.findMethodsByName('xxx2', false)
@@ -170,7 +171,6 @@ class Intf {
popup = createPopup(new GotoFileModel(project), barContext)
assert calcPopupElements(popup, "index") == [barIndex, fooIndex]
}
void "test accept file paths starting with a dot"() {
@@ -186,8 +186,8 @@ class Intf {
def popup = createPopup(new GotoFileModel(project), fooIndex)
def fooDir
def barDir
def fooDir = null
def barDir = null
runInEdtAndWait {
fooDir = fooIndex.containingDirectory
barDir = barIndex.containingDirectory
@@ -284,8 +284,8 @@ class Intf {
void "test super method in jdk"() {
def clazz = myFixture.addClass("package foo.bar; class Goo implements Runnable { public void run() {} }")
def ourRun
def sdkRun
def ourRun = null
def sdkRun = null
runInEdtAndWait {
ourRun = clazz.methods[0]
sdkRun = ourRun.containingClass.interfaces[0].methods[0]
@@ -304,8 +304,8 @@ class Intf {
def baseClass = myFixture.addClass("class Base { void xpaint() {} }")
def subClass = myFixture.addClass("class Sub extends Base { void xpaint() {} }")
def base
def sub
def base = null
def sub = null
runInEdtAndWait {
base = baseClass.methods[0]
sub = subClass.methods[0]
@@ -316,8 +316,8 @@ class Intf {
}
void "test groovy script class with non-identifier name"() {
GroovyFile file1 = myFixture.addFileToProject('foo.groovy', '')
GroovyFile file2 = myFixture.addFileToProject('foo-bar.groovy', '')
GroovyFile file1 = myFixture.addFileToProject('foo.groovy', '') as GroovyFile
GroovyFile file2 = myFixture.addFileToProject('foo-bar.groovy', '') as GroovyFile
def variants = getPopupElements(new GotoSymbolModel2(project), 'foo', false)
runInEdtAndWait { assert variants == [file1.scriptClass, file2.scriptClass] }
@@ -354,7 +354,7 @@ class Intf {
semaphore.down()
SwingUtilities.invokeLater {
popup.scheduleCalcElements(text, checkboxState, ModalityState.NON_MODAL, { set ->
elements = set as List
elements = set as List<Object>
semaphore.up()
} as Consumer<Set<?>>)
}
@@ -386,4 +386,4 @@ class Intf {
protected void invokeTestRunnable(@NotNull Runnable runnable) throws Exception {
runnable.run()
}
}
}