UserProfilesResource extends Resource { public CallSpec<String, HttpError> getUserLegalInformation(String userId) { return Resource.<String, HttpError>newGetSpec(api, "/v1/users/{user_id}/legal_information") .pathParam("user_id", userId) .responseAs(single(String.class, "legal_information", "content")) .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 getUserLegalInformation() throws Exception { MockResponse mockResponse = new MockResponse().setBody("{\n" + " \"legal_information\": {\n" + " \"content\": \"Hello there.\"\n" + " }\n" + '}'); server.enqueue(mockResponse); server.enqueue(mockResponse); Response<String, HttpError> response1 = resource.getUserLegalInformation("test").execute(); assertThat(response1.body()).isEqualTo("Hello there."); Response<String, HttpError> response2 = resource.getOwnLegalInformation().execute(); assertThat(response2.body()).isEqualTo("Hello there."); }