use of api.support.builders.ItemRequestBuilder in project mod-inventory by folio-org.
the class MarkItemInProcessNonRequestableApiTests method shouldNotReopenClosedRequests.
@Test
@Parameters({ "Closed - Cancelled", "Closed - Filled", "Closed - Pickup expired", "Closed - Unfilled" })
public void shouldNotReopenClosedRequests(String requestStatus) throws Exception {
final IndividualResource createdItem = itemsClient.create(new ItemRequestBuilder().forHolding(holdingsRecord.getId()).withStatus("Awaiting pickup").canCirculate());
final IndividualResource request = createRequest(createdItem.getId(), requestStatus, DateTime.now(DateTimeZone.UTC).plusHours(1));
assertThat(markItemInProcessNonRequestable(createdItem).getJson(), isInProcessNonRequestable());
assertThat(itemsClient.getById(createdItem.getId()).getJson(), isInProcessNonRequestable());
assertThat(requestStorageClient.getById(request.getId()).getJson(), hasStatus(requestStatus));
}
use of api.support.builders.ItemRequestBuilder in project mod-inventory by folio-org.
the class MarkItemIntellectualItemApiTests method cannotMarkItemIntellectualItemWhenNotInAllowedStatus.
@Test
public void cannotMarkItemIntellectualItemWhenNotInAllowedStatus() throws Exception {
final String initialStatus = "Intellectual item";
final IndividualResource createdItem = itemsClient.create(new ItemRequestBuilder().forHolding(holdingsRecord.getId()).withStatus(initialStatus).canCirculate());
Response response = markItemIntellectualItem(createdItem);
assertThat(markItemIntellectualItem(createdItem), hasValidationError("Item is not allowed to be marked as Intellectual item", "status.name", initialStatus));
}
use of api.support.builders.ItemRequestBuilder in project mod-inventory by folio-org.
the class MarkItemIntellectualItemApiTests method shouldNotReopenClosedRequests.
@Test
@Parameters({ "Closed - Cancelled", "Closed - Filled", "Closed - Pickup expired", "Closed - Unfilled" })
public void shouldNotReopenClosedRequests(String requestStatus) throws Exception {
final IndividualResource createdItem = itemsClient.create(new ItemRequestBuilder().forHolding(holdingsRecord.getId()).withStatus("Awaiting pickup").canCirculate());
final IndividualResource request = createRequest(createdItem.getId(), requestStatus, DateTime.now(DateTimeZone.UTC).plusHours(1));
assertThat(markItemIntellectualItem(createdItem).getJson(), isIntellectualItem());
assertThat(itemsClient.getById(createdItem.getId()).getJson(), isIntellectualItem());
assertThat(requestStorageClient.getById(request.getId()).getJson(), hasStatus(requestStatus));
}
use of api.support.builders.ItemRequestBuilder in project mod-inventory by folio-org.
the class MarkItemIntellectualItemApiTests method canMarkItemIntellectualItemWhenInAllowedStatus.
@Test
public void canMarkItemIntellectualItemWhenInAllowedStatus() throws Exception {
final IndividualResource createdItem = itemsClient.create(new ItemRequestBuilder().forHolding(holdingsRecord.getId()).withStatus("Awaiting delivery").canCirculate());
final Response response = markItemIntellectualItem(createdItem);
assertEquals(200, response.getStatusCode());
assertThat(response.getJson(), isIntellectualItem());
assertThat(itemsClient.getById(createdItem.getId()).getJson(), isIntellectualItem());
}
use of api.support.builders.ItemRequestBuilder in project mod-inventory by folio-org.
the class MarkItemLongMissingApiTests method testMarkItemLongMissingPreservesCirculationNotes.
@Test
public void testMarkItemLongMissingPreservesCirculationNotes() throws Exception {
final IndividualResource createdItem = itemsClient.create(new ItemRequestBuilder().forHolding(holdingsRecord.getId()).withCheckInNote().canCirculate());
final var item = markItemLongMissing(createdItem).getJson();
final var itemCirculationNotes = item.getJsonArray(CIRCULATION_NOTES_KEY);
final var checkInNote = itemCirculationNotes.getJsonObject(0);
assertThat(checkInNote.getString(NOTE_TYPE_KEY), is("Check in"));
assertThat(checkInNote.getString(NOTE_KEY), is("Please read this note before checking in the item"));
assertThat(checkInNote.getBoolean(STAFF_ONLY_KEY), is(false));
}
Aggregations