use of api.support.builders.LocationBuilder in project mod-circulation by folio-org.
the class OverdueFineServiceTest method createItem.
private Item createItem() {
JsonObject item = new ItemBuilder().withId(ITEM_ID).withBarcode(BARCODE).withMaterialType(ITEM_MATERIAL_TYPE_ID).create();
item.put("effectiveCallNumberComponents", new JsonObject().put("callNumber", CALL_NUMBER));
final var contributors = List.of(new Contributor("Contributor 1", false), new Contributor("Contributor 2", false));
return Item.from(item).withLocation(Location.from(new LocationBuilder().withName(LOCATION_NAME).withPrimaryServicePoint(SERVICE_POINT_ID).create())).withInstance(new Instance(UUID.randomUUID().toString(), TITLE, emptyList(), contributors, emptyList(), emptyList())).withMaterialType(new MaterialType(null, ITEM_MATERIAL_TYPE_NAME, null));
}
use of api.support.builders.LocationBuilder in project mod-circulation by folio-org.
the class LoanCheckInServiceTest method isInHouseUseWhenNonPrimaryServicePointServesHomeLocation.
@Test
void isInHouseUseWhenNonPrimaryServicePointServesHomeLocation() {
final UUID checkInServicePoint = UUID.randomUUID();
JsonObject itemRepresentation = new ItemBuilder().available().create();
JsonObject locationRepresentation = new LocationBuilder().withPrimaryServicePoint(UUID.randomUUID()).servedBy(checkInServicePoint).create();
CheckInByBarcodeRequest checkInRequest = getCheckInRequest(checkInServicePoint);
Item item = Item.from(itemRepresentation).withLocation(Location.from(locationRepresentation));
assertTrue(loanCheckInService.isInHouseUse(item, createEmptyQueue(), checkInRequest));
}
use of api.support.builders.LocationBuilder in project mod-circulation by folio-org.
the class LoanCheckInServiceTest method isNotInHouseUseWhenItemIsUnavailable.
@Test
void isNotInHouseUseWhenItemIsUnavailable() {
final UUID checkInServicePoint = UUID.randomUUID();
JsonObject itemRepresentation = new ItemBuilder().checkOut().create();
JsonObject locationRepresentation = new LocationBuilder().withPrimaryServicePoint(checkInServicePoint).create();
CheckInByBarcodeRequest checkInRequest = getCheckInRequest(checkInServicePoint);
Item item = Item.from(itemRepresentation).withLocation(Location.from(locationRepresentation));
assertFalse(loanCheckInService.isInHouseUse(item, createEmptyQueue(), checkInRequest));
}
use of api.support.builders.LocationBuilder in project mod-circulation by folio-org.
the class LoanCheckInServiceTest method isInHouseUseWhenServicePointIsPrimaryForHomeLocation.
@Test
void isInHouseUseWhenServicePointIsPrimaryForHomeLocation() {
final UUID checkInServicePoint = UUID.randomUUID();
JsonObject itemRepresentation = new ItemBuilder().available().create();
JsonObject locationRepresentation = new LocationBuilder().withPrimaryServicePoint(checkInServicePoint).create();
CheckInByBarcodeRequest checkInRequest = getCheckInRequest(checkInServicePoint);
Item item = Item.from(itemRepresentation).withLocation(Location.from(locationRepresentation));
assertTrue(loanCheckInService.isInHouseUse(item, createEmptyQueue(), checkInRequest));
}
use of api.support.builders.LocationBuilder in project mod-circulation by folio-org.
the class LoanCheckInServiceTest method isNotInHouseUseWhenServicePointDoesNotServeHomeLocation.
@Test
void isNotInHouseUseWhenServicePointDoesNotServeHomeLocation() {
JsonObject itemRepresentation = new ItemBuilder().available().create();
JsonObject locationRepresentation = new LocationBuilder().withPrimaryServicePoint(UUID.randomUUID()).servedBy(UUID.randomUUID()).create();
CheckInByBarcodeRequest checkInRequest = getCheckInRequest(UUID.randomUUID());
Item item = Item.from(itemRepresentation).withLocation(Location.from(locationRepresentation));
assertFalse(loanCheckInService.isInHouseUse(item, createEmptyQueue(), checkInRequest));
}
Aggregations