mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-203748 @MethodSource recognized in super classes and interfaces
GitOrigin-RevId: f5d55b876080a699dcd54cec71a04dae7af84ba8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
60b36b13bc
commit
ff498b46ba
+4
-4
@@ -166,10 +166,10 @@ class JUnit5MalformedParameterizedInspection : AbstractBaseJavaLocalInspectionTo
|
||||
if (annotationMemberValue == null) {
|
||||
if (methodSource.findAttributeValue(PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME) == null) return
|
||||
val providerName = method.name
|
||||
val methods = containingClass.findMethodsBySignature(
|
||||
JavaPsiFacade.getElementFactory(method.project).createMethodFromText("void $providerName()", method), false)
|
||||
if (methods.isNotEmpty()) {
|
||||
doCheckSourceProvider(methods[0], containingClass, methodSource, method)
|
||||
val foundMethod = containingClass.findMethodBySignature(
|
||||
JavaPsiFacade.getElementFactory(method.project).createMethodFromText("void $providerName()", method), true)
|
||||
if (foundMethod != null) {
|
||||
doCheckSourceProvider(foundMethod, containingClass, methodSource, method)
|
||||
}
|
||||
else {
|
||||
highlightAbsentSourceProvider(containingClass, methodSource, providerName, method)
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture;
|
||||
public class JUnit5TestFrameworkSetupUtil {
|
||||
public static JavaCodeInsightTestFixture setupJUnit5Library(JavaCodeInsightTestFixture fixture) {
|
||||
fixture.addClass( "package org.junit.jupiter.params.provider;\n" +
|
||||
"public @interface MethodSource {String[] value();}");
|
||||
"public @interface MethodSource {String[] value() default \"\";}");
|
||||
fixture.addClass( "package org.junit.jupiter.params;\n" +
|
||||
"@org.junit.platform.commons.annotation.Testable\n" +
|
||||
"public @interface ParameterizedTest {}");
|
||||
|
||||
@@ -210,4 +210,33 @@ abstract class FooThree {
|
||||
void test(String value) {}
|
||||
|
||||
abstract List<String> method1();
|
||||
}
|
||||
|
||||
class SomeTest extends Base {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource
|
||||
void testSomething(String content) {}
|
||||
}
|
||||
|
||||
class SomeTestTwo implements Inter {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource
|
||||
void testSomething(String content) {}
|
||||
}
|
||||
|
||||
interface Inter extends Inter2{ }
|
||||
|
||||
interface Inter2 {
|
||||
static Stream<String> testSomething() {
|
||||
return Stream.of("a", "aa");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Base {
|
||||
static Stream<String> testSomething() {
|
||||
return Stream.of("a", "aa");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user