Search in sources :

Example 41 with HoldingRequestBuilder

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

the class HoldingsApiExamples method canUpdateAnExistingMARCHoldingsIfNoChanges.

@Test
public void canUpdateAnExistingMARCHoldingsIfNoChanges() throws Exception {
    UUID instanceId = instancesClient.create(InstanceRequestExamples.smallAngryPlanet()).getId();
    JsonObject newHoldings = holdingsStorageClient.create(new HoldingRequestBuilder().forInstance(instanceId).withMarcSource()).getJson();
    JsonObject holdingsForUpdate = newHoldings.copy();
    Response putResponse = updateHoldings(holdingsForUpdate);
    assertThat(putResponse.getStatusCode(), is(NO_CONTENT.code()));
    Response getResponse = holdingsStorageClient.getById(getId(newHoldings));
    assertThat(getResponse.getStatusCode(), is(OK.code()));
    JsonObject updatedHoldings = getResponse.getJson();
    newHoldings.stream().forEach(e -> assertEquals(updatedHoldings.getMap().get(e.getKey()), e.getValue()));
}
Also used : Response(org.folio.inventory.support.http.client.Response) HoldingRequestBuilder(api.support.builders.HoldingRequestBuilder) JsonObject(io.vertx.core.json.JsonObject) UUID(java.util.UUID) Test(org.junit.Test)

Aggregations

HoldingRequestBuilder (api.support.builders.HoldingRequestBuilder)41 Test (org.junit.Test)30 JsonObject (io.vertx.core.json.JsonObject)28 IndividualResource (org.folio.inventory.support.http.client.IndividualResource)25 UUID (java.util.UUID)24 Response (org.folio.inventory.support.http.client.Response)19 ItemRequestBuilder (api.support.builders.ItemRequestBuilder)15 Before (org.junit.Before)9 URL (java.net.URL)4 DateTime (org.joda.time.DateTime)4 Ignore (org.junit.Ignore)3 JsonArray (io.vertx.core.json.JsonArray)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)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 ApiTestSuite.getReadingRoomLocation (api.ApiTestSuite.getReadingRoomLocation)1 ApiTestSuite.getThirdFloorLocation (api.ApiTestSuite.getThirdFloorLocation)1