Search in sources :

Example 96 with ItemRequestBuilder

use of api.support.builders.ItemRequestBuilder in project mod-inventory by folio-org.

the class BoundWithTests method boundWithTitlesArePresentInBoundWithItem.

@Test
public void boundWithTitlesArePresentInBoundWithItem() throws InterruptedException, MalformedURLException, TimeoutException, ExecutionException {
    IndividualResource instance1 = instancesStorageClient.create(InstanceSamples.smallAngryPlanet(UUID.randomUUID()));
    IndividualResource holdings1a = holdingsStorageClient.create(new HoldingRequestBuilder().forInstance(instance1.getId()).permanentlyInMainLibrary().withCallNumber("HOLDINGS 1A"));
    IndividualResource item1a = itemsClient.create(new ItemRequestBuilder().forHolding(holdings1a.getId()).withBarcode("ITEM 1A"));
    IndividualResource instance2 = instancesStorageClient.create(InstanceSamples.girlOnTheTrain(UUID.randomUUID()));
    IndividualResource holdings2a = holdingsStorageClient.create(new HoldingRequestBuilder().forInstance(instance2.getId()).permanentlyInMainLibrary().withCallNumber("HOLDINGS 2A"));
    IndividualResource instance3 = instancesStorageClient.create(InstanceSamples.leviathanWakes(UUID.randomUUID()));
    IndividualResource holdings3a = holdingsStorageClient.create(new HoldingRequestBuilder().forInstance(instance3.getId()).permanentlyInMainLibrary().withCallNumber("HOLDINGS 3A"));
    boundWithPartsStorageClient.create(makeObjectBoundWithPart(item1a.getJson().getString("id"), holdings1a.getJson().getString("id")));
    boundWithPartsStorageClient.create(makeObjectBoundWithPart(item1a.getJson().getString("id"), holdings2a.getJson().getString("id")));
    boundWithPartsStorageClient.create(makeObjectBoundWithPart(item1a.getJson().getString("id"), holdings3a.getJson().getString("id")));
    Response itemResponse = okapiClient.get(ApiTestSuite.apiRoot() + "/inventory/items/" + item1a.getId()).toCompletableFuture().get(5, SECONDS);
    assertThat("Item has boundWithTitles array with three titles", itemResponse.getJson().getJsonArray("boundWithTitles").size(), is(3));
}
Also used : Response(org.folio.inventory.support.http.client.Response) HoldingRequestBuilder(api.support.builders.HoldingRequestBuilder) IndividualResource(org.folio.inventory.support.http.client.IndividualResource) ItemRequestBuilder(api.support.builders.ItemRequestBuilder) Test(org.junit.Test)

Aggregations

ItemRequestBuilder (api.support.builders.ItemRequestBuilder)96 Test (org.junit.Test)96 IndividualResource (org.folio.inventory.support.http.client.IndividualResource)83 Response (org.folio.inventory.support.http.client.Response)41 JsonObject (io.vertx.core.json.JsonObject)40 UUID (java.util.UUID)38 Parameters (junitparams.Parameters)29 HoldingRequestBuilder (api.support.builders.HoldingRequestBuilder)15 JsonArray (io.vertx.core.json.JsonArray)10 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)6 ItemsMoveRequestBuilder (api.support.builders.ItemsMoveRequestBuilder)5 DateTime (org.joda.time.DateTime)5 URL (java.net.URL)4 List (java.util.List)3 Date (java.util.Date)2 ApiTestSuite (api.ApiTestSuite)1 USER_ID (api.ApiTestSuite.USER_ID)1 ApiTestSuite.getCanCirculateLoanType (api.ApiTestSuite.getCanCirculateLoanType)1 ApiTestSuite.getDvdMaterialType (api.ApiTestSuite.getDvdMaterialType)1 ApiTestSuite.getMainLibraryLocation (api.ApiTestSuite.getMainLibraryLocation)1