use of org.folio.rest.jaxrs.model.RequestPreference in project mod-circulation-storage by folio-org.
the class RequestPreferencesApiTest method cannotUpdateRequestPreferenceWithDuplicateUserId.
@Test
public void cannotUpdateRequestPreferenceWithDuplicateUserId() {
createRequestPreference(USER_ID);
RequestPreference secondPreference = createRequestPreference(USER_ID2).getJson().mapTo(RequestPreference.class);
JsonResponse response = updatePreference(constructDefaultPreference(USER_ID).withId(secondPreference.getId()));
assertThat(response, isUnprocessableEntity());
assertThat(response.getJson().toString(), containsString("Request preference for specified user already exists"));
}
use of org.folio.rest.jaxrs.model.RequestPreference in project mod-circulation-storage by folio-org.
the class RequestPreferencesApiTest method cannotUpdateRequestPreferenceWithNotExistingId.
@Test
public void cannotUpdateRequestPreferenceWithNotExistingId() {
RequestPreference preference = constructDefaultPreference(USER_ID).withId(UUID.randomUUID().toString());
JsonResponse response = updatePreference(preference);
assertThat(response, isNotFound());
}
use of org.folio.rest.jaxrs.model.RequestPreference in project mod-circulation-storage by folio-org.
the class RequestPreferencesApiTest method canUpdateRequestPreference.
@Test
public void canUpdateRequestPreference() {
RequestPreference preference = createRequestPreference().getJson().mapTo(RequestPreference.class);
preference.setDelivery(false);
preference.setDefaultDeliveryAddressTypeId(null);
JsonResponse response = updatePreference(preference);
assertThat(response, isNoContent());
RequestPreference updatedPreference = getPreference(preference.getId()).getJson().mapTo(RequestPreference.class);
assertPreferenceEquals(preference, updatedPreference);
}
use of org.folio.rest.jaxrs.model.RequestPreference in project mod-circulation-storage by folio-org.
the class RequestPreferencesApiTest method canGetRequestPreferenceByUserIdUsingQuery.
@Test
public void canGetRequestPreferenceByUserIdUsingQuery() {
RequestPreference createdPreference = createRequestPreference().getJson().mapTo(RequestPreference.class);
JsonResponse response = getPreferences("query=userId=" + USER_ID);
RequestPreferences preferences = response.getJson().mapTo(RequestPreferences.class);
assertThat(preferences.getTotalRecords(), is(1));
RequestPreference foundPreference = preferences.getRequestPreferences().get(0);
assertPreferenceEquals(createdPreference, foundPreference);
}
use of org.folio.rest.jaxrs.model.RequestPreference in project mod-circulation-storage by folio-org.
the class RequestPreferencesApiTest method canGetRequestPreferenceById.
@Test
public void canGetRequestPreferenceById() {
RequestPreference preference = createRequestPreference().getJson().mapTo(RequestPreference.class);
RequestPreference responsePreference = getPreference(preference.getId()).getJson().mapTo(RequestPreference.class);
assertPreferenceEquals(preference, responsePreference);
}
Aggregations