UserProfilesResource extends Resource { public CallSpec<ProfileMessage, HttpError> getUserProfileMessage(String userId) { return Resource.<ProfileMessage, HttpError>newGetSpec(api, "/v1/{user_id}/profile_message") .pathParam("user_id", userId) .responseAs(single(ProfileMessage.class, "profile_message")) .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 getUserProfileMessage() throws Exception { MockResponse mockResponse = new MockResponse().setBody("{\n" + " \"profile_message\": {\n" + " \"updated_at\": \"2011-07-18T11:40:19Z\",\n" + " \"message\": \"My new profile message.\"\n" + " }\n" + '}'); server.enqueue(mockResponse); server.enqueue(mockResponse); Response<ProfileMessage, HttpError> response1 = resource.getUserProfileMessage("test").execute(); SafeCalendar safeCalendar = new SafeCalendar(2011, 6, 18, 11, 40, 19); safeCalendar.setTimeZone(TimeZone.getTimeZone("UTC")); assertThat(response1.body().updatedAt()).isEqualTo(safeCalendar); assertThat(response1.body().message()).isEqualTo("My new profile message."); Response<ProfileMessage, HttpError> response2 = resource.getOwnProfileMessage().execute(); assertThat(response2.body().updatedAt()).isEqualTo(safeCalendar); assertThat(response2.body().message()).isEqualTo("My new profile message."); }