Unable to add multiple annotations to 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?

+5
source share
1 answer

If this is a Groovy file, then

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

Must be:

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

or

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

Not sure I have not used TestNG. But you can definitely have some annotations on a node using Groovy, it's not like Groovy contains lists or arrays

+11
source

All Articles