SpringJUnit4ClassRunner class not found
I fixed this one by
- Deleting my local maven repo (~/.m2/repository) and
- In eclipse forcing a new build (Project->Clean...)
Sourced from the appfuse forums
FYI, Add this in your pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
I downloaded your code and got it working locally, as long as I included the relevant import statements:
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.junit.runner.RunWith;
import org.junit.Test;
...
Perhaps you're missing an import somewhere.
Go to pom.xml and make sure your file contain this dependency:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.1.7.RELEASE</version>
</dependency>
Also make sure that in this dependency is no "scope" node:
<scope>test</scope>