BitcointoyouAdapters { public static List<Balance> adaptBitcointoyouBalances(BitcointoyouBalance bitcointoyouBalances) { List<Balance> balances = new ArrayList<>(); if (bitcointoyouBalances != null && bitcointoyouBalances.getoReturn() != null && bitcointoyouBalances.getoReturn().size() > 0) { Map<String, BigDecimal> balancesMap = bitcointoyouBalances.getoReturn().get(0); for (Map.Entry<String, BigDecimal> balance : balancesMap.entrySet()) { Currency currency = Currency.getInstance(balance.getKey()); balances.add(new Balance(currency, balance.getValue())); } } return balances; } private  BitcointoyouAdapters(); static Ticker adaptBitcointoyouTicker(
      BitcointoyouTicker bitcointoyouTicker, CurrencyPair currencyPair); static OrderBook adaptBitcointoyouOrderBook(
      BitcointoyouOrderBook depth, CurrencyPair currencyPair); static Trades adaptBitcointoyouPublicTrades(
      BitcointoyouPublicTrade[] bitcointoyouPublicTrades, CurrencyPair currencyPair); static List<Balance> adaptBitcointoyouBalances(BitcointoyouBalance bitcointoyouBalances); static OpenOrders adaptBitcointoyouOpenOrders(
      BitcointoyouOrderResponse bitcointoyouOpenOrders); static Collection<Order> adaptBitcointoyouOrderToOrdersCollection(
      BitcointoyouOrderResponse bitcointoyouOrderResponse);  }
@Test public void testBalancesAdapter() throws Exception { final SoftAssertions softly = new SoftAssertions(); List<Balance> balances = BitcointoyouAdapters.adaptBitcointoyouBalances(bitcointoyouBalance); softly.assertThat(balances).isNotNull(); softly.assertThat(balances.size()).isEqualTo(5); softly .assertThat(balances) .contains( new Balance(Currency.BRL, new BigDecimal("8657.531311027634275")), new Balance(Currency.BTC, new BigDecimal("35.460074025529646")), new Balance(Currency.LTC, new BigDecimal("9.840918628667236")), new Balance(Currency.DOGE, new BigDecimal("5419.490003406479187")), new Balance(Currency.DRK, new BigDecimal("0.121461143982142"))); softly.assertAll(); }