diff --git a/java-checks/src/main/java/org/sonar/java/checks/tests/IgnoredTestsCheck.java b/java-checks/src/main/java/org/sonar/java/checks/tests/IgnoredTestsCheck.java index 5e63e10b99..25bb355391 100644 --- a/java-checks/src/main/java/org/sonar/java/checks/tests/IgnoredTestsCheck.java +++ b/java-checks/src/main/java/org/sonar/java/checks/tests/IgnoredTestsCheck.java @@ -60,13 +60,14 @@ public void visitNode(Tree tree) { getSilentlyIgnoredAnnotation(symbolMetadata, annotationName) .ifPresent( annotationTree -> { + String shortName = annotationTypeIdentifier(annotationName); String message = String.format( "Either add an explanation about why this test is skipped or remove the \"@%s\" annotation.", - annotationTypeIdentifier(annotationName) + shortName ); - List secondaryLocation = - Collections.singletonList(new JavaFileScannerContext.Location("Cause", annotationTree)); - context.reportIssue(this, methodTree.simpleName(), message, secondaryLocation, null); + JavaFileScannerContext.Location secondaryLocation = + new JavaFileScannerContext.Location(String.format("@%s annotation skips the test", shortName), annotationTree); + context.reportIssue(this, methodTree.simpleName(), message, Collections.singletonList(secondaryLocation), null); } ); }