@Override public Resource create(XingApi api) { return new BookmarksResource(api); } };
@Test public void deleteOwnBookmark() throws Exception { testVoidSpec(resource.deleteOwnBookmark("some_di")); } }
.responseAs(list(Bookmark.class, "bookmarks", "items")) .build();
@Test public void createOwnBookmark() throws Exception { testVoidSpec(resource.createOwnBookmark("some_id")); }
@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(); // If no exception was thrown then the spec is build correctly. assertThat(response.body().size()).isEqualTo(2); assertThat(response.body().get(1).user().id()).isEqualTo("24324123_bf123d"); }