Skip to content

Commit

Permalink
[MODINVSTOR-1243] Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Saba-Zedginidze-EPAM committed Aug 26, 2024
1 parent 7b57f14 commit 56398ca
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/test/java/api/items/TenantItemApiTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public void testTenantItemsGetFromDifferentTenants() throws MalformedURLExceptio
var consortiumItem = getItems(consortiumOkapiClient, 1).get(0);
var collegeItem = getItems(collegeOkapiClient, 1).get(0);

assertThat(consortiumItem.getString(ID)).matches(consortiumItemId.toString());
assertThat(collegeItem.getString(ID)).matches(collegeItemId.toString());
assertThat(consortiumItem.getString(ID)).matches(consortiumItemId);
assertThat(collegeItem.getString(ID)).matches(collegeItemId);

var tenantItemPariCollection = constructTenantItemPairCollection(Map.of(
CONSORTIA_TENANT_ID, consortiumItem.getString(ID),
Expand All @@ -63,26 +63,28 @@ public void testTenantItemsGetFromDifferentTenants() throws MalformedURLExceptio
assertThat(items).contains(consortiumItem, collegeItem);
}

private UUID createConsortiumInstanceHoldingItem() {
private String createConsortiumInstanceHoldingItem() {
return createInstanceHoldingItem(consortiumItemsClient, consortiumHoldingsStorageClient, consortiumOkapiClient);
}

private UUID createCollegeInstanceHoldingItem() {
private String createCollegeInstanceHoldingItem() {
return createInstanceHoldingItem(collegeItemsClient, collegeHoldingsStorageClient, collegeOkapiClient);
}

private UUID createInstanceHoldingItem(ResourceClient itemStorageClient, ResourceClient holdingsStorageClient, OkapiHttpClient okapiHttpClient) {
private String createInstanceHoldingItem(ResourceClient itemsStorageClient, ResourceClient holdingsStorageClient, OkapiHttpClient okapiHttpClient) {
var instanceId = UUID.randomUUID();
InstanceApiClient.createInstance(okapiHttpClient, smallAngryPlanet(instanceId));
var holdingId = holdingsStorageClient.create(new HoldingRequestBuilder()
.forInstance(instanceId)).getId();
var itemId = UUID.randomUUID().toString();
var newItemRequest = JsonObject.of(
"id", UUID.randomUUID().toString(),
"id", itemId,
"status", new JsonObject().put("name", "Available"),
"holdingsRecordId", holdingId,
"materialTypeId", getBookMaterialType(),
"permanentLoanTypeId", getCanCirculateLoanType());
return itemsStorageClient.create(newItemRequest).getId();
itemsStorageClient.create(newItemRequest);
return itemId;
}

private List<JsonObject> getItems(OkapiHttpClient okapiHttpClient, int expected)
Expand Down

0 comments on commit 56398ca

Please sign in to comment.