[junit5 inspection] add tests for malformed parameterized class method source IJ-CR-166493

GitOrigin-RevId: 541dacb7a76e0af153c253f4a70475c070d311a9
This commit is contained in:
Aleksey Dobrynin
2025-08-22 14:35:43 +00:00
committed by intellij-monorepo-bot
parent fa40715975
commit 92db15dcb3
2 changed files with 35 additions and 0 deletions
@@ -650,6 +650,23 @@ class JavaJUnitMalformedDeclarationInspectionTest {
""".trimIndent())
}
fun `test malformed parameterized class method source should not be static highlighting`() {
myFixture.testHighlighting(JvmLanguage.JAVA, """
@org.junit.jupiter.params.ParameterizedClass
@org.junit.jupiter.params.provider.MethodSource("a")
@org.junit.jupiter.api.TestInstance(org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS)
class TestMethodSource {
@org.junit.jupiter.params.Parameter
String param;
@org.junit.jupiter.api.Test
void test() { }
String[] a() { return new String[] {"a", "b"}; }
}
""".trimIndent())
}
fun `test malformed parameterized class method source should have no parameters highlighting`() {
myFixture.testHighlighting(JvmLanguage.JAVA, """
@org.junit.jupiter.params.ParameterizedClass
@@ -543,6 +543,24 @@ abstract class KotlinJUnitMalformedDeclarationInspectionTestLatest : KotlinJUnit
""".trimIndent())
}
fun `test malformed parameterized class method source should not be static`() {
myFixture.testHighlighting(
JvmLanguage.KOTLIN, """
@org.junit.jupiter.params.ParameterizedClass
@org.junit.jupiter.params.provider.MethodSource("a")
@org.junit.jupiter.api.TestInstance(org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS)
class TestMethodSource {
@org.junit.jupiter.params.Parameter
lateinit var param: String
@org.junit.jupiter.api.Test
fun test() { }
fun a(): Array<String> { return arrayOf("a", "b") }
}
""".trimIndent())
}
/* Malformed parameterized */
fun `test malformed parameterized @ValueSourcesTest no highlighting`() {
myFixture.testHighlighting(JvmLanguage.KOTLIN, """