Maven Selenium Project - 'Cannot resolve symbol 'AssertionsForClassTypes' in IntelliJ

105 Views Asked by At

I am getting the following 2 errors in my Maven project:-

'Cannot resolve symbol 'AssertionsForClassTypes' 'Cannot resolve method 'assertThat' in 'SearchTest'

In the pom.xml file, the following dependency exists:

<dependency>
    <groupId>org.assertj</groupId>
    <artifactId>assertj-core</artifactId>
    <version>3.8.0</version>
</dependency>

I also have the following in

<assertj.version>3.8.0</assertj.version>

This is what I have for import:-

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

As suggested, I removed the test line from the dependency, but that did not solve the problem. what am I doing wrong? I would like to resolve the following errors:

'Cannot resolve symbol 'AssertionsForClassTypes' 'Cannot resolve method 'assertThat' in 'SearchTest'

1

There are 1 best solutions below

0
On

Updating the < assertj > version in the < properties > section of the pom.xml file resolved the issue. I also updated the < testng > version. After updating the versions, I resolved the Maven dependencies. pom.xml file got updated with the following versions (as of Dec 27, 2022):-

 <testng.version>7.7.0</testng.version>
 <assertj.version>3.23.1</assertj.version>