We have a lots of code (not all) on which an issue gets reported for not having an assert but it does exist 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 out the validator into a variable and assertTrue the variable then the violation goes away.
The assertTrue import is: import static org.junit.Assert.assertTrue;
I am using SonarQube 6.4.0.25310 with SonarJava 4.10.0.10260.
Why is it saying I do not have an assert?