S2699 Support custom annotations as assertions

Could we please get a new parameter allowing to define customAssertionAnnotations?

Hi @Vincent_Privat ,

Before asking for this solution, what is the usecase/problem you are encountering ?

Hi Nicolas,
We are facing this issue in some of our tests because we defined our own annotation-based assertion mechanism to test our persistence classes, as follows:

@Test
@DatabaseSetup("/db/data/OurService/testUpdate/setupUpdate.json")
@DatabaseAssert("/db/data/OurService/testUpdate/resultUpdate.json")
void testUpdate() {
    // Do something that is not checked directly by a JUnit assert
}

So in this case we would like to tell SonarQube that @DatabaseAssert is an assertion.

Hi,

This parameter should be available since SonarJava 5.11 (see ticket). Yet I’m not sure it will work with annotations.