Kpras
Kpras

Reputation: 183

Illegal initializer for 'java.lang.String' io.cucumber.java @After annotation

In Hooks.java after changing imports from

//import cucumber.api.java.After;
//import cucumber.api.java.Before;

To:

import io.cucumber.java.*;

Seeing below error for the piece of code:

@After({"@Phase1, @Phase2, @Phase3"})

Illegal initializer for 'java.lang.String'

Upvotes: 1

Views: 1538

Answers (1)

M.P. Korstanje
M.P. Korstanje

Reputation: 12039

Conditional hooks use a tag expression which is a single string. So you have to use @After("@Phase1 or @Phase2 or @Phase3").

Upvotes: 3

Related Questions