(異常-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

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