I am new to JBehave and the group so I apologize if this is a basic
question.
In my stories I have statements that I reuse in both the Given and When
context:
Given I set foo to 3
When I set foo to 3
In my steps code I have
@Given ("I set \"$field\" to \"$value\"")
public void set(String field, String value){.....
}
@When ("I set \"$field\" to \"$value\"")
public void whenset(String field, String value){.....
}
The code for both is the same. Can I use the following?
@Given ("I set \"$field\" to \"$value\"")
@When ("I set \"$field\" to \"$value\"")
public void set(String field, String value){.....
}
If not is there another option to avoid duplicating the code?
Thanks