False positive - tests must include statements - S2699

We have a lot of code (not all) reporting an issue that does not have an assert, but exists in the test method.

Example code that gets the violation:

@Test
public void successfullValidation() throws ErrorInfo_Exception {
   AgencyInfoServiceResponse agencyResponse = new AgencyInfoServiceResponse();
   AgencyInfoServiceResponseHeader header = new AgencyInfoServiceResponseHeader();
   header.setCmdStatus("Success");
   header.setCmdType("response");
   agencyResponse.setAgencyInfoServiceResponseHeader(header);
   assertTrue(validator.validate(agencyResponse));
}

      

But if I pull the validator into a variable and assertTrue into a variable, then the violation goes away. Import assertTrue:import static org.junit.Assert.assertTrue;

I am using SonarQube 6.4.0.25310 with SonarJava 4.10.0.10260.

Why does he say that I have no statements?

+3
sonarqube


source to share


No one has answered this question yet

Check out similar questions:

6
SonarQube does not collect Cobertura code coverage
five
SonarQube issue "Add at least one assertion to this test case" for unit test with assertions?
2
How can I include test reports in a C # SonarQube project?
1
Publishing Sonar Analysis to the SonarQube Dashboard
1
Sonarqube and working with multiple module test reports
0
Sonarqube for python: no test success score found - resource 'tests.test_transformation_helper.TestCase' not found
0
Single Testing Coverage Report Not Displaying on SonarQube Dashboard
0
How to Report Non Physical Resources in SonarQube
0
Importing Angle Unit Test Report into Sonarqube
0
SonarQube: including subset of test coverage classes in report



All Articles
Loading...
X
Show
Funny
Dev
Pics