private void companyRequestSample() { final Company company = iexTradingClient.executeRequest(new CompanyRequestBuilder() .withSymbol("AAPL") .build()); System.out.println(company); }
@Test public void shouldSuccessfullyCreateRequest() { final String symbol = "IBM"; final RestRequest<Company> request = new CompanyRequestBuilder() .withSymbol(symbol) .build(); assertThat(request.getMethodType()).isEqualTo(MethodType.GET); assertThat(request.getPath()).isEqualTo("/stock/{symbol}/company"); assertThat(request.getResponseType()).isEqualTo(new GenericType<Company>() {}); assertThat(request.getPathParams()).containsExactly(entry("symbol", symbol)); assertThat(request.getQueryParams()).isEmpty(); }
@Test public void companyAcceptanceTest() { final Company company = iexTradingClient.executeRequest(new CompanyRequestBuilder() .withSymbol("AAPL") .build()); }
@Test public void companyServiceTest() { stubFor(get(urlEqualTo("/stock/aapl/company")) .withHeader("Accept", equalTo("application/json")) .willReturn(aResponse() .withStatus(200) .withHeader("Accept", "application/json") .withHeader("Content-Type", "application/json") .withBodyFile("rest/stock/CompanyResponse.json"))); final Company company = iexTradingClient.executeRequest(new CompanyRequestBuilder() .withSymbol("aapl") .build()); assertThat(company.getSymbol()).isEqualTo("AAPL"); assertThat(company.getCompanyName()).isEqualTo("Apple Inc."); assertThat(company.getExchange()).isEqualTo("Nasdaq Global Select"); assertThat(company.getIndustry()).isEqualTo("Computer Hardware"); assertThat(company.getWebsite()).isEqualTo("http://www.apple.com"); assertThat(company.getDescription()).isEqualTo("Apple Inc is designs, manufactures and markets mobile communication and media devices and personal computers, and sells a variety of related software, services, accessories, networking solutions and third-party digital content and applications."); assertThat(company.getCEO()).isEqualTo("Timothy D. Cook"); assertThat(company.getIssueType()).isEqualTo("cs"); assertThat(company.getSector()).isEqualTo("Technology"); assertThat(company.getTags()).containsExactly("Technology", "Consumer Electronics", "Computer Hardware"); }