I am experimenting what I think to be a purely Intellij related issue (though I don't know how to fix it nor where it comes from). I basically followed this tutorial to migrate tests from JUnit 4 to 5.
Tests after migration
By the end of the migration, I now have the following dependencies in pom.xml
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.6.3</version>
<scope>test</scope>
</dependency>
and the different Test Classes now uses
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.Test;
Problem
I keep getting Cannot resolve symbol 'jupiter'
while running tests in IntelliJ. However, everything is OK in my CI pipeline ?!?!? (so probably something wrong in IntelliJ). No matter the fix actions proposed (resp. Add JUnit 5.4 to classpath
and Add Maven dependencies
), I keep getting the same. So what's next?
Environment
- openjdk11
- IntelliJ 2020.3.1
Interestingly, changes do not seem to be reflected on cockpit.iml, for it still contains
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.11" level="project" />
and no mention of JUnit 5. Are both problems related?
What I tried
- based on this documentation, I added
org.junit.platform
:junit-platform-launcher
- I tried
File | Invalidate Caches
sources - remove
.idea
andcockpit.iml
to reimport everything.
There is a mismatch somewhere but I can't figure where