Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @When("^I call \"([^\"]*)\" with \"([^\"]*)\" the \"([^\"]*)\" is \"([^\"]*)\"$")
- public void i_call_with_the_is(String serviceName, String input, String property, String expectedValue) throws Throwable {
- String userName = configuration.getProperty("bpm.user.name");
- String password = configuration.getProperty("bpm.user.password");
- String requestURL = configuration.getProperty("rest.url") + configuration.getProperty("rest.unitTest") + serviceName;
- Response response = given().auth().
- form(userName, password, formAuthConfig).
- headers("Accept", "application/json", "Content-Type", "application/x-www-form-urlencoded", "X-Method-Override", "POST").
- queryParam("action", "start").
- queryParam("params", input).
- queryParam("createTask", "false").
- queryParam("parts", "all").
- post(requestURL);
- // System.out.println(response.prettyPrint());
- String responseBody = response.getBody().asString();
- JsonPath responseJson = new JsonPath(responseBody);
- String actualValue = String.valueOf(responseJson.getString(property));
- String contentsError = String.format("Expected %s but found %s", expectedValue, actualValue);
- Assert.assertTrue(expectedValue.equals(actualValue), contentsError);
- // System.out.println(response.prettyPrint());
- checkResponseCode(response);
- }
Add Comment
Please, Sign In to add comment