CryptopiaAdapters { public static Trades adaptTrades(List<CryptopiaMarketHistory> cryptopiaMarketHistory) { List<Trade> trades = new ArrayList<>(); long lastTradeTimestamp = 0; for (CryptopiaMarketHistory marketHistory : cryptopiaMarketHistory) { final long tradeTimestamp = marketHistory.getTimestamp(); if (tradeTimestamp > lastTradeTimestamp) { lastTradeTimestamp = tradeTimestamp; } trades.add(adaptTrade(marketHistory)); } return new Trades(trades, lastTradeTimestamp, Trades.TradeSortType.SortByTimestamp); } private  CryptopiaAdapters(); static Date convertTimestamp(String timestamp); static OrderBook adaptOrderBook(
      CryptopiaOrderBook cryptopiaOrderBook, CurrencyPair currencyPair); static Ticker adaptTicker(CryptopiaTicker cryptopiaTicker, CurrencyPair currencyPair); static Trades adaptTrades(List<CryptopiaMarketHistory> cryptopiaMarketHistory); static ExchangeMetaData adaptToExchangeMetaData(
      List<CryptopiaCurrency> cryptopiaCurrencies, List<CryptopiaTradePair> tradePairs);  }
@Test public void testTradesAdapter() throws IOException { InputStream is = CryptopiaAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/cryptopia/dto/marketdata/example-trades.json"); ObjectMapper mapper = new ObjectMapper(); CryptopiaBaseResponse<List<CryptopiaMarketHistory>> cryptopiaMarketHistory = mapper.readValue(is, CryptopiaBaseResponseCryptopiaMarketHistory.class); is.close(); assertThat(cryptopiaMarketHistory).isNotNull(); Trades trades = CryptopiaAdapters.adaptTrades(cryptopiaMarketHistory.getData()); assertThat(trades).isNotNull(); assertThat(trades.getlastID()).isEqualTo(1501995183); assertThat(trades.getTradeSortType()).isEqualTo(Trades.TradeSortType.SortByTimestamp); assertThat(trades.getTrades().size()).isGreaterThan(1); }