IndependentReserveAdapters { public static Order adaptOrderDetails(IndependentReserveOrderDetailsResponse details) { if (details.getOrderType().startsWith("Market")) { return new MarketOrder( adapeOrderType(details.getOrderType()), details.getVolumeOrdered(), new CurrencyPair(details.getPrimaryCurrencyCode(), details.getSecondaryCurrencyCode()), details.getOrderGuid(), details.getCreatedTimestamp(), details.getAvgPrice(), details.getVolumeFilled(), null, adaptOrderStatus(details.getStatus())); } else if (details.getOrderType().startsWith("Limit")) { return new LimitOrder( adapeOrderType(details.getOrderType()), details.getVolumeOrdered(), new CurrencyPair(details.getPrimaryCurrencyCode(), details.getSecondaryCurrencyCode()), details.getOrderGuid(), details.getCreatedTimestamp(), details.getAvgPrice(), details.getAvgPrice(), details.getVolumeFilled(), null, adaptOrderStatus(details.getStatus())); } throw new IllegalStateException( "Unknown order type found in Independent Reserve : " + details.getOrderType()); } private  IndependentReserveAdapters(); static OrderBook adaptOrderBook(IndependentReserveOrderBook independentReserveOrderBook); static Ticker adaptTicker(
      IndependentReserveTicker independentReserveTicker, CurrencyPair currencyPair); static Wallet adaptWallet(IndependentReserveBalance independentReserveBalance); static OpenOrders adaptOpenOrders(
      IndependentReserveOpenOrdersResponse independentReserveOrders); static UserTrades adaptTradeHistory(
      IndependentReserveTradeHistoryResponse independentReserveTradeHistoryResponse); static Order adaptOrderDetails(IndependentReserveOrderDetailsResponse details); static FundingRecord.Status adaptTransactionStatusToFundingRecordStatus(String status); static FundingRecord.Type adaptTransactionTypeToFundingRecordType(
      IndependentReserveTransaction.Type transctionType); static String adaptTransactionHash(IndependentReserveTransaction transaction); static FundingRecord adaptTransaction(IndependentReserveTransaction transaction);  }
@Test public void adaptOrderDetails() throws InvalidFormatException { IndependentReserveOrderDetailsResponse orderDetailsResponse = new IndependentReserveOrderDetailsResponse( "abcf-123", "2014-09-23T12:39:34.3817763Z", "MarketBid", new BigDecimal(5.0), new BigDecimal(4.0), new BigDecimal(100), new BigDecimal(95), new BigDecimal(0), "PartiallyFilled", "Xbt", "Usd"); MarketOrder order = (MarketOrder) IndependentReserveAdapters.adaptOrderDetails(orderDetailsResponse); assertThat(order.getId()).isEqualTo("abcf-123"); assertThat(order.getTimestamp()) .isEqualTo(Date.from(ZonedDateTime.of(2014, 9, 23, 12, 39, 34, 0, UTC).toInstant())); assertThat(order.getType()).isEqualTo(Order.OrderType.BID); assertThat(order.getOriginalAmount()).isEqualByComparingTo(new BigDecimal(5)); assertThat(order.getCumulativeAmount()).isEqualByComparingTo(new BigDecimal(4)); assertThat(order.getAveragePrice()).isEqualByComparingTo(new BigDecimal(95)); assertThat(order.getFee()).isNull(); assertThat(order.getStatus()).isEqualTo(Order.OrderStatus.PARTIALLY_FILLED); assertThat(order.getCurrencyPair()).isEqualTo(new CurrencyPair("Xbt", "Usd")); }