JobsResource extends Resource { public CallSpec<Job, HttpError> getJobById(String jobId) { return Resource.<Job, HttpError>newGetSpec(api, "/v1/jobs/{id}") .pathParam("id", jobId) .responseAs(single(Job.class, "job")) .build(); } JobsResource(XingApi api); CallSpec<Job, HttpError> getJobById(String jobId); CallSpec<List<PartialJob>, HttpError> getJobsByCriteria(String criteria); CallSpec<List<PartialJob>, HttpError> getJobsRecommendationsForUser(String userId);  }
@Test public void getJobById() throws Exception { server.enqueue(new MockResponse().setBody(file("jobs.json"))); Response<Job, HttpError> response = resource.getJobById("some_id").execute(); assertThat(response.body().id()).isEqualTo("61723_4cae01"); assertThat(response.body().contact().jobCompany().name()).isEqualTo("Mr. Recruiter"); assertThat(response.body().contact().user().id()).isEqualTo("3456gt_35345"); assertThat(response.body().location().zipCode()).isEqualTo("20354"); }