Hey its the first time i use JUnit with Java and i\'m not sure how to set it up inside Visual studio Code. I tried to put Junit-4.13.jar inside my a lib file in the root directo
There were 2 main issues with this configuration:
JUnit 4 dependency jar was used while in the source code imports from JUnit 5 API were used
Tests resided in the same location as sources, while the dependencies defined via Gradle/Maven for tests limit the scope to src/test/java
roots.
In a non-Gradle project the issue was fixed by adding the proper JUnit 5 dependencies to the module.
In the Gradle project the issue was fixed by moving the test class from src/main/java
to src/test/java
.
Sample Gradle project is available on GitHub.
More details about using JUnit 5 can be found in the official documentation.