use of api.support.builders.DeclareClaimedReturnedItemAsMissingRequestBuilder in project mod-circulation by folio-org.
the class DeclareClaimedReturnedItemAsMissingApiTests method cannotDeclareItemMissingWhenLoanIsNotFound.
@Test
void cannotDeclareItemMissingWhenLoanIsNotFound() {
final String notExistentLoanId = UUID.randomUUID().toString();
final Response response = claimItemReturnedFixture.attemptDeclareClaimedReturnedItemAsMissing(new DeclareClaimedReturnedItemAsMissingRequestBuilder().forLoan(notExistentLoanId).withComment(TESTING_COMMENT));
assertThat(response.getStatusCode(), is(404));
}
use of api.support.builders.DeclareClaimedReturnedItemAsMissingRequestBuilder in project mod-circulation by folio-org.
the class DeclareClaimedReturnedItemAsMissingApiTests method cannotDeclareItemMissingWhenCommentIsNotProvided.
@Test
void cannotDeclareItemMissingWhenCommentIsNotProvided() {
final Response response = claimItemReturnedFixture.attemptDeclareClaimedReturnedItemAsMissing(new DeclareClaimedReturnedItemAsMissingRequestBuilder().forLoan(loanId));
assertThat(response.getStatusCode(), is(422));
assertThat(response.getJson(), hasErrorWith(hasMessage("Comment is a required field")));
assertThat(response.getJson(), hasErrorWith(hasParameter("comment", null)));
}
use of api.support.builders.DeclareClaimedReturnedItemAsMissingRequestBuilder in project mod-circulation by folio-org.
the class DeclareClaimedReturnedItemAsMissingApiTests method cannotDeclareItemMissingWhenLoanIsClosed.
@Test
void cannotDeclareItemMissingWhenLoanIsClosed() {
checkInFixture.checkInByBarcode(item);
final Response response = claimItemReturnedFixture.attemptDeclareClaimedReturnedItemAsMissing(new DeclareClaimedReturnedItemAsMissingRequestBuilder().forLoan(loanId).withComment(TESTING_COMMENT));
assertThat(response.getStatusCode(), is(422));
assertThat(response.getJson(), hasErrorWith(allOf(hasMessage("Loan is closed"), hasParameter("loanId", loanId))));
}
use of api.support.builders.DeclareClaimedReturnedItemAsMissingRequestBuilder in project mod-circulation by folio-org.
the class DeclareClaimedReturnedItemAsMissingApiTests method canDeclareItemMissingWhenClaimedReturned.
@Test
void canDeclareItemMissingWhenClaimedReturned() {
claimItemReturnedFixture.claimItemReturned(new ClaimItemReturnedRequestBuilder().forLoan(loanId).withItemClaimedReturnedDate(getZonedDateTime()));
claimItemReturnedFixture.declareClaimedReturnedItemAsMissing(new DeclareClaimedReturnedItemAsMissingRequestBuilder().forLoan(loanId).withComment(TESTING_COMMENT));
assertLoanIsClosed(TESTING_COMMENT);
assertItemIsMissing();
assertNoteHasBeenCreated();
var loan = loansClient.getById(UUID.fromString(loanId)).getJson();
assertThatPublishedLoanLogRecordEventsAreValid(loan);
}
use of api.support.builders.DeclareClaimedReturnedItemAsMissingRequestBuilder in project mod-circulation by folio-org.
the class DeclareClaimedReturnedItemAsMissingApiTests method cannotDeclareItemMissingWhenIsNotClaimedReturned.
@Test
void cannotDeclareItemMissingWhenIsNotClaimedReturned() {
final Response response = claimItemReturnedFixture.attemptDeclareClaimedReturnedItemAsMissing(new DeclareClaimedReturnedItemAsMissingRequestBuilder().forLoan(loanId).withComment(TESTING_COMMENT));
assertThat(response.getStatusCode(), is(422));
assertThat(response.getJson(), hasErrorWith(allOf(hasMessage("Item is not Claimed returned"), hasParameter("itemId", item.getId().toString()))));
}
Aggregations