diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/LiteralConstructorUsagesTest.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/LiteralConstructorUsagesTest.java index b31ebc14212c..94acf02306e9 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/LiteralConstructorUsagesTest.java +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/LiteralConstructorUsagesTest.java @@ -1,37 +1,38 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package org.jetbrains.plugins.groovy.lang +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package org.jetbrains.plugins.groovy.lang; -import com.intellij.psi.search.searches.MethodReferencesSearch -import com.intellij.psi.search.searches.ReferencesSearch -import org.jetbrains.plugins.groovy.LightGroovyTestCase +import com.intellij.psi.PsiClass; +import com.intellij.psi.PsiMethod; +import com.intellij.psi.search.searches.MethodReferencesSearch; +import com.intellij.psi.search.searches.ReferencesSearch; +import org.jetbrains.plugins.groovy.LightGroovyTestCase; -class LiteralConstructorUsagesTest extends LightGroovyTestCase { - - void testList_AsCast() throws Exception { - def foo = myFixture.addClass('class Foo { Foo() {} }') - myFixture.addFileToProject "a.groovy", "def x = [] as Foo" - assertOneElement(ReferencesSearch.search(foo.constructors[0]).findAll()) +public class LiteralConstructorUsagesTest extends LightGroovyTestCase { + public void testList_AsCast() { + PsiClass foo = myFixture.addClass("class Foo { Foo() {} }"); + myFixture.addFileToProject("a.groovy", "def x = [] as Foo"); + assertOneElement(ReferencesSearch.search(foo.getConstructors()[0]).findAll()); } - void testMap_AsCast() throws Exception { - def foo = myFixture.addClass('class Foo { Foo() {} }') - myFixture.addFileToProject "a.groovy", "def x = [:] as Foo" - assertOneElement(ReferencesSearch.search(foo.constructors[0]).findAll()) + public void testMap_AsCast() { + PsiClass foo = myFixture.addClass("class Foo { Foo() {} }"); + myFixture.addFileToProject("a.groovy", "def x = [:] as Foo"); + assertOneElement(ReferencesSearch.search(foo.getConstructors()[0]).findAll()); } - void testLiteralConstructorWithNamedArgs() { - myFixture.addFileToProject "a.groovy", """\ -import groovy.transform.Immutable + public void testLiteralConstructorWithNamedArgs() { + myFixture.addFileToProject("a.groovy", """ + import groovy.transform.Immutable -@Immutable class Money { - String currency - int amount -} + @Immutable class Money { + String currency + int amount + } -Money d = [amount: 100, currency:'USA'] -""" - def constructors = myFixture.findClass("Money").constructors - assertEquals 0, MethodReferencesSearch.search(constructors[0]).size() - assertEquals 1, MethodReferencesSearch.search(constructors[1]).size() + Money d = [amount: 100, currency:'USA'] + """); + PsiMethod[] constructors = myFixture.findClass("Money").getConstructors(); + assertEmpty(MethodReferencesSearch.search(constructors[0]).findAll()); + assertOneElement(MethodReferencesSearch.search(constructors[1]).findAll()); } }