[jvm] Acknowledge ParameterResolvers registered by automatic extensions

IDEA-312816 Fixed

GitOrigin-RevId: 6f02a786d7f9ee8711feb8f9a956cd3fc0e8769a
This commit is contained in:
Bart van Helvert
2023-02-21 17:07:12 +01:00
committed by intellij-monorepo-bot
parent 4002a855d8
commit 1e78ff9d26
5 changed files with 101 additions and 29 deletions

View File

@@ -123,18 +123,6 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
@org.junit.jupiter.params.provider.ValueSource(strings = "foo")
void implicitParameter(String argument, org.junit.jupiter.api.TestInfo testReporter) { }
@org.junit.jupiter.api.extension.ExtendWith(org.junit.jupiter.api.extension.TestExecutionExceptionHandler.class)
@interface RunnerExtension { }
@RunnerExtension
abstract class AbstractValueSource { }
class ValueSourcesWithCustomProvider extends AbstractValueSource {
@org.junit.jupiter.params.ParameterizedTest
@org.junit.jupiter.params.provider.ValueSource(ints = {1})
void testWithIntValues(int i, String fromExtension) { }
}
@org.junit.jupiter.params.ParameterizedTest
@org.junit.jupiter.params.provider.ValueSource(strings = { "FIRST" })
void implicitConversionEnum(TestEnum e) { }
@@ -673,6 +661,36 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
}
""".trimIndent(), "Fix 'beforeAll' method signature")
}
fun `test no highlighting when automatic parameter resolver is found`() {
myFixture.addFileToProject("com/intellij/testframework/ext/AutomaticExtension.java", """
package com.intellij.testframework.ext;
class AutomaticExtension implements org.junit.jupiter.api.extension.ParameterResolver {
@Override
public boolean supportsParameter(
org.junit.jupiter.api.extension.ParameterContext parameterContext,
org.junit.jupiter.api.extension.ExtensionContext extensionContext
) {
return true;
}
@Override
public Object resolveParameter(
org.junit.jupiter.api.extension.ParameterContext parameterContext,
org.junit.jupiter.api.extension.ExtensionContext extensionContext
) {
return "";
}
}
""".trimIndent())
addAutomaticExtension("com.intellij.testframework.ext.AutomaticExtension")
myFixture.testHighlighting(JvmLanguage.JAVA, """
class MainTest {
@org.junit.jupiter.api.BeforeEach
public void foo(int x) { }
}
""".trimIndent())
}
/* Malformed Datapoint(s) */
fun `test malformed dataPoint no highlighting`() {