use of org.folio.rest.support.JsonResponse in project mod-circulation-storage by folio-org.
the class CirculationRulesApiTest method get.
/**
* @return the JSON of the get response, asserts an HTTP_OK=200 response
*/
private JsonObject get() throws Exception {
JsonResponse response = getResponse();
assertThat(response, matchesOk());
return response.getJson();
}
use of org.folio.rest.support.JsonResponse in project mod-circulation-storage by folio-org.
the class PatronNoticePoliciesApiTest method cannotUpdatePatronNoticePolicyWithNotValidSendEvery.
@Test
public void cannotUpdatePatronNoticePolicyWithNotValidSendEvery() throws InterruptedException, MalformedURLException, TimeoutException, ExecutionException {
JsonObject sendEvery = new JsonObject().put("duration", "2").put("intervalId", "Hours");
JsonObject sendOptions = new JsonObject().put("sendWhen", "Renewed").put("sendEvery", sendEvery);
JsonObject noticePolicy = createNoticePolicyWithSendOptions(sendOptions);
JsonResponse response = putPatronNoticePolicy(noticePolicy);
assertThat(response.getStatusCode(), is(422));
assertThat(response.getJson().getJsonArray("errors").getJsonObject(0).getString("message"), is("This option is not valid for selected Triggering event"));
}
use of org.folio.rest.support.JsonResponse in project mod-circulation-storage by folio-org.
the class PatronNoticePoliciesApiTest method canDeletePatronNoticePolicy.
@Test
public void canDeletePatronNoticePolicy() throws MalformedURLException, InterruptedException, ExecutionException, TimeoutException {
JsonObject noticePolicy = new JsonObject().put("name", "sample policy");
String id = postPatronNoticePolicy(noticePolicy).getJson().getString("id");
JsonResponse response = deletePatronNoticePolicy(id);
assertThat(response.getStatusCode(), is(204));
}
use of org.folio.rest.support.JsonResponse in project mod-circulation-storage by folio-org.
the class PatronNoticePoliciesApiTest method cannotUpdatePatronNoticePolicyWithNotUniqueName.
@Test
public void cannotUpdatePatronNoticePolicyWithNotUniqueName() throws MalformedURLException, InterruptedException, ExecutionException, TimeoutException {
JsonObject firstPolicy = new JsonObject().put("name", "first policy");
JsonObject secondPolicy = new JsonObject().put("name", "second policy");
postPatronNoticePolicy(firstPolicy);
String id = postPatronNoticePolicy(secondPolicy).getJson().getString("id");
JsonResponse response = putPatronNoticePolicy(secondPolicy.put("id", id).put("name", firstPolicy.getString("name")));
String code = response.getJson().getJsonArray("errors").getJsonObject(0).getString("code");
assertThat(response.getStatusCode(), is(422));
assertThat(code, is(STATUS_CODE_DUPLICATE_NAME));
}
use of org.folio.rest.support.JsonResponse in project mod-circulation-storage by folio-org.
the class AnonymizeLoansApiTest method anonymizeLoans.
private AnonymizeStorageLoansResponse anonymizeLoans(String... loanIds) throws MalformedURLException {
final JsonResponse response = attemptAnonymizeLoans(loanIds);
assertThat(response.getStatusCode(), is(200));
return response.getJson().mapTo(AnonymizeStorageLoansResponse.class);
}
Aggregations