1
votes

I created a SPRING BOOT application version 2.3.2 and when I try to write unit test with JUNIT 5. Unit test class in STS IDE shows org.junit is unresolved. Here is my depedency from build.gradle

dependencies {
    compile "org.springframework.boot:spring-boot-starter-actuator:2.3.2.RELEASE"
    compile "org.springframework.boot:spring-boot-starter-web:2.3.2.RELEASE"
    compile "org.springframework.boot:spring-boot-starter-log4j2:2.3.2.RELEASE"
    testCompile "org.springframework.boot:spring-boot-starter-test:2.3.2.RELEASE"
}

Test Class:

import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
      
class PasswordvaultComponentTest {
      
    @Test void test()
    {
        fail("Not yet implemented");
    }      
}

Since JUNIT JUPITER is already bundled into SPRING BOOT 2.3.2. I don't need to explicitly provide Junit Jupiter dependency in gradle. Am I missing any other configuration here. Any help is much appreciated.

1

1 Answers

1
votes

I had my test class in the package src/main/java. So I moved my test class to the package src/test/java and dependency was resolved.