assertj Assertions assertThat is not resolved

Weird behavior. I’ve got a vanilla spring boot project I made with initializr. The build.gradle is below and as you can see it loaded up the test dependency for spring boot starter test, which includes the assertj package.

plugins {
    id 'org.springframework.boot' version '2.5.4'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'

group = 'com.acme'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
    compileOnly {
        extendsFrom annotationProcessor

repositories {

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-webflux'
    compileOnly 'org.projectlombok:lombok'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'io.projectreactor:reactor-test'

test {

However, I have my first test component here


import org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

public class ChartControllerTest {

    private ChartController controller;

    public void contextLoads() throws Exception{


And IJ is telling me that it cannot resolve the symbol assertThat. It loads up to Assertions in the import statement and that’s in. When I click into the Assertions class I see the public method assertThat. Is there some IJ setting that’s screwing up the static import?

It does work to just import Assertions and use the method with dot notation, but why won’t the static import work?


When we want to write assertions in AssertJ, we have to use static assertThat method instead. This means that you have to import it like following instead:

import static org.assertj.core.api.Assertions.assertThat;