com.accenture.testing.bdd.api.steps.ParameterSteps Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bdd-for-all Show documentation
Show all versions of bdd-for-all Show documentation
A simple to use, easy to integrate, BDD library for API and microservices development.
The newest version!
package com.accenture.testing.bdd.api.steps;
import com.accenture.testing.bdd.parameters.DefaultParamTransformer;
import io.cucumber.datatable.DataTable;
import com.accenture.testing.bdd.api.http.APIRequestState;
import io.cucumber.java8.En;
public class ParameterSteps implements En {
/**
* container for cucumber lambda methods.
*
* @param requestState injected object
* @param paramTransformer injected object
*/
public ParameterSteps(APIRequestState requestState, DefaultParamTransformer paramTransformer) {
/**
* add a parameter to the request.
*
* @param name the parameter name
* @param val the paramater value
*/
When(
"I provide the parameter {string} with a value of {string}",
(String name, String val) -> {
name = paramTransformer.transform(name);
val = paramTransformer.transform(val);
requestState.setParameter(name, val);
});
/**
* adds parameters to request.
*
* @param table the parameters to add
*/
When(
"^I provide the parameters$",
(DataTable table) -> {
table
.asMap(String.class, String.class)
.forEach(
(name, val) -> {
name = paramTransformer.transform((String) name);
val = paramTransformer.transform((String) val);
requestState.setParameter((String) name, (String) val);
});
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy