vesii
vesii

Reputation: 3128

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.

Upvotes: 5

Views: 16966

Answers (1)

CrazyCoder
CrazyCoder

Reputation: 402265

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.

Upvotes: 1

Related Questions