False Positive java:S2699 with rest assured https://rest-assured.io/

  • Operating system:
    Windows 10
  • IDE name and flavor/env:
    Eclipse 4.23.0
  • SonarLint plugin version:
    SonarLint for Eclipse
  • Is connected mode used:
  • Framework:
    Rest Assured 4.4.0

SonarLint supports rest assured ( [SONARJAVA-2230] FP on S2699 (tests should include assert) when using rest-assured framework - SonarSource).

But when make assertion only with status:

import static org.springframework.http.HttpStatus.FORBIDDEN;
import org.junit.jupiter.api.Test;
import io.restassured.module.mockmvc.RestAssuredMockMvc;
	void given_userWithRoleGestor_when_findByIdNoAsignated_then_forbidden(String id) throws Exception {
			.get("/api/expedientes/{id}", id)
	  // @formatter:on

SonarLint activate java:S2699 rule (Tests should include assertions).

Hi @ma3, and welcome to the community,

Thanks for providing all this info. I had a hard time tracking down the right rest-assured artifact but can you confirm that this is the version of rest-assured that your project depends on?

Hi, yes, is correct. I confirm that spring-mock-mvc 4.4.0 is the artifact that contains io.restassured.module.mockmvc.response.ValidatableMockMvcResponse.status method.


Thanks @ma3 a ticket has been created to handle the issue.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.