(异常-Junit) The annotation @Test is disallowed for this location

问题

遇到这样的异常情况.

The annotation @Test is disallowed for this location

问题代码:

   @Test
    public void testCase1{
    	
    }

解决措施

脑抽了. 方法没加()括号. 加上即可.

 @Test
    public void testCase1(){
    	
    }

一般此类异常主要有2个原因:

  • 编写错误
  • @Test标签位置错误

Reference

[1]. The annotation @Test is disallowed for this location

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章