BookmarksResource extends Resource { public CallSpec<List<Bookmark>, HttpError> getListOfOwnBookmarks() { return Resource.<List<Bookmark>, HttpError>newGetSpec(api, "/v1/users/me/bookmarks") .responseAs(list(Bookmark.class, "bookmarks", "items")) .build(); } BookmarksResource(XingApi api); CallSpec<List<Bookmark>, HttpError> getListOfOwnBookmarks(); CallSpec<Void, HttpError> createOwnBookmark(String userId); CallSpec<Void, HttpError> deleteOwnBookmark(String userId);  }
@Test public void getListOfOwnBookmarks() throws Exception { server.enqueue(new MockResponse().setBody("{\n" + " \"bookmarks\": {\n" + " \"total\": 2,\n" + " \"items\": [\n" + " {\n" + " \"created_at\": \"2011-05-25T10:26:10Z\",\n" + " \"user\": {\n" + " \"id\": \"2432425_bf123c\",\n" + " \"display_name\": \"John Doe\"\n" + " }\n" + " },\n" + " {\n" + " \"created_at\": \"2011-05-25T10:25:34Z\",\n" + " \"user\": {\n" + " \"id\": \"24324123_bf123d\",\n" + " \"display_name\": \"Harry Potter\"\n" + " }\n" + " }\n" + " ]\n" + " }\n" + '}')); Response<List<Bookmark>, HttpError> response = resource.getListOfOwnBookmarks().execute(); assertThat(response.body().size()).isEqualTo(2); assertThat(response.body().get(1).user().id()).isEqualTo("24324123_bf123d"); }