BTCMarketsMarketDataService extends BTCMarketsMarketDataServiceRaw implements MarketDataService { @Override public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args) throws IOException { return BTCMarketsAdapters.adaptOrderBook(getBTCMarketsOrderBook(currencyPair), currencyPair); } BTCMarketsMarketDataService(Exchange exchange); @Override Ticker getTicker(CurrencyPair currencyPair, Object... args); @Override OrderBook getOrderBook(CurrencyPair currencyPair, Object... args);  }
@Test public void shouldGetOrderBook() throws IOException { final LimitOrder[] expectedAsks = expectedAsks(); final LimitOrder[] expectedBids = expectedBids(); BTCMarketsOrderBook orderBookMock = parse("org/knowm/xchange/btcmarkets/dto/" + "ShortOrderBook", BTCMarketsOrderBook.class); PowerMockito.when(btcmarkets.getOrderBook("BTC", "AUD")).thenReturn(orderBookMock); OrderBook orderBook = marketDataService.getOrderBook(CurrencyPair.BTC_AUD); assertThat(orderBook.getTimeStamp().getTime()).isEqualTo(1442997827000L); List<LimitOrder> asks = orderBook.getAsks(); assertThat(asks).hasSize(3); for (int i = 0; i < asks.size(); i++) { BtcMarketsAssert.assertEquals(asks.get(i), expectedAsks[i]); } List<LimitOrder> bids = orderBook.getBids(); assertThat(bids).hasSize(2); for (int i = 0; i < bids.size(); i++) { BtcMarketsAssert.assertEquals(bids.get(i), expectedBids[i]); } }