问答详情
源自:2-2 Spring Boot 起步

runwith是红色的,应该怎么办呢

package com.neo.helloWorld.service;

import com.neo.helloWorld.hello.HelloService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

@RunWith(SpringRunner.class)

@SpringBootTest
public class HelloTest {
    @Resource
    HelloService helloService;

    @Test
    public void  sayHelloTest(){
        helloService.sayHello();
    }
}


提问者:qq_时光冲散了记忆的脉搏_1 2020-04-20 08:47

个回答

  • 慕慕0457495
    2020-09-30 21:10:01

    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>
       <version>4.11</version>
    </dependency>
    添加版本4.11,版本4.13报错


  • 慕仔6191335
    2020-04-20 13:53:01

    是不是没有junit   jar包的依赖。

    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>
    </dependency>