Skip to content

Commit

Permalink
CIRC-2141 Add test for itemLocationCode
Browse files Browse the repository at this point in the history
  • Loading branch information
JanisSaldabols committed Sep 23, 2024
1 parent 621ca03 commit 73559d2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/test/java/org/folio/rest/api/RequestsApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -79,6 +80,7 @@ public RequestRequestBuilder() {
null,
null,
UUID.randomUUID(),
null,
null);
}

Expand Down Expand Up @@ -162,6 +164,10 @@ public JsonObject create() {
put(request, "searchIndex", JsonObject.mapFrom(searchIndex));
}

if (itemLocationCode != null) {
put(request, "itemLocationCode", this.itemLocationCode);
}

return request;
}

Expand Down Expand Up @@ -204,7 +210,8 @@ public RequestRequestBuilder withNoId() {
this.tags,
this.patronComments,
this.holdingsRecordId,
this.searchIndex);
this.searchIndex,
this.itemLocationCode);
}

public RequestRequestBuilder toHoldShelf() {
Expand Down Expand Up @@ -247,7 +254,8 @@ public RequestRequestBuilder withItem(RequestItemSummary item) {
this.tags,
this.patronComments,
this.holdingsRecordId,
this.searchIndex);
this.searchIndex,
this.itemLocationCode);
}

public RequestRequestBuilder withRequester(
Expand Down Expand Up @@ -282,7 +290,8 @@ public RequestRequestBuilder withRequester(
this.tags,
this.patronComments,
this.holdingsRecordId,
this.searchIndex);
this.searchIndex,
this.itemLocationCode);
}

public RequestRequestBuilder withRequester(
Expand Down Expand Up @@ -316,7 +325,8 @@ public RequestRequestBuilder withRequester(
this.tags,
this.patronComments,
this.holdingsRecordId,
this.searchIndex);
this.searchIndex,
this.itemLocationCode);
}

public RequestRequestBuilder withProxy(
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 73559d2

Please sign in to comment.