When I use spring AssertableApplicationContext, I get s2699 but the assertions are done using assertThat which is not recognized as assertion. This is a false positive and the scanner should take into account assertThat
Import
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Properties;
import org.apache.kafka.streams.StreamsBuilder;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener;
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.boot.test.context.runner.ContextConsumer;
The code snippet is
@Test
final void testServiceConfig() {
**==> Add at least one assertion to this test case.**
ContextConsumer<AssertableApplicationContext> assertConfig = new AssertConfig();
contextRunner //
.withPropertyValues("kafka.bootstrap.servers=localhost:3333", //
"ems.maintenance.service.replication.factor=1")
.run(assertConfig);
}
class AssertConfig implements ContextConsumer<AssertableApplicationContext> {
@Override
public void accept(AssertableApplicationContext context) throws Throwable {
assertThat(context).getBean("streamsConfig").isInstanceOf(Properties.class);
assertThat(context).getBean("kStreamBuilder").isInstanceOf(StreamsBuilder.class);
}
}
Please let me know if it could be fixed.
Thank a lot in advance