Search in sources :

Example 46 with LoanRequestBuilder

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);
}
Also used : LoanRequestBuilder(org.folio.rest.support.builders.LoanRequestBuilder) UUIDMatchers.isUUID(org.folio.rest.support.matchers.UUIDMatchers.isUUID) UUID(java.util.UUID) Test(org.junit.Test)

Aggregations

LoanRequestBuilder (org.folio.rest.support.builders.LoanRequestBuilder)46 Test (org.junit.Test)44 UUID (java.util.UUID)39 JsonObject (io.vertx.core.json.JsonObject)34 DateTime (org.joda.time.DateTime)18 IndividualResource (org.folio.rest.support.IndividualResource)17 JsonResponse (org.folio.rest.support.JsonResponse)16 CompletableFuture (java.util.concurrent.CompletableFuture)9 UUIDMatchers.isUUID (org.folio.rest.support.matchers.UUIDMatchers.isUUID)8 Matchers.containsString (org.hamcrest.Matchers.containsString)6 JsonArray (io.vertx.core.json.JsonArray)5 TextResponse (org.folio.rest.support.TextResponse)5 TRUE (java.lang.Boolean.TRUE)4 HttpURLConnection (java.net.HttpURLConnection)4 MalformedURLException (java.net.MalformedURLException)4 DateFormat (java.text.DateFormat)4 SimpleDateFormat (java.text.SimpleDateFormat)4 Date (java.util.Date)4 List (java.util.List)4 TimeZone (java.util.TimeZone)4