ProfileTemplate extends AbstractTemplate implements ProfileOperations { public LinkedInProfiles search(SearchParameters parameters) { JsonNode node = restOperations.getForObject(expand(PEOPLE_SEARCH_URL, parameters), JsonNode.class); try { return objectMapper.reader(LinkedInProfiles.class).readValue(node.path("people")); } catch (Exception e) { throw new RuntimeException(e); } } ProfileTemplate(RestOperations restOperations, ObjectMapper objectMapper); String getProfileId(); String getProfileUrl(); LinkedInProfile getUserProfile(); LinkedInProfileFull getUserProfileFull(); LinkedInProfile getProfileById(String id); LinkedInProfile getProfileByPublicUrl(String url); LinkedInProfileFull getProfileFullById(String id); LinkedInProfileFull getProfileFullByPublicUrl(String url); LinkedInProfiles search(SearchParameters parameters);  }
@Test public void search() { mockServer.expect(requestTo( "https: + "&oauth2_access_token=ACCESS_TOKEN" )).andExpect(method(GET)) .andRespond(withSuccess(new ClassPathResource("search.json", getClass()), MediaType.APPLICATION_JSON)); SearchParameters parameters = new SearchParameters(); parameters.setCountryCode("ie"); parameters.setKeywords("Java J2EE"); LinkedInProfiles result = linkedIn.profileOperations().search(parameters); assertEquals(0, result.getStart()); assertEquals(10, result.getCount()); assertEquals(110, result.getTotal()); assertEquals(10, result.getPeople().size()); assertProfile(result.getPeople().get(0), "YeagNX-lsX", "IT Consultant at Harvey Nash PLC", "Michelle", "Daly", "Staffing and Recruiting", null); }
@Test public void searchFacet() { mockServer.expect(requestTo( "https: + "&oauth2_access_token=ACCESS_TOKEN" )).andExpect(method(GET)) .andRespond(withSuccess(new ClassPathResource("search.json", getClass()), MediaType.APPLICATION_JSON)); SearchParameters parameters = new SearchParameters(); parameters.setCountryCode("nl"); parameters.setKeywords("Java J2EE"); parameters.addFacet(SearchParameters.FacetType.LANGUAGE, SearchParameters.LANGUAGE_ENGLISH); parameters.addFacet(SearchParameters.FacetType.LANGUAGE, SearchParameters.LANGUAGE_GERMAN); parameters.addFacet(SearchParameters.FacetType.NETWORK, SearchParameters.NETWORK_FIRST_DEGREE); LinkedInProfiles result = linkedIn.profileOperations().search(parameters); assertEquals(0, result.getStart()); assertEquals(10, result.getCount()); assertEquals(110, result.getTotal()); assertEquals(10, result.getPeople().size()); assertProfile(result.getPeople().get(0), "YeagNX-lsX", "IT Consultant at Harvey Nash PLC", "Michelle", "Daly", "Staffing and Recruiting", null); }