Guest User

Untitled

a guest
Feb 12th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. @When("^I call \"([^\"]*)\" with \"([^\"]*)\" the \"([^\"]*)\" is \"([^\"]*)\"$")
  2. public void i_call_with_the_is(String serviceName, String input, String property, String expectedValue) throws Throwable {
  3.  
  4. String userName = configuration.getProperty("bpm.user.name");
  5. String password = configuration.getProperty("bpm.user.password");
  6.  
  7. String requestURL = configuration.getProperty("rest.url") + configuration.getProperty("rest.unitTest") + serviceName;
  8. Response response = given().auth().
  9. form(userName, password, formAuthConfig).
  10. headers("Accept", "application/json", "Content-Type", "application/x-www-form-urlencoded", "X-Method-Override", "POST").
  11. queryParam("action", "start").
  12. queryParam("params", input).
  13. queryParam("createTask", "false").
  14. queryParam("parts", "all").
  15. post(requestURL);
  16.  
  17. // System.out.println(response.prettyPrint());
  18.  
  19. String responseBody = response.getBody().asString();
  20. JsonPath responseJson = new JsonPath(responseBody);
  21. String actualValue = String.valueOf(responseJson.getString(property));
  22.  
  23. String contentsError = String.format("Expected %s but found %s", expectedValue, actualValue);
  24. Assert.assertTrue(expectedValue.equals(actualValue), contentsError);
  25.  
  26. // System.out.println(response.prettyPrint());
  27. checkResponseCode(response);
  28.  
  29. }
Add Comment
Please, Sign In to add comment