JobTemplate extends AbstractTemplate implements JobOperations { public Job getJob(int id) { return restOperations.getForObject(JOB_URL, Job.class, id); } JobTemplate(RestOperations restOperations, ObjectMapper objectMapper ); Jobs searchJobs(JobSearchParameters parameters); Job getJob(int id); void bookmarkJob(int id); void unbookmarkJob(int id); Jobs getSuggestions(int start, int count); JobBookmarks getBookmarks(int start, int count); static final String BASE_URL; static final String FIELDS; static final String SEARCH_FIELDS; static final String SEARCH_URL; static final String JOB_URL; static final String BOOKMARK_URL; static final String BOOKMARKS_URL; static final String UNBOOKMARK_URL; static final String SUGGESTED_URL; }
@Test public void getJob() { mockServer.expect(requestTo(JobTemplate.JOB_URL .replaceFirst("\\{id\\}", "2160963") + "?oauth2_access_token=ACCESS_TOKEN")).andExpect(method(GET)) .andRespond(withSuccess(new ClassPathResource("job.json", getClass()), MediaType.APPLICATION_JSON)); JobSearchParameters parameters = new JobSearchParameters(); parameters.setCountryCode("ie"); parameters.setKeywords("j2ee"); Job j = linkedIn.jobOperations().getJob(2160963); assertEquals(true, j.isActive()); assertEquals(139355, j.getCompany().getId()); assertEquals("Allen Recruitment Consulting", j.getCompany().getName()); assertEquals("5404", j.getCustomerJobCode()); assertEquals(2755, j.getDescription().length()); assertEquals(400, j.getDescriptionSnippet().length()); assertLinkedInDate(j.getExpirationDate(), 2012, 2, 6); assertEquals(new Date(1328549338000l), j.getExpirationTimestamp()); assertEquals(2160963, j.getId()); assertProfile(j.getJobPoster(), "U1Gll9nr47", "Director, Allen Recruitment Consulting - Recruitment", "Louise", "Allen (Louise@AllenRec.com)",null, ""); assertEquals("Dublin", j.getLocationDescription()); assertLinkedInDate(j.getPostingDate(), 2011, 11, 8); assertEquals(new Date(1320773338000l), j.getPostingTimestamp()); assertEquals("60 - 70K or 350-400/day (EURO)", j.getSalary()); assertEquals("https: assertEquals(494, j.getSkillsAndExperience().length()); JobPosition p = j.getPosition(); assertEquals("4", p.getExperienceLevel().getCode()); assertEquals("Mid-Senior level", p.getExperienceLevel().getName()); assertEquals("4", p.getIndustries().get(0).getCode()); assertEquals("Computer Software", p.getIndustries().get(0).getName()); assertEquals("it", p.getJobFunctions().get(0).getCode()); assertEquals("Information Technology", p.getJobFunctions().get(0).getName()); assertEquals("F", p.getJobType().getCode()); assertEquals("Full-time", p.getJobType().getName()); assertEquals("ie", p.getLocation().getCountry()); assertEquals("Ireland", p.getLocation().getName()); assertEquals("Java Developer - GWT (Perm or Contract) \u2013 Dublin, Ireland", p.getTitle()); }