use of org.folio.rest.support.builders.LoanRequestBuilder in project mod-circulation-storage by folio-org.
the class LoansAnonymizationApiTest method shouldOnlyAnonymizeClosedLoansHistoryWhenBothArePresent.
@Test
public void shouldOnlyAnonymizeClosedLoansHistoryWhenBothArePresent() throws MalformedURLException, ExecutionException, InterruptedException, TimeoutException {
final UUID userId = UUID.randomUUID();
final LoanRequestBuilder loanForUser = new LoanRequestBuilder().withUserId(userId);
loansClient.create(loanForUser.closed().withItemId(UUID.randomUUID()).withId(UUID.randomUUID())).getId();
loansClient.create(loanForUser.closed().withItemId(UUID.randomUUID()).withId(UUID.randomUUID())).getId();
final String firstOpenLoanId = loansClient.create(loanForUser.open().withItemId(UUID.randomUUID()).withId(UUID.randomUUID())).getId();
final String secondOpenLoanId = loansClient.create(loanForUser.open().withItemId(UUID.randomUUID()).withId(UUID.randomUUID())).getId();
loansClient.create(loanForUser.closed().withItemId(UUID.randomUUID()).withId(UUID.randomUUID())).getId();
anonymizeLoansFor(userId);
hasLoanHistoryForUser(userId, firstOpenLoanId, secondOpenLoanId);
}
Aggregations