From 71f68c3a418952bf1c7a11b9f3cd8111822bc632 Mon Sep 17 00:00:00 2001 From: Janis Saldabols Date: Mon, 23 Sep 2024 16:27:59 +0300 Subject: [PATCH] CIRC-2141 Add test for itemLocationCode --- .../org/folio/rest/api/RequestsApiTest.java | 3 +++ .../builders/RequestRequestBuilder.java | 21 ++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/folio/rest/api/RequestsApiTest.java b/src/test/java/org/folio/rest/api/RequestsApiTest.java index 14521c857..4137de0d2 100644 --- a/src/test/java/org/folio/rest/api/RequestsApiTest.java +++ b/src/test/java/org/folio/rest/api/RequestsApiTest.java @@ -158,6 +158,7 @@ public void canCreateARequest(String requestLevel) throws InterruptedException, .withPosition(1) .withPickupServicePointId(pickupServicePointId) .withTags(new Tags().withTagList(asList("new", "important"))) + .withItemLocationCode("CN/P1") .create(), requestStorageUrl()) .getJson(); @@ -228,6 +229,8 @@ public void canCreateARequest(String requestLevel) throws InterruptedException, assertThat(tagsRepresentation.containsKey("tagList"), is(true)); assertThat(tagsRepresentation.getJsonArray("tagList"), contains("new", "important")); + assertThat(representation.getString("itemLocationCode"), is("CN/P1")); + assertCreateEventForRequest(representation); } diff --git a/src/test/java/org/folio/rest/support/builders/RequestRequestBuilder.java b/src/test/java/org/folio/rest/support/builders/RequestRequestBuilder.java index ccb8f60c6..a6c86ee54 100644 --- a/src/test/java/org/folio/rest/support/builders/RequestRequestBuilder.java +++ b/src/test/java/org/folio/rest/support/builders/RequestRequestBuilder.java @@ -52,6 +52,7 @@ public class RequestRequestBuilder extends JsonBuilder { private final String patronComments; private final UUID holdingsRecordId; private final SearchIndex searchIndex; + private final String itemLocationCode; public RequestRequestBuilder() { this(UUID.randomUUID(), @@ -79,6 +80,7 @@ public RequestRequestBuilder() { null, null, UUID.randomUUID(), + null, null); } @@ -162,6 +164,10 @@ public JsonObject create() { put(request, "searchIndex", JsonObject.mapFrom(searchIndex)); } + if (itemLocationCode != null) { + put(request, "itemLocationCode", this.itemLocationCode); + } + return request; } @@ -204,7 +210,8 @@ public RequestRequestBuilder withNoId() { this.tags, this.patronComments, this.holdingsRecordId, - this.searchIndex); + this.searchIndex, + this.itemLocationCode); } public RequestRequestBuilder toHoldShelf() { @@ -247,7 +254,8 @@ public RequestRequestBuilder withItem(RequestItemSummary item) { this.tags, this.patronComments, this.holdingsRecordId, - this.searchIndex); + this.searchIndex, + this.itemLocationCode); } public RequestRequestBuilder withRequester( @@ -282,7 +290,8 @@ public RequestRequestBuilder withRequester( this.tags, this.patronComments, this.holdingsRecordId, - this.searchIndex); + this.searchIndex, + this.itemLocationCode); } public RequestRequestBuilder withRequester( @@ -316,7 +325,8 @@ public RequestRequestBuilder withRequester( this.tags, this.patronComments, this.holdingsRecordId, - this.searchIndex); + this.searchIndex, + this.itemLocationCode); } public RequestRequestBuilder withProxy( @@ -350,7 +360,8 @@ public RequestRequestBuilder withProxy( this.tags, this.patronComments, this.holdingsRecordId, - this.searchIndex); + this.searchIndex, + this.itemLocationCode); } public RequestRequestBuilder withNoPosition() { return withPosition(null);