From a4fb99cb2e66c11fa4de359a15e9df227d747007 Mon Sep 17 00:00:00 2001 From: "Anna.Kozlova" Date: Wed, 19 Oct 2016 16:44:59 +0200 Subject: [PATCH] make 'ignored test' inspection ready for junit 5 --- .../src/com/siyeh/InspectionGadgetsBundle.properties | 2 +- .../com/siyeh/ig/junit/IgnoredJUnitTestInspection.java | 9 +++------ .../src/inspectionDescriptions/IgnoredJUnitTest.html | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties index a48cd99694fa..909ec9c25696 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties @@ -1912,7 +1912,7 @@ use.of.obsolete.assert.problem.descriptor=Call to #ref() from ''{0} use.of.obsolete.assert.quickfix=Replace with 'org.junit.Assert' method call properties.object.as.hashtable.set.quickfix=Replace with call to 'setProperty()' properties.object.as.hashtable.get.quickfix=Replace with call to 'getProperty()' -ignored.junit.test.display.name=JUnit test annotated with '@Ignore' +ignored.junit.test.display.name=JUnit test annotated with '@Ignore'/'@Disabled' ignored.junit.test.classproblem.descriptor=Test class ''{0}'' annotated with #ref #loc ignored.junit.test.method.problem.descriptor=Test method ''{0}()'' annotated with #ref #loc unclear.binary.expression.display.name=Unclear expression diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/IgnoredJUnitTestInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/IgnoredJUnitTestInspection.java index 4e5a2f02118b..474aef7e19db 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/IgnoredJUnitTestInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/IgnoredJUnitTestInspection.java @@ -59,15 +59,12 @@ public class IgnoredJUnitTestInspection extends BaseInspection { @Override public void visitAnnotation(PsiAnnotation annotation) { super.visitAnnotation(annotation); - final PsiModifierListOwner modifierListOwner = - PsiTreeUtil.getParentOfType(annotation, - PsiModifierListOwner.class); + final PsiModifierListOwner modifierListOwner = PsiTreeUtil.getParentOfType(annotation, PsiModifierListOwner.class); if (!(modifierListOwner instanceof PsiClass || modifierListOwner instanceof PsiMethod)) { return; } - final PsiJavaCodeReferenceElement nameReferenceElement = - annotation.getNameReferenceElement(); + final PsiJavaCodeReferenceElement nameReferenceElement = annotation.getNameReferenceElement(); if (nameReferenceElement == null) { return; } @@ -77,7 +74,7 @@ public class IgnoredJUnitTestInspection extends BaseInspection { } final PsiClass aClass = (PsiClass)target; @NonNls final String qualifiedName = aClass.getQualifiedName(); - if (!"org.junit.Ignore".equals(qualifiedName)) { + if (!"org.junit.Ignore".equals(qualifiedName) && !"org.junit.jupiter.api.Disabled".equals(qualifiedName)) { return; } registerError(annotation, modifierListOwner); diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/IgnoredJUnitTest.html b/plugins/InspectionGadgets/src/inspectionDescriptions/IgnoredJUnitTest.html index 9048c8eb388f..b463b11fcfae 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/IgnoredJUnitTest.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/IgnoredJUnitTest.html @@ -1,6 +1,6 @@ -Reports JUnit tests which are annotated with @Ignore. +Reports JUnit tests which are annotated with @Ignore/@Disabled.