mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
junit 5: warn about junit 3 methods inside classes with junit 5 annotations (IDEA-163651)
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -75,7 +75,7 @@ public class JUnit3StyleTestMethodInJUnit4ClassInspection extends BaseInspection
|
||||
if (!TestUtils.isRunnable(method)) {
|
||||
return;
|
||||
}
|
||||
if (TestUtils.isJUnit4TestMethod(method)) {
|
||||
if (TestUtils.isAnnotatedTestMethod(method)) {
|
||||
return;
|
||||
}
|
||||
final PsiClass containingClass = method.getContainingClass();
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports JUnit 3 style test methods which are located inside a class
|
||||
which does not extend the abstract JUnit 3 class <b>TestCase</b> and contains JUnit 4 <b>@Test</b> annotated methods.
|
||||
which does not extend the abstract JUnit 3 class <b>TestCase</b> and contains JUnit 4/JUnit 5 <b>@Test</b> annotated methods.
|
||||
In addition to being confusing such test methods will not be run.
|
||||
<!-- tooltip end -->
|
||||
<p>
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class SimpleJUnit5 {
|
||||
@Test
|
||||
public void testIt() {
|
||||
}
|
||||
}
|
||||
+10
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,6 +26,7 @@ public class JUnit3StyleTestMethodInJUnit4ClassInspectionTest extends LightInspe
|
||||
|
||||
public void testJUnit3StyleTestMethodInJUnit4Class() { doTest(); }
|
||||
public void testBeforeAnnotationUsed() { doTest(); }
|
||||
public void testSimpleJUnit5() { doTest(); }
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@@ -51,6 +52,14 @@ public class JUnit3StyleTestMethodInJUnit4ClassInspectionTest extends LightInspe
|
||||
"import java.lang.annotation.Target;" +
|
||||
"@Retention(RetentionPolicy.RUNTIME)" +
|
||||
"@Target({ElementType.METHOD})" +
|
||||
"public @interface Test {}",
|
||||
"package org.junit.jupiter.api;" +
|
||||
"import java.lang.annotation.ElementType;" +
|
||||
"import java.lang.annotation.Retention;" +
|
||||
"import java.lang.annotation.RetentionPolicy;" +
|
||||
"import java.lang.annotation.Target;" +
|
||||
"@Retention(RetentionPolicy.RUNTIME)" +
|
||||
"@Target({ElementType.METHOD})" +
|
||||
"public @interface Test {}"
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user