use of api.support.builders.RequestBuilder in project mod-circulation by folio-org.
the class RegularRenewalTest method cannotRenewWhenHoldRequestedAndFixedPolicyHasAlternativeRenewPeriod.
@Test
void cannotRenewWhenHoldRequestedAndFixedPolicyHasAlternativeRenewPeriod() {
final var request = new RequestBuilder().hold().asDomainObject();
final var loanPolicy = new LoanPolicyBuilder().fixed(UUID.randomUUID()).withHolds(null, true, days(1)).asDomainObject();
CirculationErrorHandler errorHandler = new OverridingErrorHandler(null);
renew(loanPolicy, request, errorHandler);
assertTrue(matchErrorReason(errorHandler, ALTERNATIVE_RENEWAL_PERIOD_FOR_HOLDS_IS_SPECIFIED));
}
use of api.support.builders.RequestBuilder in project mod-circulation by folio-org.
the class RegularRenewalTest method cannotRenewWhenHoldRequestedAndFixedPolicyHasRenewPeriod.
@Test
void cannotRenewWhenHoldRequestedAndFixedPolicyHasRenewPeriod() {
final var request = new RequestBuilder().hold().asDomainObject();
final var loanPolicy = new LoanPolicyBuilder().fixed(UUID.randomUUID()).renewWith(days(10)).withHolds(null, true, null).asDomainObject();
CirculationErrorHandler errorHandler = new OverridingErrorHandler(null);
renew(loanPolicy, request, errorHandler);
assertTrue(matchErrorReason(errorHandler, POLICY_HAS_FIXED_PROFILE_BUT_RENEWAL_PERIOD_IS_SPECIFIED));
}
use of api.support.builders.RequestBuilder in project mod-circulation by folio-org.
the class RegularRenewalTest method cannotRenewWhenHoldRequestIsNotRenewable.
@Test
void cannotRenewWhenHoldRequestIsNotRenewable() {
final var request = new RequestBuilder().hold().asDomainObject();
final var loanPolicy = new LoanPolicyBuilder().withHolds(null, false, null).asDomainObject();
CirculationErrorHandler errorHandler = new OverridingErrorHandler(null);
renew(loanPolicy, request, errorHandler);
assertTrue(matchErrorReason(errorHandler, ITEMS_CANNOT_BE_RENEWED_ACTIVE_PENDING_HOLD_REQUEST));
}
use of api.support.builders.RequestBuilder in project mod-circulation by folio-org.
the class JsonSchemaValidationTest method canValidateSchemaWithReferences.
@Test
void canValidateSchemaWithReferences() throws IOException {
final JsonSchemaValidator validator = JsonSchemaValidator.fromResource("/request.json");
final JsonObject request = new RequestBuilder().hold().itemRequestLevel().withItemId(UUID.randomUUID()).withInstanceId(UUID.randomUUID()).withRequesterId(UUID.randomUUID()).fulfilToHoldShelf(UUID.randomUUID()).withRequestDate(ClockUtil.getZonedDateTime()).create();
assertThat(validator.validate(request.encode()), succeeded());
}
use of api.support.builders.RequestBuilder in project mod-circulation by folio-org.
the class CheckOutByBarcodeTests method titleLevelRequestIsIgnoredWhenTlrFeatureIsNotEnabled.
@ParameterizedTest
@EnumSource(value = TlrFeatureStatus.class, names = { "DISABLED", "NOT_CONFIGURED" })
void titleLevelRequestIsIgnoredWhenTlrFeatureIsNotEnabled(TlrFeatureStatus tlrFeatureStatus) {
configurationsFixture.enableTlrFeature();
ItemResource item = itemsFixture.basedUponNod();
UserResource borrower = usersFixture.steve();
UserResource requester = usersFixture.james();
requestsClient.create(new RequestBuilder().page().titleRequestLevel().withNoItemId().withNoHoldingsRecordId().withInstanceId(item.getInstanceId()).withPickupServicePointId(servicePointsFixture.cd1().getId()).withRequesterId(requester.getId()));
reconfigureTlrFeature(tlrFeatureStatus);
checkOutFixture.checkOutByBarcode(item, borrower);
}
Aggregations