use of api.support.builders.ItemBuilder in project mod-circulation by folio-org.
the class ItemsFixture method setupDeclaredLostItem.
public IndividualResource setupDeclaredLostItem() {
IndividualResource declaredLostItem = basedUponSmallAngryPlanet(ItemBuilder::declaredLost);
assertThat(declaredLostItem.getResponse().getJson().getJsonObject("status").getString("name"), is(ItemStatus.DECLARED_LOST.getValue()));
return declaredLostItem;
}
use of api.support.builders.ItemBuilder in project mod-circulation by folio-org.
the class CheckOutByBarcodeTests method canCheckOutLostAndPaidItem.
@Test
void canCheckOutLostAndPaidItem() {
final IndividualResource withdrawnItem = itemsFixture.basedUponSmallAngryPlanet(ItemBuilder::lostAndPaid);
assertThat(withdrawnItem.getJson(), isLostAndPaid());
final IndividualResource response = checkOutFixture.checkOutByBarcode(withdrawnItem, usersFixture.steve());
assertThat(response.getJson(), allOf(isOpen(), hasJsonPath("action", "checkedout"), hasJsonPath("itemId", withdrawnItem.getId().toString())));
assertThat(itemsClient.getById(withdrawnItem.getId()).getJson(), isCheckedOut());
}
use of api.support.builders.ItemBuilder in project mod-circulation by folio-org.
the class RequestScheduledNoticesTests method beforeEach.
@BeforeEach
public void beforeEach() {
ItemBuilder itemBuilder = ItemExamples.basedUponSmallAngryPlanet(materialTypesFixture.book().getId(), loanTypesFixture.canCirculate().getId());
HoldingBuilder holdingBuilder = itemsFixture.applyCallNumberHoldings("CN", "Prefix", "Suffix", Collections.singletonList("CopyNumbers"));
item = itemsFixture.basedUponSmallAngryPlanet(itemBuilder, holdingBuilder);
requester = usersFixture.steve();
pickupServicePoint = servicePointsFixture.cd1();
}
use of api.support.builders.ItemBuilder in project mod-circulation by folio-org.
the class RenewalAPITests method renewalNoticeIsNotSentWhenPatronNoticeRequestFails.
@Test
void renewalNoticeIsNotSentWhenPatronNoticeRequestFails() {
UUID renewalTemplateId = UUID.randomUUID();
JsonObject renewalNoticeConfiguration = new NoticeConfigurationBuilder().withTemplateId(renewalTemplateId).withRenewalEvent().create();
JsonObject checkInNoticeConfiguration = new NoticeConfigurationBuilder().withTemplateId(UUID.randomUUID()).withCheckInEvent().create();
NoticePolicyBuilder policyWithRenewalNotice = new NoticePolicyBuilder().withName("Policy with renewal notice").withLoanNotices(Arrays.asList(renewalNoticeConfiguration, checkInNoticeConfiguration));
LoanPolicyBuilder limitedRenewalsLoanPolicy = new LoanPolicyBuilder().withName("Limited renewals loan policy").rolling(Period.months(1)).limitedRenewals(3);
use(limitedRenewalsLoanPolicy, policyWithRenewalNotice);
ItemBuilder itemBuilder = ItemExamples.basedUponSmallAngryPlanet(materialTypesFixture.book().getId(), loanTypesFixture.canCirculate().getId(), StringUtils.EMPTY, "ItemPrefix", "ItemSuffix", "");
ItemResource smallAngryPlanet = itemsFixture.basedUponSmallAngryPlanet(itemBuilder, itemsFixture.thirdFloorHoldings());
final IndividualResource steve = usersFixture.steve();
final ZonedDateTime loanDate = ZonedDateTime.of(2018, 3, 18, 11, 43, 54, 0, UTC);
checkOutFixture.checkOutByBarcode(new CheckOutByBarcodeRequestBuilder().forItem(smallAngryPlanet).to(steve).on(loanDate).at(UUID.randomUUID()));
FakeModNotify.setFailPatronNoticesWithBadRequest(true);
loansFixture.renewLoan(smallAngryPlanet, steve);
verifyNumberOfSentNotices(0);
verifyNumberOfPublishedEvents(NOTICE, 0);
verifyNumberOfPublishedEvents(NOTICE_ERROR, 1);
}
use of api.support.builders.ItemBuilder in project mod-circulation by folio-org.
the class RequestsAPICreationTests method cannotCreateHoldRequestWhenItemIsNotCheckedOut.
@Test
void cannotCreateHoldRequestWhenItemIsNotCheckedOut() {
ItemResource item = itemsFixture.basedUponSmallAngryPlanet(ItemBuilder::available);
Response postResponse = requestsClient.attemptCreate(new RequestBuilder().hold().withInstanceId(item.getInstanceId()).withItemId(item.getId()).withPickupServicePointId(servicePointsFixture.cd1().getId()).withRequesterId(usersFixture.charlotte().getId()));
assertThat(postResponse, hasStatus(HTTP_UNPROCESSABLE_ENTITY));
assertThat(postResponse.getJson(), hasErrors(1));
assertThat(postResponse.getJson(), hasErrorWith(hasMessage("Hold requests are not allowed for this patron and item combination")));
}
Aggregations