use of org.folio.rest.support.IndividualResource in project mod-inventory-storage by folio-org.
the class ItemStorageTest method shouldFindItemByCallNumberWhenThereIsSuffix.
@Test
public void shouldFindItemByCallNumberWhenThereIsSuffix() throws Exception {
final UUID holdingsRecordId = createInstanceAndHolding(mainLibraryLocationId);
final IndividualResource firstItemToMatch = itemsClient.create(new ItemRequestBuilder().forHolding(holdingsRecordId).withMaterialType(journalMaterialTypeId).withPermanentLoanType(canCirculateLoanTypeId).withItemLevelCallNumber("GE77 .F73 2014").available());
final IndividualResource secondItemToMatch = itemsClient.create(new ItemRequestBuilder().forHolding(holdingsRecordId).withMaterialType(journalMaterialTypeId).withPermanentLoanType(canCirculateLoanTypeId).withItemLevelCallNumber("GE77 .F73 2014").withItemLevelCallNumberSuffix("Curriculum Materials Collection").available());
itemsClient.create(new ItemRequestBuilder().forHolding(holdingsRecordId).withMaterialType(journalMaterialTypeId).withPermanentLoanType(canCirculateLoanTypeId).withItemLevelCallNumber("GE77 .F73 ").withItemLevelCallNumberSuffix("2014 Curriculum Materials Collection").available());
final List<UUID> foundItems = searchByCallNumberEyeReadable("GE77 .F73 2014");
assertThat(foundItems.size(), is(2));
assertThat(foundItems, hasItems(firstItemToMatch.getId(), secondItemToMatch.getId()));
}
use of org.folio.rest.support.IndividualResource in project mod-inventory-storage by folio-org.
the class PrecedingSucceedingTitleTest method canCreateConnectedPrecedingSucceedingTitle.
@Test
public void canCreateConnectedPrecedingSucceedingTitle() {
IndividualResource instance1Resource = createInstance("Title One");
IndividualResource instance2Resource = createInstance("Title Two");
String instance1Id = instance1Resource.getId().toString();
String instance2Id = instance2Resource.getId().toString();
PrecedingSucceedingTitle precedingSucceedingTitle = new PrecedingSucceedingTitle(instance1Id, instance2Id, null, null, null);
IndividualResource response = precedingSucceedingTitleClient.create(precedingSucceedingTitle.getJson());
assertPrecedingSucceedingTitle(response, instance1Id, instance2Id, null, null, new JsonArray());
}
use of org.folio.rest.support.IndividualResource in project mod-inventory-storage by folio-org.
the class PrecedingSucceedingTitleTest method canCreateUnconnectedSucceedingTitle.
@Test
public void canCreateUnconnectedSucceedingTitle() {
IndividualResource instanceResource = createInstance("Title One");
String instanceId = instanceResource.getId().toString();
JsonArray identifiers = new JsonArray();
identifiers.add(identifier(UUID_ISBN, "9781473619777"));
PrecedingSucceedingTitle precedingSucceedingTitle = new PrecedingSucceedingTitle(instanceId, null, TITLE, HRID, identifiers);
IndividualResource response = precedingSucceedingTitleClient.create(precedingSucceedingTitle.getJson());
assertPrecedingSucceedingTitle(response, instanceId, null, TITLE, HRID, identifiers);
}
use of org.folio.rest.support.IndividualResource in project mod-inventory-storage by folio-org.
the class PrecedingSucceedingTitleTest method cannotCreatePrecedingSucceedingTitleWithNonExistingPrecedingInstance.
@Test
public void cannotCreatePrecedingSucceedingTitleWithNonExistingPrecedingInstance() {
String nonExistingInstanceId = "14b65645-2e49-4a85-8dc1-43d444710570";
IndividualResource instanceResource = createInstance("Title One");
PrecedingSucceedingTitle precedingSucceedingTitle = new PrecedingSucceedingTitle(nonExistingInstanceId, instanceResource.getId().toString(), null, null, null);
Response response = precedingSucceedingTitleClient.attemptToCreate(precedingSucceedingTitle.getJson());
assertThat(response.getStatusCode(), is(HttpResponseStatus.UNPROCESSABLE_ENTITY.code()));
assertErrors(response, "Cannot set preceding_succeeding_title.precedinginstanceid = " + "14b65645-2e49-4a85-8dc1-43d444710570 because it does not exist in instance.id.");
}
use of org.folio.rest.support.IndividualResource in project mod-inventory-storage by folio-org.
the class PrecedingSucceedingTitleTest method canDeletePrecedingSucceedingTitle.
@Test
public void canDeletePrecedingSucceedingTitle() {
IndividualResource instanceResource = createInstance("Title One");
JsonArray identifiers = new JsonArray();
identifiers.add(identifier(UUID_ISBN, "9781473619777"));
PrecedingSucceedingTitle precedingSucceedingTitle = new PrecedingSucceedingTitle(null, instanceResource.getId().toString(), TITLE, HRID, identifiers);
IndividualResource response = precedingSucceedingTitleClient.create(precedingSucceedingTitle.getJson());
precedingSucceedingTitleClient.delete(response.getId());
Response getResponse = precedingSucceedingTitleClient.getById(response.getId());
assertThat(getResponse.getStatusCode(), is(HttpURLConnection.HTTP_NOT_FOUND));
}
Aggregations