Skip to content

Commit

Permalink
test(api): support expand in ResourceApiAssert
Browse files Browse the repository at this point in the history
  • Loading branch information
cmark committed Oct 11, 2023
1 parent 38ccbba commit 8be0b68
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static com.b2international.snowowl.test.commons.rest.RestExtensions.givenAuthenticatedRequest;

import java.util.Collections;
import java.util.List;
import java.util.Map;

import io.restassured.response.ValidatableResponse;
Expand All @@ -34,20 +35,21 @@ public static ValidatableResponse assertResourceSearch() {

public static ValidatableResponse assertResourceSearch(final Map<String, Object> filters) {
return givenAuthenticatedRequest(RESOURCES_API)
.queryParams(filters)
.get()
.then();
.queryParams(filters)
.get()
.then();
}

public static ValidatableResponse assertResourceGet(final String resourceId) {
public static ValidatableResponse assertResourceGet(final String resourceId, final String...expand) {
return givenAuthenticatedRequest(RESOURCES_API)
.get("/{id}", resourceId)
.then();
.queryParam("expand", expand == null ? null : List.of(expand))
.get("/{id}", resourceId)
.then();
}

public static ValidatableResponse assertResourceGet(final String resourceId, final long timestamp) {
return givenAuthenticatedRequest(RESOURCES_API)
.get("/{id}@{timestamp}", resourceId, timestamp)
.then();
.get("/{id}@{timestamp}", resourceId, timestamp)
.then();
}
}

0 comments on commit 8be0b68

Please sign in to comment.