Search code examples
javaspring-bootjunit-jupiter

How to fix " java: package org.junit.jupiter.api does not exist "


This is my first springboot crud. Please help me to fix the errors .

package com.example1.fullstack_practice;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class FullstackPracticeApplicationTests {

    @Test
     void contextLoads() {
    }

}

Solution

  • You have to add the dependency to your class path. If you are using maven add:

    <!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>5.9.2</version>
        <scope>test</scope>
    </dependency>
    

    to your pom.xml