private void listRequestSample() { final List<Quote> quoteList = iexTradingClient.executeRequest(new ListRequestBuilder() .withListType(ListType.IEXVOLUME) .build()); System.out.println(quoteList); }
@Test public void shouldSuccessfullyCreateRequest() { final ListType listType = ListType.IEXVOLUME; final RestRequest<List<Quote>> request = new ListRequestBuilder() .withListType(listType) .build(); assertThat(request.getMethodType()).isEqualTo(MethodType.GET); assertThat(request.getPath()).isEqualTo("/stock/market/list/{type}"); assertThat(request.getResponseType()).isEqualTo(new GenericType<List<Quote>>() {}); assertThat(request.getPathParams()).containsExactly(entry("type", "iexvolume")); assertThat(request.getQueryParams()).isEmpty(); }
@Test public void listAcceptanceTest() { final List<Quote> quoteList = iexTradingClient.executeRequest(new ListRequestBuilder() .withListType(ListType.IEXVOLUME) .build()); }
@Test public void iexVolumeListServiceTest() { stubFor(get(urlEqualTo("/stock/market/list/iexvolume")) .withHeader("Accept", equalTo("application/json")) .willReturn(aResponse() .withStatus(200) .withHeader("Accept", "application/json") .withHeader("Content-Type", "application/json") .withBodyFile("rest/stock/ListResponse.json"))); final List<Quote> quoteList = iexTradingClient.executeRequest(new ListRequestBuilder() .withListType(ListType.IEXVOLUME) .build()); assertQuote(quoteList.get(0)); }
@Test public void gainersListServiceTest() { stubFor(get(urlEqualTo("/stock/market/list/gainers")) .withHeader("Accept", equalTo("application/json")) .willReturn(aResponse() .withStatus(200) .withHeader("Accept", "application/json") .withHeader("Content-Type", "application/json") .withBodyFile("rest/stock/ListResponse.json"))); final List<Quote> quoteList = iexTradingClient.executeRequest(new ListRequestBuilder() .withListType(ListType.GAINERS) .build()); assertQuote(quoteList.get(0)); }
@Test public void mostActiveListServiceTest() { stubFor(get(urlEqualTo("/stock/market/list/mostactive")) .withHeader("Accept", equalTo("application/json")) .willReturn(aResponse() .withStatus(200) .withHeader("Accept", "application/json") .withHeader("Content-Type", "application/json") .withBodyFile("rest/stock/ListResponse.json"))); final List<Quote> quoteList = iexTradingClient.executeRequest(new ListRequestBuilder() .withListType(ListType.MOSTACTIVE) .build()); assertQuote(quoteList.get(0)); }
@Test public void losersListServiceTest() { stubFor(get(urlEqualTo("/stock/market/list/losers")) .withHeader("Accept", equalTo("application/json")) .willReturn(aResponse() .withStatus(200) .withHeader("Accept", "application/json") .withHeader("Content-Type", "application/json") .withBodyFile("rest/stock/ListResponse.json"))); final List<Quote> quoteList = iexTradingClient.executeRequest(new ListRequestBuilder() .withListType(ListType.LOSERS) .build()); assertQuote(quoteList.get(0)); }
@Test public void iexPercentListServiceTest() { stubFor(get(urlEqualTo("/stock/market/list/iexpercent")) .withHeader("Accept", equalTo("application/json")) .willReturn(aResponse() .withStatus(200) .withHeader("Accept", "application/json") .withHeader("Content-Type", "application/json") .withBodyFile("rest/stock/ListResponse.json"))); final List<Quote> quoteList = iexTradingClient.executeRequest(new ListRequestBuilder() .withListType(ListType.IEXPERCENT) .build()); assertQuote(quoteList.get(0)); }