mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-18 00:20:54 +07:00
To better highlight that this test framework is for internal usage only. #IDEA-334017 GitOrigin-RevId: c491de2411cdffd6eee3e97a6273982560572f4b
51 lines
1.9 KiB
Kotlin
51 lines
1.9 KiB
Kotlin
package com.intellij.codeInspection.tests.java
|
|
|
|
import com.intellij.jvm.analysis.internal.testFramework.CallMatcherTestBase
|
|
import com.intellij.jvm.analysis.testFramework.JvmLanguage
|
|
import com.siyeh.ig.callMatcher.CallMatcher
|
|
|
|
class JavaCallMatcherTest : CallMatcherTestBase() {
|
|
fun testInstanceMethodCall() {
|
|
checkMatchCall(JvmLanguage.JAVA, CallMatcher.instanceCall("Foo", "bar").parameterCount(0), """
|
|
class Foo { void bar() { } }
|
|
|
|
class Main { void main() { new Foo().bar(); } }
|
|
""".trimIndent())
|
|
}
|
|
|
|
fun testMultipleArgumentsCall() {
|
|
checkMatchCall(JvmLanguage.JAVA, CallMatcher.instanceCall("Foo", "bar").parameterCount(3), """
|
|
class Foo { void bar(int x, int y, int z) { } }
|
|
|
|
class Main { void main() { new Foo().bar(0, 0, 0); } }
|
|
""".trimIndent())
|
|
}
|
|
|
|
fun testMultipleArgumentTypes() {
|
|
checkMatchCall(JvmLanguage.JAVA, CallMatcher.instanceCall("Foo", "bar").parameterTypes("int", "long", "double"), """
|
|
class Foo { void bar(int x, long y, double z) { } }
|
|
|
|
class Main { void main() { new Foo().bar(0, 0L, 0.0d); } }
|
|
""".trimIndent())
|
|
}
|
|
|
|
fun testInstanceMethodReference() {
|
|
checkMatchCallableReference(JvmLanguage.JAVA, CallMatcher.instanceCall("java.lang.String", "concat").parameterCount(1), """
|
|
import java.util.function.BiFunction;
|
|
|
|
class Foo { void bar(BiFunction<String, String, String> arg) { } }
|
|
|
|
class Main { void main() { new Foo().bar(String::concat); } }
|
|
""".trimIndent())
|
|
}
|
|
|
|
fun testMethodReferenceArgumentTypes() {
|
|
checkMatchCallableReference(JvmLanguage.JAVA, CallMatcher.instanceCall("java.lang.String", "concat").parameterTypes("java.lang.String"), """
|
|
import java.util.function.BiFunction;
|
|
|
|
class Foo { void bar(BiFunction<String, String, String> arg) { } }
|
|
|
|
class Main { void main() { new Foo().bar(String::concat); } }
|
|
""".trimIndent())
|
|
}
|
|
} |