CoinjarAdapters { public static UserTrade adaptOrderToUserTrade(CoinjarOrder order) { return new UserTrade.Builder() .id(order.oid.toString()) .orderId(order.oid.toString()) .currencyPair(productToCurrencyPair(order.productId)) .type(buySellToOrderType(order.orderSide)) .price(new BigDecimal(order.price)) .originalAmount(new BigDecimal(order.size)) .timestamp(Date.from(ZonedDateTime.parse(order.timestamp).toInstant())) .build(); } private  CoinjarAdapters(); static String currencyPairToProduct(CurrencyPair pair); static CurrencyPair productToCurrencyPair(String product); static String orderTypeToBuySell(Order.OrderType orderType); static Order.OrderType buySellToOrderType(String buySell); static Order.OrderStatus adaptStatus(String status); static Ticker adaptTicker(CoinjarTicker ticker, CurrencyPair currencyPair); static LimitOrder adaptOrderToLimitOrder(CoinjarOrder coinjarOrder); static UserTrade adaptOrderToUserTrade(CoinjarOrder order); static OrderBook adaptOrderbook(CoinjarOrderBook orderBook, CurrencyPair currencyPair); static UserTrade adaptFillToUserTrade(CoinjarFill coinjarFill);  }
@Test public void testAdaptOrderToUserTrade() { final CoinjarOrder order = new CoinjarOrder( 3267L, "LMT", "BTCAUD", "buy", "6203.00000000", "0.04000000", "GTC", "0.04000000", "filled", null, "2017-10-12T15:39:27.000+11:00"); final UserTrade expected = new UserTrade.Builder() .id("3267") .orderId("3267") .currencyPair(CurrencyPair.BTC_AUD) .originalAmount(new BigDecimal("0.04000000")) .timestamp(Date.from(ZonedDateTime.parse("2017-10-12T15:39:27.000+11:00").toInstant())) .price(new BigDecimal("6203.00000000")) .build(); assertThat(CoinjarAdapters.adaptOrderToUserTrade(order)).isEqualTo(expected); }