first of all i have method like this ;
@When("^I send google-login-api with \"([^\"]*)\" token$")
public void googleLoginApi(String googleTokenSuccess) throws IOException {
String body = new String(Files.readAllBytes(Paths.get("src/test/resources/config/environments/googleLogin.json")));
JSONObject jsonObject = new JSONObject(body);
String googleToken = token.getString(googleTokenSuccess);
jsonObject.put("token",googleToken);
response = RestAssured.given()
.baseUri(prp_url)
.accept("application/json")
.contentType("application/json")
.queryParam("rememberMe","true")
.body(jsonObject.toString())
.when()
.post("/auth/google")
.then().assertThat().extract().response();
}
And i call this method in gherkin style ;
Scenario: 3AF GoogleLoginSuccess
When I send google-login-api with "google token success" token
Then response status code should be 200
Then response body "deviceInfo.name" is in "Firefox, Windows 10"
When I call token with different names in the BDD structure(When I send google-login-api with "google token success" token
), I want the method parameter name to change as well. For example when i call xyz token with BDD style, method parameter String googleTokenSuccess paramater is equal to xyz.