use of api.support.builders.LoanHistoryConfigurationBuilder in project mod-circulation by folio-org.
the class AnonymizeLoansAfterXIntervalTests method testOpenLoansWithFeesAndFinesNotAnonymizedAfterIntervalNotPassed.
/**
* Scenario 2
*
* Given:
* An Anonymize closed loans setting of "X interval after loan closes"
* An Anonymize closed loans with associated fees/fines setting of
* "Immediately"
* An open loan with an associated fee/fine
* When X interval has elapsed after the loan closed
* Then do not anonymize the loan
*/
@Test
void testOpenLoansWithFeesAndFinesNotAnonymizedAfterIntervalNotPassed() {
LoanHistoryConfigurationBuilder loanHistoryConfig = new LoanHistoryConfigurationBuilder().loanCloseAnonymizeAfterXInterval(1, "minute").feeFineCloseAnonymizeImmediately();
createConfiguration(loanHistoryConfig);
IndividualResource loanResource = checkOutFixture.checkOutByBarcode(new CheckOutByBarcodeRequestBuilder().forItem(item1).to(user).at(servicePoint.getId()));
UUID loanID = loanResource.getId();
createClosedAccountWithFeeFines(loanResource, getZonedDateTime().minusMinutes(1));
assertThat(loanResource.getJson(), isOpen());
mockClockManagerToReturnFixedDateTime(getZonedDateTime().plus(ONE_MINUTE_AND_ONE_MILLIS, ChronoUnit.MILLIS));
anonymizeLoansInTenant();
assertThat(loansStorageClient.getById(loanID).getJson(), not(isAnonymized()));
}
use of api.support.builders.LoanHistoryConfigurationBuilder in project mod-circulation by folio-org.
the class AnonymizeLoansAfterXIntervalTests method testClosedLoansWithClosedFeesAndFinesAnonymizedAfterFeeFineCloseIntervalPassed.
/**
* Scenario 6
*
* Given:
* An Anonymize closed loans setting of "X interval after loan closes"
* An Anonymize closed loans with associated fees/fines setting of
* "X interval after fee/fine closes"
* A closed loan with an associated fee/fine
* When all fees/fines associated with the loan are closed, and X
* interval after the fee/fine closes has passed
* Then anonymize the loan
*/
@Test
void testClosedLoansWithClosedFeesAndFinesAnonymizedAfterFeeFineCloseIntervalPassed() {
LoanHistoryConfigurationBuilder loanHistoryConfig = new LoanHistoryConfigurationBuilder().loanCloseAnonymizeAfterXInterval(1, "minute").feeFineCloseAnonymizeAfterXInterval(20, "minute");
createConfiguration(loanHistoryConfig);
IndividualResource loanResource = checkOutFixture.checkOutByBarcode(new CheckOutByBarcodeRequestBuilder().forItem(item1).to(user).at(servicePoint.getId()));
UUID loanID = loanResource.getId();
createClosedAccountWithFeeFines(loanResource, getZonedDateTime());
createClosedAccountWithFeeFines(loanResource, getZonedDateTime());
checkInFixture.checkInByBarcode(item1);
mockClockManagerToReturnFixedDateTime(getZonedDateTime().plus(20 * ONE_MINUTE_AND_ONE_MILLIS, ChronoUnit.MILLIS));
anonymizeLoansInTenant();
assertThat(loansStorageClient.getById(loanID).getJson(), isAnonymized());
assertThatPublishedAnonymizeLoanLogRecordEventsAreValid(loansClient.getById(loanID).getJson());
}
use of api.support.builders.LoanHistoryConfigurationBuilder in project mod-circulation by folio-org.
the class AnonymizeLoansAfterXIntervalTests method testNeverAnonymizeClosedLoansWithAssociatedFeeFines.
/**
* Scenario 7
*
* Given:
* An Anonymize closed loans setting of "X interval after loan closes"
* An Anonymize closed loans with associated fees/fines setting of
* "Never"
* An open loan with an associated fee/fine
* When the item in the loan is checked in
* Then do not anonymize the loan
*/
@Test
void testNeverAnonymizeClosedLoansWithAssociatedFeeFines() {
LoanHistoryConfigurationBuilder loanHistoryConfig = new LoanHistoryConfigurationBuilder().loanCloseAnonymizeAfterXInterval(1, "minute").feeFineCloseAnonymizeNever();
createConfiguration(loanHistoryConfig);
IndividualResource loanResource = checkOutFixture.checkOutByBarcode(new CheckOutByBarcodeRequestBuilder().forItem(item1).to(user).at(servicePoint.getId()));
UUID loanID = loanResource.getId();
createClosedAccountWithFeeFines(loanResource, getZonedDateTime());
checkInFixture.checkInByBarcode(item1);
anonymizeLoansInTenant();
assertThat(loansStorageClient.getById(loanID).getJson(), not(isAnonymized()));
}
use of api.support.builders.LoanHistoryConfigurationBuilder in project mod-circulation by folio-org.
the class AnonymizeLoansAfterXIntervalTests method testOpenLoansWithFeesAndFinesNotAnonymizedAfterFeeFineCloseIntervalNotPassed.
/**
* Scenario 4
*
* Given:
* An Anonymize closed loans setting of "X interval after loan closes"
* An Anonymize closed loans with associated fees/fines setting of
* "X interval after fee/fine closes"
* An open loan with an associated fee/fine
* When the item in the loan is checked in
* Then do not anonymize the loan
*/
@Test
void testOpenLoansWithFeesAndFinesNotAnonymizedAfterFeeFineCloseIntervalNotPassed() {
LoanHistoryConfigurationBuilder loanHistoryConfig = new LoanHistoryConfigurationBuilder().loanCloseAnonymizeAfterXInterval(1, "minute").feeFineCloseAnonymizeAfterXInterval(20, "minutes");
createConfiguration(loanHistoryConfig);
IndividualResource loanResource = checkOutFixture.checkOutByBarcode(new CheckOutByBarcodeRequestBuilder().forItem(item1).to(user).at(servicePoint.getId()));
UUID loanID = loanResource.getId();
createClosedAccountWithFeeFines(loanResource, getZonedDateTime());
checkInFixture.checkInByBarcode(item1);
anonymizeLoansInTenant();
assertThat(loansStorageClient.getById(loanID).getJson(), not(isAnonymized()));
}
use of api.support.builders.LoanHistoryConfigurationBuilder in project mod-circulation by folio-org.
the class AnonymizeLoansAfterXIntervalTests method testNeverAnonymizeClosedLoansWithAssociatedFeeFinesAfterAfterIntervalPassed.
/**
* Scenario 8
*
* Given:
* An Anonymize closed loans setting of "X interval after loan closes"
* An Anonymize closed loans with associated fees/fines setting of
* "Never"
* An open loan with an associated fee/fine
* When X interval has elapsed after the loan closed
* Then do not anonymize the loan
*/
@Test
void testNeverAnonymizeClosedLoansWithAssociatedFeeFinesAfterAfterIntervalPassed() {
LoanHistoryConfigurationBuilder loanHistoryConfig = new LoanHistoryConfigurationBuilder().loanCloseAnonymizeAfterXInterval(1, "minute").feeFineCloseAnonymizeNever();
createConfiguration(loanHistoryConfig);
IndividualResource loanResource = checkOutFixture.checkOutByBarcode(new CheckOutByBarcodeRequestBuilder().forItem(item1).to(user).at(servicePoint.getId()));
UUID loanID = loanResource.getId();
createClosedAccountWithFeeFines(loanResource, getZonedDateTime());
checkInFixture.checkInByBarcode(item1);
mockClockManagerToReturnFixedDateTime(getZonedDateTime().plus(ONE_MINUTE_AND_ONE_MILLIS, ChronoUnit.MILLIS));
anonymizeLoansInTenant();
assertThat(loansStorageClient.getById(loanID).getJson(), not(isAnonymized()));
}
Aggregations