S2699 - Tests should include assertions - False Positive: Some assertj assertions are not recognized

177 views
Skip to first unread message

sg.st...@gmail.com

unread,
Sep 8, 2016, 5:28:27 AM9/8/16
to SonarQube
Hi we have a few false positives in our project because some assertions are not recognized:
  • assertj assertThatThrownBy
  • assertj assertExceptionOfType
  • assertions in a sub-method

Thanks,

Steven Goris

sg.st...@gmail.com

unread,
Sep 8, 2016, 7:30:53 AM9/8/16
to SonarQube, sg.st...@gmail.com
Or is it a global assertj problem?
This is also not recognized:

assertThat(partyService.saveParty(party)).isEqualTo(id);

nor is isSameAs...

I thought that assertj should work after seeing this thread: https://groups.google.com/d/msg/sonarqube/Pj-hjhY50a8/EgdZeJwRAQAJ
Is this a regression?

Op donderdag 8 september 2016 11:28:27 UTC+2 schreef sg.st...@gmail.com:

G. Ann Campbell

unread,
Sep 8, 2016, 8:36:32 AM9/8/16
to SonarQube, sg.st...@gmail.com
Hi Steven,

Are you sure you're providing test byte code to the analysis?


Ann

sg.st...@gmail.com

unread,
Sep 8, 2016, 10:01:35 AM9/8/16
to SonarQube, sg.st...@gmail.com
It was shown in Sonar Lint, but this is connected to my Sonar instance. I need to double check tomorrow after the analysis whether they are also shown in the UI.
Assertions in a sub-method are not recognized by the Sonar rule both locally or in sonar itself.



Op donderdag 8 september 2016 11:28:27 UTC+2 schreef sg.st...@gmail.com:
Hi we have a few false positives in our project because some assertions are not recognized:

Nicolas Peru

unread,
Sep 13, 2016, 10:16:12 AM9/13/16
to sg.st...@gmail.com, SonarQube
Hi, 

Regarding the two first methods, please specify if they are shown in both web UI and SonarLint (if there is a difference, I will be very interested in your configuration). 

Regarding the third point : this will require cross procedural analysis to be dealt with properly, let's say that this is something really hard (and this is an euphemism) but this is something that is going to come.

Cheers, 

--
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/05d1dc5e-7883-4ffb-b794-318c034f45b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Nicolas PERU | SonarSource
Senior Developer
http://sonarsource.com
Reply all
Reply to author
Forward
0 new messages