Search in sources :

Example 1 with LocationBuilder

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));
}
Also used : ItemBuilder(api.support.builders.ItemBuilder) LocationBuilder(api.support.builders.LocationBuilder) JsonObject(io.vertx.core.json.JsonObject)

Example 2 with LocationBuilder

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));
}
Also used : ItemBuilder(api.support.builders.ItemBuilder) LocationBuilder(api.support.builders.LocationBuilder) JsonObject(io.vertx.core.json.JsonObject) UUID(java.util.UUID) CheckInByBarcodeRequest(org.folio.circulation.domain.representations.CheckInByBarcodeRequest) Test(org.junit.jupiter.api.Test)

Example 3 with LocationBuilder

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));
}
Also used : ItemBuilder(api.support.builders.ItemBuilder) LocationBuilder(api.support.builders.LocationBuilder) JsonObject(io.vertx.core.json.JsonObject) UUID(java.util.UUID) CheckInByBarcodeRequest(org.folio.circulation.domain.representations.CheckInByBarcodeRequest) Test(org.junit.jupiter.api.Test)

Example 4 with LocationBuilder

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));
}
Also used : ItemBuilder(api.support.builders.ItemBuilder) LocationBuilder(api.support.builders.LocationBuilder) JsonObject(io.vertx.core.json.JsonObject) UUID(java.util.UUID) CheckInByBarcodeRequest(org.folio.circulation.domain.representations.CheckInByBarcodeRequest) Test(org.junit.jupiter.api.Test)

Example 5 with LocationBuilder

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));
}
Also used : ItemBuilder(api.support.builders.ItemBuilder) LocationBuilder(api.support.builders.LocationBuilder) JsonObject(io.vertx.core.json.JsonObject) CheckInByBarcodeRequest(org.folio.circulation.domain.representations.CheckInByBarcodeRequest) Test(org.junit.jupiter.api.Test)

Aggregations

LocationBuilder (api.support.builders.LocationBuilder)7 JsonObject (io.vertx.core.json.JsonObject)7 ItemBuilder (api.support.builders.ItemBuilder)6 CheckInByBarcodeRequest (org.folio.circulation.domain.representations.CheckInByBarcodeRequest)5 Test (org.junit.jupiter.api.Test)5 UUID (java.util.UUID)4