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

©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页