CompanyTemplate extends AbstractTemplate implements CompanyOperations { public Company getCompany(int id) { return restOperations.getForObject(COMPANY_URL, Company.class, "/" + id, ""); } CompanyTemplate(RestOperations RestOperations, ObjectMapper objectMapper); Company getCompany(int id); Company getCompanyByUniversalName(String name); List<Company> getCompaniesByEmailDomain(String domain); Companies search(String keywords); List<Company> getFollowing(); List<Company> getSuggestionsToFollow(); void startFollowingCompany(int id); void stopFollowingCompany(int id); Products getProducts(int companyId, int start, int count); static final String BASE_URL; static final String COMPANY_FIELDS; static final String COMPANY_URL; static final String COMPANY_SEARCH_URL; static final String COMPANY_FOLLOW_URL; static final String COMPANY_FOLLOW_START_STOP_URL; static final String COMPANY_SUGGESTIONS_TO_FOLLOW; static final String PRODUCT_FIELDS; static final String PRODUCTS_URL; }
@Test @Ignore("Ignoring to get a quick snapshot build out...fix later") public void getCompany() { mockServer.expect(requestTo(CompanyTemplate.COMPANY_URL.replaceFirst("\\{id\\}", "/1337").replaceFirst("\\{filter\\}", "") + "&oauth2_access_token=ACCESS_TOKEN")).andExpect(method(GET)) .andRespond(withSuccess(new ClassPathResource("company.json", getClass()), MediaType.APPLICATION_JSON)); Company company = linkedIn.companyOperations().getCompany(1337); assertEquals(1337, company.getId()); assertEquals("https: assertEquals("C", company.getCompanyType().getCode()); assertEquals("Public Company", company.getCompanyType().getName()); assertEquals("LinkedIn takes your professional network online, giving you access to people, jobs and opportunities like never before. Built upon trusted connections and relationships, LinkedIn has established the world\u2019s largest and most powerful professional network. Currently, more than 135 million professionals are on LinkedIn, including executives from all five hundred of the Fortune 500 companies, as well as a wide range of household names in technology, financial services, media, consumer packaged goods, entertainment, and numerous other industries. The company is publicly held and has a diversified business model with revenues coming from user subscriptions, advertising sales and hiring solutions.", company.getDescription()); assertEquals(1, company.getEmailDomains().size()); assertEquals("linkedin.com", company.getEmailDomains().get(0)); assertEquals("G", company.getEmployeeCountRange().getCode()); assertEquals("1001-5000", company.getEmployeeCountRange().getName()); assertEquals(2003, company.getFoundedYear()); assertEquals("Internet", company.getIndustry()); assertEquals(5, company.getLocations().size()); assertEquals("Mountain View", company.getLocations().get(0).getAddress().getCity()); assertEquals("94043", company.getLocations().get(0).getAddress().getPostalCode()); assertEquals("2029 Stierlin Court", company.getLocations().get(0).getAddress().getStreet1()); assertEquals("(402) 452-2320", company.getLocations().get(1).getContactInfo().getPhone1()); assertEquals("https: assertEquals("LinkedIn", company.getName()); assertEquals(90110, company.getNumFollowers()); assertEquals(8, company.getSpecialties().size()); assertEquals("Online Professional Network", company.getSpecialties().get(0)); assertEquals("https: assertEquals("OPR", company.getStatus().getCode()); assertEquals("Operating", company.getStatus().getName()); assertEquals("NYS", company.getStockExchange().getCode()); assertEquals("New York Stock Exchange", company.getStockExchange().getName()); assertEquals("LNKD", company.getTicker()); assertEquals("linkedin", company.getTwitterId()); assertEquals("linkedin", company.getUniversalName()); assertEquals("https: }