diff --git a/src/test/java/api/loans/CheckOutByBarcodeTests.java b/src/test/java/api/loans/CheckOutByBarcodeTests.java index 7637a1d664..74549cec35 100644 --- a/src/test/java/api/loans/CheckOutByBarcodeTests.java +++ b/src/test/java/api/loans/CheckOutByBarcodeTests.java @@ -960,6 +960,38 @@ void canCheckOutOnOrderItemWithRequest() { assertThat(checkedOutSmallAngryPlanet, hasItemStatus(CHECKED_OUT)); } + @Test + void canCheckOutAnDcbItem() { + IndividualResource instance = instancesFixture.basedUponDunkirk(); + IndividualResource holdings = holdingsFixture.defaultWithHoldings(instance.getId()); + IndividualResource locationsResource = locationsFixture.mainFloor(); + var barcode = "100002222"; + IndividualResource circulationItem = circulationItemsFixture.createCirculationItem(barcode, holdings.getId(), locationsResource.getId()); + final IndividualResource jessica = usersFixture.jessica(); + final IndividualResource response = checkOutFixture.checkOutByBarcode( + new CheckOutByBarcodeRequestBuilder() + .forItem(circulationItem) + .to(jessica) + .at(servicePointsFixture.cd1())); + + final JsonObject loan = response.getJson(); + + assertThat(loan.getString("id"), is(notNullValue())); + + assertThat("user ID should match barcode", + loan.getString("userId"), is(jessica.getId())); + + assertThat("item ID should match barcode", + loan.getString("itemId"), is(circulationItem.getId())); + + assertThat("status should be open", + loan.getJsonObject("status").getString("name"), is("Open")); + + circulationItem = circulationItemsClient.get(circulationItem); + + assertThat(circulationItem, hasItemStatus(CHECKED_OUT)); + } + @Test void canCheckOutInProcessItem() { diff --git a/src/test/java/api/support/APITests.java b/src/test/java/api/support/APITests.java index 51b2076bbb..ddc2dce289 100644 --- a/src/test/java/api/support/APITests.java +++ b/src/test/java/api/support/APITests.java @@ -123,6 +123,7 @@ public abstract class APITests { protected final ResourceClient instancesClient = ResourceClient.forInstances(); protected final ResourceClient holdingsClient = ResourceClient.forHoldings(); protected final ResourceClient itemsClient = ResourceClient.forItems(); + protected final ResourceClient circulationItemsClient = ResourceClient.forCirculationItem(); protected final ResourceClient loansClient = ResourceClient.forLoans(); protected final ResourceClient accountsClient = ResourceClient.forAccounts();