Skip to content

Commit

Permalink
[MODINVSTOR-1243] Attempt increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Saba-Zedginidze-EPAM committed Aug 26, 2024
1 parent 65f277a commit bb39dc5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class TenantItems extends AbstractInventoryResource {

private static final Logger log = LogManager.getLogger(MethodHandles.lookup().lookupClass());

public static final String TENANT_ITEMS_PATH = "/inventory/tenant-items";
private static final String TENANT_ITEMS_PATH = "/inventory/tenant-items";
public static final String ITEMS_FIELD = "items";
public static final String TOTAL_RECORDS_FIELD = "totalRecords";

Expand Down
3 changes: 1 addition & 2 deletions src/test/java/api/items/TenantItemApiTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.assertj.core.api.Assertions.assertThat;
import static org.folio.inventory.resources.TenantItems.ITEMS_FIELD;
import static org.folio.inventory.resources.TenantItems.TENANT_ITEMS_PATH;
import static org.folio.inventory.resources.TenantItems.TOTAL_RECORDS_FIELD;
import static org.folio.inventory.support.ItemUtil.ID;

Expand Down Expand Up @@ -52,7 +51,7 @@ public void testTenantItemsGetFromDifferentTenants() throws MalformedURLExceptio
CONSORTIA_TENANT_ID, consortiumItem.getString(ID),
COLLEGE_TENANT_ID, collegeItem.getString(ID)
));
var response = okapiClient.post(TENANT_ITEMS_PATH, JsonObject.mapFrom(tenantItemPariCollection))
var response = okapiClient.post(ApiRoot.tenantItems(), JsonObject.mapFrom(tenantItemPariCollection))
.toCompletableFuture().get(5, TimeUnit.SECONDS);
assertThat(response.getStatusCode()).isEqualTo(200);
var items = extractItems(response, 2);
Expand Down
6 changes: 6 additions & 0 deletions src/test/java/api/support/ApiRoot.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ public static URL items(String query)
return new URL(String.format("%s/items?%s", inventory(), query));
}

public static URL tenantItems()
throws MalformedURLException {

return new URL(String.format("%s/tenant-items", inventory()));
}

public static String isbn() {
return String.format("%s/isbn", ApiTestSuite.apiRoot());
}
Expand Down
9 changes: 9 additions & 0 deletions src/test/java/support/fakes/FakeOkapi.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public void start(Promise<Void> startFuture) {
registerFakeHoldingStorageModule(router);
registerFakeAuthorityStorageModule(router);
registerFakeItemsStorageModule(router);
registerFakeTenantItemsStorageModule(router);
registerFakeMaterialTypesModule(router);
registerFakeLoanTypesModule(router);
registerFakeLocationsModule(router);
Expand Down Expand Up @@ -171,6 +172,14 @@ private void registerFakeItemsStorageModule(Router router) {
.create().register(router);
}

private void registerFakeTenantItemsStorageModule(Router router) {
new FakeStorageModuleBuilder()
.withRecordName("tenantItem")
.withRootPath("/inventory/tenant-items")
.withCollectionPropertyName("items")
.create().register(router);
}

private void registerFakeMaterialTypesModule(Router router) {

new FakeStorageModuleBuilder()
Expand Down

0 comments on commit bb39dc5

Please sign in to comment.