Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't add multiple annotations on a groovy method?

 when I add two annotations to a method like this       

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

}

got this error

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

my configuration:jdk 1.7,testng 6.8,groovy 2.0(installed with groovy eclipse plugin)

why?

like image 732
Alex Luya Avatar asked Jan 31 '13 06:01

Alex Luya


1 Answers

If this is a Groovy file, then

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

Should probably be:

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

Or

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

Not sure, I haven't used TestNG. But you can definitely have multiple annotations per node with Groovy, it's just this isn't how groovy does lists or arrays

like image 133
tim_yates Avatar answered Oct 15 '22 04:10

tim_yates