加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

无法在groovy方法上添加多个注释?

发布时间:2020-12-14 16:28:55 所属栏目:大数据 来源:网络整理
导读:when I add two annotations to a method like this @Parameters({"userName",""})@Testpublic void replyMaster(){} 得到了这个错误 Multiple markers at this line- Groovy:unexpected token: @ @ line 40,column 2.- Duplicate field ReplyTest.@- Groovy
when I add two annotations to a method like this       

@Parameters({"userName",""})
@Test
public void replyMaster()
{

}

得到了这个错误

Multiple markers at this line
- Groovy:unexpected token: @ @ line 40,column 2.
- Duplicate field ReplyTest.@
- Groovy:The field '@' is declared multiple times.

我的配置:jdk 1.7,testng 6.8,groovy 2.0(安装了groovy eclipse插件)

为什么?

解决方法

如果这是一个Groovy文件,那么

@Parameters({"userName",""})

应该是:

@Parameters(["userName",""])

要么

@Parameters(["userName",""] as Object[])

不确定,我还没有使用过TestNG.但是你可以使用Groovy在每个节点上有多个注释,只是这不是groovy的列表或数组的方式

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读