diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GrAssignabilityClosureToSamTest.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GrAssignabilityClosureToSamTest.java
index 35c6461aa355..7facf9fe26ba 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GrAssignabilityClosureToSamTest.java
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GrAssignabilityClosureToSamTest.java
@@ -1,83 +1,90 @@
-// Copyright 2000-2023 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.highlighting
+// 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.highlighting;
-import com.intellij.codeInspection.InspectionProfileEntry
-import com.intellij.openapi.util.registry.Registry
-import com.intellij.testFramework.LightProjectDescriptor
-import org.jetbrains.plugins.groovy.GroovyProjectDescriptors
-import org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyAssignabilityCheckInspection
-import org.jetbrains.plugins.groovy.intentions.style.inference.MethodParameterAugmenter
+import com.intellij.codeInspection.InspectionProfileEntry;
+import com.intellij.openapi.util.registry.Registry;
+import com.intellij.testFramework.LightProjectDescriptor;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.groovy.GroovyProjectDescriptors;
+import org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyAssignabilityCheckInspection;
+import org.jetbrains.plugins.groovy.intentions.style.inference.MethodParameterAugmenter;
/**
* @author Max Medvedev
*/
-class GrAssignabilityClosureToSamTest extends GrHighlightingTestBase {
- InspectionProfileEntry[] getCustomInspections() { [new GroovyAssignabilityCheckInspection()] }
-
- final LightProjectDescriptor projectDescriptor = GroovyProjectDescriptors.GROOVY_2_2
-
- void testAssignability() {
- doTestHighlighting('''\
-interface A {
- def foo()
-}
-interface B {}
-
-A a = {print 1}
-A a1 = {->print 1}
-A a2 = {String s->print 1}
-B b = {print 2}
-''')
+public class GrAssignabilityClosureToSamTest extends GrHighlightingTestBase {
+ @Override
+ public InspectionProfileEntry[] getCustomInspections() {
+ return new GroovyAssignabilityCheckInspection[]{new GroovyAssignabilityCheckInspection()};
}
- void testAmbiguous() {
- def registryValue = Registry.is(MethodParameterAugmenter.GROOVY_COLLECT_METHOD_CALLS_FOR_INFERENCE)
- Registry.get(MethodParameterAugmenter.GROOVY_COLLECT_METHOD_CALLS_FOR_INFERENCE).setValue(true)
+ public void testAssignability() {
+ doTestHighlighting("""
+ interface A {
+ def foo()
+ }
+ interface B {}
+
+ A a = {print 1}
+ A a1 = {->print 1}
+ A a2 = {String s->print 1}
+ B b = {print 2}
+ """);
+ }
+
+ public void testAmbiguous() {
+ boolean registryValue = Registry.is(MethodParameterAugmenter.GROOVY_COLLECT_METHOD_CALLS_FOR_INFERENCE);
+ Registry.get(MethodParameterAugmenter.GROOVY_COLLECT_METHOD_CALLS_FOR_INFERENCE).setValue(true);
try {
- doTestHighlighting('''\
-interface SAM1 { def foo(String s)}
-interface SAM2 { def bar(Integer i)}
+ doTestHighlighting("""
+ interface SAM1 { def foo(String s)}
+ interface SAM2 { def bar(Integer i)}
-def method(x, SAM1 s1){s1.foo(x)}
-def method(x, SAM2 s2){s2.bar(x)}
+ def method(x, SAM1 s1){s1.foo(x)}
+ def method(x, SAM2 s2){s2.bar(x)}
-method (1) {it} // fails because SAM1 and SAM2 are seen as equal
-method ("1") {it} // fails because SAM1 and SAM2 are seen as equal
+ method (1) {it} // fails because SAM1 and SAM2 are seen as equal
+ method ("1") {it} // fails because SAM1 and SAM2 are seen as equal
-''')
- } finally {
- Registry.get(MethodParameterAugmenter.GROOVY_COLLECT_METHOD_CALLS_FOR_INFERENCE).setValue(registryValue)
+ """);
+ }
+ finally {
+ Registry.get(MethodParameterAugmenter.GROOVY_COLLECT_METHOD_CALLS_FOR_INFERENCE).setValue(registryValue);
}
}
- void testGenerics() {
- doTestHighlighting('''
-interface A {
- def foo(T t)
-}
+ public void testGenerics() {
+ doTestHighlighting("""
+ interface A {
+ def foo(T t)
+ }
-A a1 = {print 1}
-A a2 = {String s -> print 1}
-A a3 = {int s -> print 1}
-A a4 = {int s -> print 1}
-A a7 = {int s, String y -> print 1}
-A a5 = { print 1}
-A a6 = {x -> print 1}
-''')
+ A a1 = {print 1}
+ A a2 = {String s -> print 1}
+ A a3 = {int s -> print 1}
+ A a4 = {int s -> print 1}
+ A a7 = {int s, String y -> print 1}
+ A a5 = { print 1}
+ A a6 = {x -> print 1}
+ """);
}
- void testGenerics2() {
- doTestHighlighting('''
-interface A {
- def foo(T t)
-}
+ public void testGenerics2() {
+ doTestHighlighting("""
+ interface A {
+ def foo(T t)
+ }
-interface B extends A {}
+ interface B extends A {}
-B b1 = {print 1}
-B b2 = {String s -> print 1}
-B b3 = {int s -> print 1}
-''')
+ B b1 = {print 1}
+ B b2 = {String s -> print 1}
+ B b3 = {int s -> print 1}
+ """);
}
+ @Override
+ public final @NotNull LightProjectDescriptor getProjectDescriptor() {
+ return GroovyProjectDescriptors.GROOVY_2_2;
+ }
}