UserProfilesResource extends Resource { public CallSpec<XingUser, HttpError> getUserById(String id) { return Resource.<XingUser, HttpError>newGetSpec(api, "/v1/users/{id}") .pathParam("id", id) .responseAs(first(XingUser.class, "users")) .build(); } UserProfilesResource(XingApi api); CallSpec<List<XingUser>, HttpError> getUsersById(List<String> ids); CallSpec<XingUser, HttpError> getUserById(String id); CallSpec<XingUser, HttpError> getOwnProfile(); CallSpec<XingUser, HttpError> getOwnIdCard(); CallSpec<List<XingUser>, HttpError> findUsersByEmail(List<String> emails); @Experimental CallSpec<List<XingUser>, HttpError> findUsersByKeyword(String keywords); CallSpec<ProfileMessage, HttpError> getUserProfileMessage(String userId); CallSpec<ProfileMessage, HttpError> getOwnProfileMessage(); CallSpec<String, HttpError> getUserLegalInformation(String userId); CallSpec<String, HttpError> getOwnLegalInformation();  }
@Test public void getUserById() throws Exception { server.enqueue(new MockResponse().setBody("{\n" + " \"users\": [\n" + " \n" + userJson + ", " + userJson + " ]\n" + '}')); Response<XingUser, HttpError> response = resource.getUserById("some_id").execute(); assertThat(response.body().id()).isEqualTo("123456_abcdef"); }