I've set up JUnit in IntelliJ IDEA and have a bunch of tests with nothing in them. When I run them, they all pass as expected. However, when I type "assertEquals", it shows up in red. When I hover over it, it says "Cannot resolve method."
I've googled around and it looks like I need to do:
import static org.junit.Assert.*;
However, when I start typing import static org.junit.
, the next options are "*", "jupiter", or "platform"...
For reference, here's what a sample test looks like in my IDE:
@org.junit.jupiter.api.Test
void isButton() {
assertEquals()
}
Any idea how to fix this?
Thanks!
The full path to
Assertions
class is:Ensure you have added Jupiter API to your dependencies:
Gradle:
Maven:
There is a nice guide for Intellij IDEA and JUnit 5. Take a look at it: Using JUnit 5 in IntelliJ IDEA