RecommendationsResource extends Resource { public CallSpec<List<XingUser>, HttpError> getOwnRecommendations() { return Resource.<List<XingUser>, HttpError>newGetSpec(api, "/v1/users/me/network/recommendations") .responseAs(list(single(XingUser.class, "user"), "user_recommendations", "recommendations")) .build(); } RecommendationsResource(XingApi api); CallSpec<List<XingUser>, HttpError> getOwnRecommendations(); CallSpec<List<XingUser>, HttpError> getRecommendations(String userId); CallSpec<Void, HttpError> blockRecommendation(String userId);  }
@Test public void getOwnRecommendations() throws Exception { server.enqueue(new MockResponse().setBody("{\n" + " \"user_recommendations\": {\n" + " \"total\": 2,\n" + " \"recommendations\": [\n" + " {\n" + " \"user\": {\n" + " \"id\": \"123123_abcdef\",\n" + " \"display_name\": \"Marianne Musterfrau\",\n" + " \"gender\": \"f\"\n" + " }\n" + " },\n" + " {\n" + " \"user\": {\n" + " \"id\": \"111111_cccccc\",\n" + " \"display_name\": \"Max Musterdude\",\n" + " \"gender\": \"m\"\n" + " }\n" + " }\n" + " ]\n" + " }\n" + '}')); Response<List<XingUser>, HttpError> response = resource.getOwnRecommendations().execute(); assertThat(response.isSuccessful()).isTrue(); assertThat(response.body()).containsExactly( new XingUser("123123_abcdef") .displayName("Marianne Musterfrau") .gender(Gender.FEMALE), new XingUser("111111_cccccc") .displayName("Max Musterdude") .gender(Gender.MALE) ); }