I'm trying to write some steps in Cucumber-jvm and I've got a step that is approximately like the following:
@Given("I am a (regular|admin|guest) user")
public void setUser(String userType){
if("regular".equals(userType))
setUserType(REGULAR);
if("admin".equals(userType))
setUserType(ADMIN);
if("guest".equals(userType))
setUserType(GUEST);
}
Is there a better way of writing such a step, to make it polymorphic?