mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
malformed junit 5: check non-repeatable jupiter tests only
This commit is contained in:
+1
-1
@@ -70,7 +70,7 @@ class JUnit5MalformedRepeatedTestInspection : AbstractBaseJavaLocalInspectionToo
|
||||
"RepetitionInfo is injected for @BeforeEach/@AfterEach only, but not for " + StringUtil.getShortName(qName!!))
|
||||
}
|
||||
else {
|
||||
if (MetaAnnotationUtil.isMetaAnnotated(method, JUnitUtil.TEST5_CONFIG_METHODS) && method.containingClass?.methods?.find { MetaAnnotationUtil.isMetaAnnotated(it, JUnitUtil.TEST5_ANNOTATIONS)} != null) {
|
||||
if (MetaAnnotationUtil.isMetaAnnotated(method, JUnitUtil.TEST5_CONFIG_METHODS) && method.containingClass?.methods?.find { MetaAnnotationUtil.isMetaAnnotated(it, Annotations.NON_REPEATED_ANNOTATIONS)} != null) {
|
||||
holder.registerProblem(repetitionInfoParam.nameIdentifier ?: repetitionInfoParam,
|
||||
"RepetitionInfo won't be injected for @Test methods")
|
||||
}
|
||||
|
||||
+4
@@ -31,9 +31,13 @@ public class JUnit5MalformedParameterizedTest extends LightInspectionTestCase {
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
addEnvironmentClass("package org.junit.platform.commons.annotation;\n" +
|
||||
"public @interface Testable {}");
|
||||
addEnvironmentClass("package org.junit.jupiter.params;\n" +
|
||||
"@org.junit.platform.commons.annotation.Testable\n" +
|
||||
"public @interface ParameterizedTest {}");
|
||||
addEnvironmentClass("package org.junit.jupiter.api;\n" +
|
||||
"@org.junit.platform.commons.annotation.Testable\n" +
|
||||
"public @interface Test {}");
|
||||
addEnvironmentClass("package org.junit.jupiter.api;\n" +
|
||||
"public interface TestInfo {}");
|
||||
|
||||
+5
@@ -31,9 +31,13 @@ public class JUnit5MalformedRepeatedTest extends LightInspectionTestCase {
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
addEnvironmentClass("package org.junit.platform.commons.annotation;\n" +
|
||||
"public @interface Testable {}");
|
||||
addEnvironmentClass("package org.junit.jupiter.api;\n" +
|
||||
"@org.junit.platform.commons.annotation.Testable\n" +
|
||||
"public @interface RepeatedTest {int value(); String name() default \"\";}");
|
||||
addEnvironmentClass("package org.junit.jupiter.api;\n" +
|
||||
"@org.junit.platform.commons.annotation.Testable\n" +
|
||||
"public @interface Test {}");
|
||||
addEnvironmentClass("package org.junit.jupiter.api;\n" +
|
||||
"public @interface AfterEach {}");
|
||||
@@ -48,6 +52,7 @@ public class JUnit5MalformedRepeatedTest extends LightInspectionTestCase {
|
||||
addEnvironmentClass("package org.junit.jupiter.api;\n" +
|
||||
"public interface TestReporter {}");
|
||||
addEnvironmentClass("package org.junit.jupiter.api;\n" +
|
||||
"@org.junit.platform.commons.annotation.Testable\n" +
|
||||
"public @interface ParameterizedTest {}");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user