use of com.auth0.json.mgmt.users.UsersPage in project auth0-java by auth0.
the class UsersEntityTest method shouldListUsersWithFields.
@Test
public void shouldListUsersWithFields() throws Exception {
UserFilter filter = new UserFilter().withFields("some,random,fields", true);
Request<UsersPage> request = api.users().list(filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_USERS_LIST, 200);
UsersPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/users"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("fields", "some,random,fields"));
assertThat(recordedRequest, hasQueryParameter("include_fields", "true"));
assertThat(response, is(notNullValue()));
assertThat(response.getItems(), hasSize(2));
}
Aggregations