Search in sources :

Example 6 with AccountBuilder

use of api.support.builders.AccountBuilder in project mod-circulation by folio-org.

the class LoanAPITests method canGetMultipleFeesFinesForSingleLoan.

@Test
void canGetMultipleFeesFinesForSingleLoan() {
    UUID id = UUID.randomUUID();
    UUID itemId = itemsFixture.basedUponSmallAngryPlanet().getId();
    IndividualResource user = usersFixture.charlotte();
    UUID userId = user.getId();
    ZonedDateTime loanDate = ZonedDateTime.of(2017, 2, 27, 10, 23, 43, 0, UTC);
    ZonedDateTime dueDate = ZonedDateTime.of(2017, 3, 29, 10, 23, 43, 0, UTC);
    IndividualResource response = loansFixture.createLoan(new LoanBuilder().withId(id).open().withUserId(userId).withItemId(itemId).withLoanDate(loanDate).withDueDate(dueDate));
    accountsClient.create(new AccountBuilder().feeFineStatusOpen().withLoan(response).withRemainingFeeFine(150));
    JsonObject loan = loansFixture.getLoanById(id).getJson();
    assertLoanHasFeeFinesProperties(loan, 150d);
    accountsClient.create(new AccountBuilder().feeFineStatusOpen().withLoan(response).withRemainingFeeFine(150));
    loan = loansFixture.getLoanById(id).getJson();
    assertLoanHasFeeFinesProperties(loan, 300d);
}
Also used : LoanBuilder(api.support.builders.LoanBuilder) ZonedDateTime(java.time.ZonedDateTime) JsonObject(io.vertx.core.json.JsonObject) AccountBuilder(api.support.builders.AccountBuilder) UUID(java.util.UUID) IndividualResource(api.support.http.IndividualResource) Test(org.junit.jupiter.api.Test)

Aggregations

AccountBuilder (api.support.builders.AccountBuilder)6 IndividualResource (api.support.http.IndividualResource)6 FeefineActionsBuilder (api.support.builders.FeefineActionsBuilder)3 JsonObject (io.vertx.core.json.JsonObject)3 Test (org.junit.jupiter.api.Test)3 LoanBuilder (api.support.builders.LoanBuilder)2 ZonedDateTime (java.time.ZonedDateTime)2 UUID (java.util.UUID)2 MultipleJsonRecords (api.support.MultipleJsonRecords)1 ItemResource (api.support.http.ItemResource)1