This rule incorrectly warns that ‘assertAll’ needs to be called for AssertJ assertions in this example. Note that the AutocloseableSoftAssertions calls the ‘assertAll()’ method in its close method.
I am seeing the false positive in SonarQube version 7.6.
Here is a very simple example:
import org.assertj.core.api.AutoCloseableSoftAssertions;
import org.junit.jupiter.api.Test;
class FalsePositiveTest {
@Test
void falsePositive() {
try(AutoCloseableSoftAssertions softly = new AutoCloseableSoftAssertions()) {
softly.assertThat(true).isTrue();
softly.assertThat(false).isFalse();
}
} // The violation is marked here since it apparently doesn't know 'assertAll()' was called
}