Skip to content

Commit

Permalink
feat(impl): [#528] add step definitions for cucumber tests for valida…
Browse files Browse the repository at this point in the history
…ting error response message
  • Loading branch information
dsmf committed May 10, 2024
1 parent aba7f8e commit a101fdd
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,23 @@ public void theCreatePolicyResponseShouldHaveStatus(final int httpStatus) {

@Then("the create policy response should have message containing {string}")
public void theCreatePolicyResponseShouldHaveMessageContaining(final String string) {
this.createPoliciesResponse.body("messages", Matchers.hasItem(Matchers.containsString(string)));
final ValidatableResponse validatableResponse = this.createPoliciesResponse;
assertThatResponseHasMessageContaining(validatableResponse, string);
}

@Then("the delete policy response should have message containing {string}")
public void thedeletePolicyResponseShouldHaveMessageContaining(final String string) {
assertThatResponseHasMessageContaining(this.deletePoliciesResponse, string);
}

@Then("the update policy response should have message containing {string}")
public void theUpdatePolicyResponseShouldHaveMessageContaining(final String string) {
assertThatResponseHasMessageContaining(this.updatePoliciesResponse, string);
}

private static void assertThatResponseHasMessageContaining(final ValidatableResponse validatableResponse,
final String string) {
validatableResponse.body("messages", Matchers.hasItem(Matchers.containsString(string)));
}

@Then("the update policy response should have HTTP status {int}")
Expand Down

0 comments on commit a101fdd

Please sign in to comment.