@Test public void userMakesCallWithEmptyPayload_worksAsExpected() { prepareResponse(Status.OK, null); httpSteps.userMakesCallWithEmptyPayload(Method.GET, String.format(URI, serverPort, "test/get")); assertResponse(EMPTY_STRING); }
@Given("^" + Phrases.SUBJECT + " make" + Phrases.OPTIONAL_PLURAL + " a " + Phrases.HTTP_METHOD + " " + Phrases.HTTP_REQUEST + " to \"([^\"]+)\"?$") public void userMakesCallWithEmptyPayload(Method method, String uri) { makeCall(method, uri, null); }
HttpSteps { @Given("^" + Phrases.SUBJECT + " make" + Phrases.OPTIONAL_PLURAL + " a " + Phrases.HTTP_METHOD + " " + Phrases.HTTP_REQUEST + " to \"([^\"]+)\"?$") public void userMakesCallWithEmptyPayload(Method method, String uri) { makeCall(method, uri, null); } }
HttpSteps { @Given("^" + Phrases.SUBJECT + " make" + Phrases.OPTIONAL_PLURAL + " a " + Phrases.HTTP_METHOD + " " + Phrases.HTTP_REQUEST + " to \"([^\"]+)\"?$") public void userMakesCallWithEmptyPayload(Method method, String uri) { makeCall(method, uri, null); } HttpSteps(PropertyStore propertyStore, PlaceholderResolver placeholderResolver, HttpClient httpClient); }
HttpSteps { @Given("^" + Phrases.SUBJECT + " make" + Phrases.OPTIONAL_PLURAL + " a " + Phrases.HTTP_METHOD + " " + Phrases.HTTP_REQUEST + " to \"([^\"]+)\"?$") public void userMakesCallWithEmptyPayload(Method method, String uri) { makeCall(method, uri, null); } HttpSteps(PropertyStore propertyStore, PlaceholderResolver placeholderResolver, HttpClient httpClient); @Given("^" + Phrases.SUBJECT + " make" + Phrases.OPTIONAL_PLURAL + " a " + Phrases.HTTP_METHOD + " " + Phrases.HTTP_REQUEST + " to \"([^\"]+)\"?$") void userMakesCallWithEmptyPayload(Method method, String uri); @Given("^" + Phrases.SUBJECT + " make" + Phrases.OPTIONAL_PLURAL + " a " + Phrases.HTTP_METHOD + " " + Phrases.HTTP_REQUEST + " to \"([^\"]+)\" with " + Phrases.HTTP_BODY + " (.+)$") void userMakesCallWithProvidedPayload(Method method, String uri, String payload); @Given("^" + Phrases.SUBJECT + " make" + Phrases.OPTIONAL_PLURAL + " a " + Phrases.HTTP_METHOD + " " + Phrases.HTTP_REQUEST + " to \"([^\"]+)\" with " + Phrases.HTTP_BODY + ":$") void userMakesCallWithProvidedMultiLinePayload(Method method, String uri, String payload); @Then("^" + Phrases.SUBJECT + " should get a (\\d+) response and JSON matching:$") void assertStatusAndJsonResponse(int statusCode, String expectedJson); @Then("^" + Phrases.SUBJECT + " should get a (\\d+) response and JSON with (.+) matching:$") void assertStatusAndJsonResponsePortion(int statusCode, String path, String expectedJson); @Then("^" + Phrases.SUBJECT + " should get a (\\d+) response with a non-empty " + Phrases.HTTP_BODY + "$") void assertStatusAndNonEmptyResponse(int statusCode); @Then("^" + Phrases.SUBJECT + " should get a (\\d+) response with " + Phrases.HTTP_BODY + " containing \"(.+)\"$") void assertStatusAndResponseWithContent(int statusCode, String expectedContent); @Then("^" + Phrases.SUBJECT + " should get a (\\d+) response$") void assertStatus(int statusCode); @Then("^" + Phrases.SUBJECT + " should get a (\\d+) response with headers:$") void assertResponseAndHeaders(int statusCode, Map<String, String> headers); @And("^the response " + Phrases.HTTP_BODY + " is stored as (.+)$") void storeResponse(String key); @And("^(.+) from the JSON response is stored as (.+)$") void storeJsonResponsePortion(String path, String key); @And("^a request header (.+) is added with value \"(.*)\"$") void addValueToHeader(String headerKey, String value); @And("^the request header (.+) is removed$") void removeHeader(String header); Status getLastResponseStatus(); Map<String, String> initAndGetHeaders(); Map<String, String> getHeaders(); Observable<JsonObject> makeStreamingJsonCall(Method method, String uri, Map<String, String> headers); final void clearHeaders(); PropertyStore getPropertyStore(); PlaceholderResolver getPlaceholderResolver(); HttpClient getHttpClient(); }
HttpSteps { @Given("^" + Phrases.SUBJECT + " make" + Phrases.OPTIONAL_PLURAL + " a " + Phrases.HTTP_METHOD + " " + Phrases.HTTP_REQUEST + " to \"([^\"]+)\"?$") public void userMakesCallWithEmptyPayload(Method method, String uri) { makeCall(method, uri, null); } HttpSteps(PropertyStore propertyStore, PlaceholderResolver placeholderResolver, HttpClient httpClient); @Given("^" + Phrases.SUBJECT + " make" + Phrases.OPTIONAL_PLURAL + " a " + Phrases.HTTP_METHOD + " " + Phrases.HTTP_REQUEST + " to \"([^\"]+)\"?$") void userMakesCallWithEmptyPayload(Method method, String uri); @Given("^" + Phrases.SUBJECT + " make" + Phrases.OPTIONAL_PLURAL + " a " + Phrases.HTTP_METHOD + " " + Phrases.HTTP_REQUEST + " to \"([^\"]+)\" with " + Phrases.HTTP_BODY + " (.+)$") void userMakesCallWithProvidedPayload(Method method, String uri, String payload); @Given("^" + Phrases.SUBJECT + " make" + Phrases.OPTIONAL_PLURAL + " a " + Phrases.HTTP_METHOD + " " + Phrases.HTTP_REQUEST + " to \"([^\"]+)\" with " + Phrases.HTTP_BODY + ":$") void userMakesCallWithProvidedMultiLinePayload(Method method, String uri, String payload); @Then("^" + Phrases.SUBJECT + " should get a (\\d+) response and JSON matching:$") void assertStatusAndJsonResponse(int statusCode, String expectedJson); @Then("^" + Phrases.SUBJECT + " should get a (\\d+) response and JSON with (.+) matching:$") void assertStatusAndJsonResponsePortion(int statusCode, String path, String expectedJson); @Then("^" + Phrases.SUBJECT + " should get a (\\d+) response with a non-empty " + Phrases.HTTP_BODY + "$") void assertStatusAndNonEmptyResponse(int statusCode); @Then("^" + Phrases.SUBJECT + " should get a (\\d+) response with " + Phrases.HTTP_BODY + " containing \"(.+)\"$") void assertStatusAndResponseWithContent(int statusCode, String expectedContent); @Then("^" + Phrases.SUBJECT + " should get a (\\d+) response$") void assertStatus(int statusCode); @Then("^" + Phrases.SUBJECT + " should get a (\\d+) response with headers:$") void assertResponseAndHeaders(int statusCode, Map<String, String> headers); @And("^the response " + Phrases.HTTP_BODY + " is stored as (.+)$") void storeResponse(String key); @And("^(.+) from the JSON response is stored as (.+)$") void storeJsonResponsePortion(String path, String key); @And("^a request header (.+) is added with value \"(.*)\"$") void addValueToHeader(String headerKey, String value); @And("^the request header (.+) is removed$") void removeHeader(String header); Status getLastResponseStatus(); Map<String, String> initAndGetHeaders(); Map<String, String> getHeaders(); Observable<JsonObject> makeStreamingJsonCall(Method method, String uri, Map<String, String> headers); final void clearHeaders(); PropertyStore getPropertyStore(); PlaceholderResolver getPlaceholderResolver(); HttpClient getHttpClient();  }