Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Erro quando tento colocar o @RunWith(SpringRunner.class)

Minha classe de teste:

import org.junit.Assert;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@SpringBootTest
@RunWith(SpringRunner.class)
class ApplicationTests {
    @Test
    void contextLoads() {
        Assert.assertTrue(true);
    }
}

Erro: Incompatible types. Found: 'java.lang.Class<org.springframework.test.context.junit4.SpringRunner>', required: 'java.lang.Class<? extends org.junit.runner.Runner>'

Dependencias relacionadas:

<dependency>
 <groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-starter-test</artifactId>
 <scope>test</scope>
</dependency>
<dependency>
 <groupId>junit</groupId>
 <artifactId>junit</artifactId>
 <version>4.4</version>
 <scope>test</scope>
</dependency>

Utilizo a versão 2.5.2 do Maven

1 resposta
solução!

Resolvi o problema trocando as dependencias:

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <version>2.5.0</version>
        </dependency>

        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>