use of api.support.builders.CheckInByBarcodeRequestBuilder in project mod-circulation by folio-org.
the class CheckInFixture method checkInByBarcode.
public void checkInByBarcode(IndividualResource item, ZonedDateTime checkInDate, UUID servicePointId, OkapiHeaders okapiHeaders) {
final JsonObject representation = new CheckInByBarcodeRequestBuilder().forItem(item).on(checkInDate).at(servicePointId).create();
restAssuredClient.post(representation, checkInByBarcodeUrl(), 200, okapiHeaders);
}
use of api.support.builders.CheckInByBarcodeRequestBuilder in project mod-circulation by folio-org.
the class JsonSchemaValidationTest method validationFailsWhenRequiredPropertyMissing.
@Test
void validationFailsWhenRequiredPropertyMissing() throws IOException {
final JsonSchemaValidator validator = JsonSchemaValidator.fromResource("/check-in-by-barcode-request.json");
final JsonObject checkInRequest = new CheckInByBarcodeRequestBuilder().withItemBarcode("246650492").on(ClockUtil.getZonedDateTime()).atNoServicePoint().create();
final Result<String> result = validator.validate(checkInRequest.encode());
assertThat(result.succeeded(), is(false));
assertThat(result.cause(), isErrorWith(allOf(hasMessage("#: required key [servicePointId] not found"), hasParameter(null, null))));
}
use of api.support.builders.CheckInByBarcodeRequestBuilder in project mod-circulation by folio-org.
the class JsonSchemaValidationTest method validationSucceedWithCompleteExample.
@Test
void validationSucceedWithCompleteExample() throws IOException {
final JsonSchemaValidator validator = JsonSchemaValidator.fromResource("/check-in-by-barcode-request.json");
final JsonObject checkInRequest = new CheckInByBarcodeRequestBuilder().withItemBarcode("246650492").on(ClockUtil.getZonedDateTime()).at(UUID.randomUUID()).create();
assertThat(validator.validate(checkInRequest.encode()), succeeded());
}
use of api.support.builders.CheckInByBarcodeRequestBuilder in project mod-circulation by folio-org.
the class JsonSchemaValidationTest method validationFailsForMultipleReasons.
@Test
void validationFailsForMultipleReasons() throws IOException {
final JsonSchemaValidator validator = JsonSchemaValidator.fromResource("/check-in-by-barcode-request.json");
final JsonObject checkInRequest = new CheckInByBarcodeRequestBuilder().withItemBarcode("246650492").on(ClockUtil.getZonedDateTime()).atNoServicePoint().create();
checkInRequest.put("unexpectedProperty", "foo");
final Result<String> result = validator.validate(checkInRequest.encode());
assertThat(result.succeeded(), is(false));
assertThat(result.cause(), isErrorWith(allOf(hasMessage("#: extraneous key [unexpectedProperty] is not permitted"), hasParameter(null, null))));
assertThat(result.cause(), isErrorWith(allOf(hasMessage("#: required key [servicePointId] not found"), hasParameter(null, null))));
}
use of api.support.builders.CheckInByBarcodeRequestBuilder in project mod-circulation by folio-org.
the class ItemsInTransitReportTests method reportIncludesItemInTransit.
@Test
void reportIncludesItemInTransit() {
final ItemResource smallAngryPlanet = createSmallAngryPlanet();
final IndividualResource steve = usersFixture.steve();
final UUID firstServicePointId = servicePointsFixture.cd1().getId();
final UUID secondServicePointId = servicePointsFixture.cd2().getId();
final ZonedDateTime checkInDate = ZonedDateTime.of(2019, 8, 13, 5, 0, 0, 0, UTC);
final ZonedDateTime requestDate = ZonedDateTime.of(2019, 7, 5, 10, 0, 0, 0, UTC);
final LocalDate requestExpirationDate = LocalDate.of(2019, 7, 11);
checkOutFixture.checkOutByBarcode(smallAngryPlanet);
createRequest(smallAngryPlanet, steve, secondServicePointId, requestDate, requestExpirationDate);
mockClockManagerToReturnFixedDateTime(checkInDate);
checkInFixture.checkInByBarcode(new CheckInByBarcodeRequestBuilder().forItem(smallAngryPlanet).on(checkInDate).at(firstServicePointId));
List<JsonObject> items = ResourceClient.forItemsInTransitReport().getAll();
assertThat(items.size(), is(1));
JsonObject itemJson = items.get(0);
verifyItem(itemJson, smallAngryPlanet, secondServicePointId);
verifyLocation(itemJson);
verifyRequestWithSecondPickupServicePoint(itemJson, requestDate, requestExpirationDate);
verifyLoanInFirstServicePoint(itemJson, checkInDate);
verifyLastCheckIn(itemJson, checkInDate, SERVICE_POINT_NAME_1);
}
Aggregations