use of com.auth0.json.mgmt.organizations.OrganizationsPage in project auth0-java by auth0.
the class UsersEntityTest method shouldGetUserOrganizationsWithTotals.
@Test
public void shouldGetUserOrganizationsWithTotals() throws Exception {
Request<OrganizationsPage> request = api.users().getOrganizations("1", new PageFilter().withTotals(true));
assertThat(request, is(notNullValue()));
server.jsonResponse(ORGANIZATIONS_PAGED_LIST, 200);
OrganizationsPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/users/1/organizations"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("include_totals", "true"));
assertThat(response, is(notNullValue()));
assertThat(response.getItems(), hasSize(2));
assertThat(response.getStart(), is(0));
assertThat(response.getTotal(), is(2));
assertThat(response.getLimit(), is(20));
}
Aggregations