malformed parameterized: meta arguments source support (IDEA-177110)

This commit is contained in:
Anna.Kozlova
2017-08-18 19:07:17 +02:00
parent 879b062975
commit 964d8af358
3 changed files with 13 additions and 1 deletions
@@ -73,7 +73,7 @@ class JUnit5MalformedParameterizedInspection : BaseJavaBatchLocalInspectionTool(
var noMultiArgsProvider = true
var source : PsiAnnotation? = null
AnnotationUtil.findAnnotations(method, JUnitCommonClassNames.SOURCE_ANNOTATIONS).forEach {
MetaAnnotationUtil.findMetaAnnotations(method, JUnitCommonClassNames.SOURCE_ANNOTATIONS).forEach {
when (it.qualifiedName) {
JUnitCommonClassNames.ORG_JUNIT_JUPITER_PARAMS_PROVIDER_METHOD_SOURCE -> {
checkMethodSource(method, it)
@@ -54,6 +54,9 @@ public class JUnit5MalformedParameterizedTest extends LightInspectionTestCase {
"public @interface CsvSource {String[] value();}");
addEnvironmentClass("package org.junit.jupiter.params.provider;\n" +
"public interface Arguments {static Arguments of(Object... arguments){}}\n");
addEnvironmentClass("package org.junit.jupiter.params.provider;\n" +
"public @interface ArgumentsSource {}");
}
public void testMalformedSources() { doTest(); }
@@ -64,3 +64,12 @@ class ParameterizedTestsDemo {
@CsvSource({"foo, 1"})
void testWithCsvSource(String first, int second) {}
}
@org.junit.jupiter.params.provider.ArgumentsSource()
@interface CustomSource { }
class CustomArgProviderTest {
@ParameterizedTest
@CustomSource
void jsonSourceTest(String param) { }
}