JUnit-没有可运行的方法

时间:2018-11-21 21:11:08

标签: junit spring-test spring-test-mvc

我正在尝试测试由Spring定义的简单RestController。我创建了一个简单的测试文件,但正在获取java.lang.Exception:没有可运行的方法。

@RunWith(SpringJUnit4ClassRunner.class)
@WebMvcTest(MyController.class)
public class MyControllerTest{

    @Autowired
    private MockMvc mvc;

    @MockBean
    private MyService myservice;

    @Test
    public void myTest() throws Exception{

        //test something
    }

怎么了?为什么我不能运行测试?

0 个答案:

没有答案