- Language is Java, test framework is REST Assured, specifically its Spring Mock MVC module
- The rule is S2699
- False positive because
then().status(...)
is an assertion in REST Assured - Using SonarQube 9.9.4 Developer Edition
- See SONARJAVA-4260 for a snippet of code, mine would be very similar
The false positive occurs only when using RestAssuredMockMvc
, not with RestAssured
.
I’m posting this despite that already filed ticket to show that the issue still or again exists after two years with the current versions. I’m using rest-assured
and spring-mock-mvc
in version 5.4.0.
You might also want to update the rule description because it says that “Rest-assured 2.x, 3.x and 4.x” is supported – no mention of 5.x.