cannot resolve symbol 'assertDoesNotThrow'

I have some problem with In intellij. I try to import the following library:

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;

But I get the following error:

cannot resolve symbol 'assertDoesNotThrow'

But I don't get errors for assertEquals.

The use:

assertDoesNotThrow(() -> r1.rate(new Pro(1, "xyz"), 0));
assertDoesNotThrow(() -> r1.rate(new Pro(1, "xyz"), 5));

I guess this is some problem with JUInt, but I can't seem to find the solution. I have tried some previous threads but without success.

5

1 Answer

When you add JUnit library in IntelliJ IDEA via the intention action, there is a choice which library version to add:

junit 5.3

If you add 5.3 version, you will see the following in the Module Dependencies:

module dependencies

In case you have some older version there, delete these libraries and add the correct version again.

Refer to the Configuring Testing Libraries help section.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like