UserProfilesResource extends Resource { public CallSpec<List<XingUser>, HttpError> findUsersByEmail(List<String> emails) { return Resource.<List<XingUser>, HttpError>newGetSpec(api, "/v1/users/find_by_emails") .responseAs(list(single(XingUser.class, "user"), "results", "items")) .queryParam("emails", emails) .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 findUsersByEmail() throws Exception { server.enqueue(new MockResponse().setBody("{\n" + " \"results\": {\n" + " \"items\": [\n" + " {\n" + " \"email\": \"existing_user@xing.com\",\n" + " \"hash\": null,\n" + " \"user\": {\n" + " \"id\": \"10368_ddec16\"\n" + " }\n" + " },\n" + " {\n" + " \"email\": \"unknown_user@xing.com\",\n" + " \"hash\": null,\n" + " \"user\": null\n" + " }\n" + " ],\n" + " \"total\": 2\n" + " }\n" + '}')); Response<List<XingUser>, HttpError> response = resource .findUsersByEmail(Collections.singletonList("mail")).execute(); assertThat(response.body().size()).isEqualTo(2); assertThat(response.body().get(0).id()).isEqualTo("10368_ddec16"); assertThat(response.body().get(1)).isNull(); }