use of com.treasuredata.client.model.TDUser in project td-client-java by treasure-data.
the class TestTDClient method listUsers.
@Test
public void listUsers() throws Exception {
TDUserList userList = client.listUsers();
for (TDUser user : userList.getUsers()) {
logger.trace("user: {}", user);
}
logger.trace("{} user(s)", userList.getUsers().size());
}
use of com.treasuredata.client.model.TDUser in project td-client-java by treasure-data.
the class TestTDClient method getUser.
@Test
public void getUser() throws Exception {
TDUser user = client.getUser();
logger.trace("user: {}", user);
}
use of com.treasuredata.client.model.TDUser in project td-client-java by treasure-data.
the class TestTDClient method getUserMocked.
@Test
public void getUserMocked() throws Exception {
client = mockClient();
String expectedUserJson = "{\"id\":300,\"first_name\":\"Freda\",\"last_name\":\"Schuster\",\"email\":\"1elvie.hackett@example.com\",\"phone\":\"(650) 469-3644\",\"gravatar_url\":\"https://secure.gravatar.com/avatar/0e36aa63098c5a05b4dde8ac867eb116?size=80\",\"administrator\":true,\"created_at\":\"2016-06-09T01:34:59Z\",\"updated_at\":\"2016-06-09T01:34:59Z\",\"name\":\"Freda Schuster\",\"account_owner\":true}";
TDUser expectedUser = ObjectMappers.compactMapper().readValue(expectedUserJson, TDUser.class);
server.enqueue(new MockResponse().setBody(expectedUserJson));
TDUser user = client.getUser();
assertThat(user, is(expectedUser));
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest.getPath(), is("/v3/user/show"));
}
Aggregations