Squid:S2970 Add a call to 'assertAll' after all 'assertThat' when using AutoCloseableSoftAssertions

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
}

Hi @nickstolwijk

I believe you are not using the latest version of SonarJava. Try to upgrade as your problem is fixed by SONARJAVA-2021.