public class HttpSteps extends Object
| Constructor and Description |
|---|
HttpSteps(PropertyStore propertyStore,
PlaceholderResolver placeholderResolver,
HttpClient httpClient) |
| Modifier and Type | Method and Description |
|---|---|
void |
addValueToHeader(String headerKey,
String value) |
void |
assertResponseAndHeaders(int statusCode,
Map<String,String> headers) |
void |
assertStatus(int statusCode) |
void |
assertStatusAndJsonResponse(int statusCode,
String expectedJson) |
void |
assertStatusAndJsonResponsePortion(int statusCode,
String path,
String expectedJson) |
void |
assertStatusAndNonEmptyResponse(int statusCode) |
void |
assertStatusAndResponseWithContent(int statusCode,
String expectedContent) |
Status |
getLastResponseStatus() |
void |
removeHeader(String header) |
void |
storeJsonResponsePortion(String path,
String key) |
void |
storeResponse(String key) |
void |
userMakesCallWithEmptyPayload(Method method,
String uri) |
void |
userMakesCallWithProvidedMultiLinePayload(Method method,
String uri,
String payload) |
void |
userMakesCallWithProvidedPayload(Method method,
String uri,
String payload) |
public HttpSteps(PropertyStore propertyStore, PlaceholderResolver placeholderResolver, HttpClient httpClient)
@Given(value="^(?:we|he|she|the user|a user) make(?:s)? a (GET|POST|PUT|PATCH|DELETE) (?:request|call) to \"([^\"]+)\"?$") public void userMakesCallWithEmptyPayload(Method method, String uri)
@Given(value="^(?:we|he|she|the user|a user) make(?:s)? a (GET|POST|PUT|PATCH|DELETE) (?:request|call) to \"([^\"]+)\" with (?:entity|body|payload) (.+)$") public void userMakesCallWithProvidedPayload(Method method, String uri, String payload)
@Given(value="^(?:we|he|she|the user|a user) make(?:s)? a (GET|POST|PUT|PATCH|DELETE) (?:request|call) to \"([^\"]+)\" with (?:entity|body|payload):$") public void userMakesCallWithProvidedMultiLinePayload(Method method, String uri, String payload)
@Then(value="^(?:we|he|she|the user|a user) should get a (\\d+) response and JSON matching:$")
public void assertStatusAndJsonResponse(int statusCode,
String expectedJson)
@Then(value="^(?:we|he|she|the user|a user) should get a (\\d+) response and JSON with (.+) matching:$")
public void assertStatusAndJsonResponsePortion(int statusCode,
String path,
String expectedJson)
@Then(value="^(?:we|he|she|the user|a user) should get a (\\d+) response with a non-empty (?:entity|body|payload)$") public void assertStatusAndNonEmptyResponse(int statusCode)
@Then(value="^(?:we|he|she|the user|a user) should get a (\\d+) response with (?:entity|body|payload) containing \"(.+)\"$")
public void assertStatusAndResponseWithContent(int statusCode,
String expectedContent)
@Then(value="^(?:we|he|she|the user|a user) should get a (\\d+) response$") public void assertStatus(int statusCode)
@Then(value="^(?:we|he|she|the user|a user) should get a (\\d+) response with headers:$")
public void assertResponseAndHeaders(int statusCode,
Map<String,String> headers)
@And(value="^the response (?:entity|body|payload) is stored as (.+)$") public void storeResponse(String key)
@And(value="^(.+) from the JSON response is stored as (.+)$") public void storeJsonResponsePortion(String path, String key)
@And(value="^a request header (.+) is added with value \"(.*)\"$") public void addValueToHeader(String headerKey, String value)
@And(value="^the request header (.+) is removed$") public void removeHeader(String header)
public Status getLastResponseStatus()
Copyright © 2016. All rights reserved.