S2187 : FP for JUnit5 tests containing the new annotation @Nested

273 views
Skip to first unread message

olc...@yahoo.com

unread,
Jan 19, 2018, 3:58:58 AM1/19/18
to SonarQube

For better test organization JUnit5 introduced a new annotation @Nested : non-static test classes are now detected when declared in super classes.
( in JUnit4 the inner classes have to be public static and the outer class be annotated with @RunWith(Enclosed.class))


Currently SonarQube does not detect these classes and raises S2187 during the code analysis, while showing that there is one unit test in the file.


Locally reproduced against SonarQube Version 6.5 (build 27846), sonar-java 4.12.0.11033

olc...@yahoo.com

unread,
Jan 19, 2018, 4:08:12 AM1/19/18
to SonarQube
Looking in the code base, the fix seems rather straight forward, so I took the liberty to open a PR (#1878).

Michael Gumowski

unread,
Jan 30, 2018, 11:00:11 AM1/30/18
to olc...@yahoo.com, SonarQube
Hey,

Thanks a lot for your feedback and PR. It's indeed a FP which needs to be fixed.
I reviewed your PR and added a few comments. I let you handle them.

Once done, I'll gladly merge your work into our master. The fix will then most probably be part of SonarJava 5.2

Cheers,
Michael



On Fri, 19 Jan 2018 at 10:08 olcbean via SonarQube <sona...@googlegroups.com> wrote:
Looking in the code base, the fix seems rather straight forward, so I took the liberty to open a PR (#1878).

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/5740063b-36a4-4c45-9ab3-6f78d213a887%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Michael Gumowski | SonarSource
Software Developer, Language Team
https://www.sonarsource.com
Reply all
Reply to author
Forward
0 new messages