EnigmaAdapters { public static Trade adaptTrade(EnigmaExecutedQuote enigmaTrade) { return new Trade.Builder() .currencyPair(getCurrencyPairFromString(enigmaTrade.getProductName())) .price(enigmaTrade.getPrice()) .originalAmount(enigmaTrade.getQuantity()) .timestamp(enigmaTrade.getCreatedAt()) .type(enigmaTrade.getSide().equals("sell") ? Order.OrderType.ASK : Order.OrderType.BID) .build(); } private  EnigmaAdapters(); static AccountInfo adaptAccountInfo(EnigmaBalance enigmaBalance, String userName); static Trade adaptTrade(EnigmaExecutedQuote enigmaTrade); static Trade adaptTrade(EnigmaOrderSubmission enigmaTrade); static Trades adaptTrades(List<Trade> trades); static Trades adaptTrades(EnigmaTransaction[] transactions, CurrencyPair currencyPair); static Ticker adaptTicker(EnigmaTicker enigmaTicker, CurrencyPair currencyPair); static OrderBook adaptOrderBook(
      EnigmaOrderBook enigmaOrderBook, CurrencyPair currencyPair); static OpenOrders adaptOpenOrders(EnigmaOpenOrders baseResponse); static List<LimitOrder> createOrders(
      CurrencyPair currencyPair, Order.OrderType orderType, List<List<BigDecimal>> orders); static LimitOrder createOrder(
      CurrencyPair currencyPair, List<BigDecimal> priceAndAmount, Order.OrderType orderType); static void checkArgument(boolean argument, String msgPattern, Object... msgArgs);  }
@Test public void testTradeAdapter() throws IOException { InputStream is = EnigmaAdaptersTest.class.getClassLoader().getResourceAsStream("order-submission.json"); ObjectMapper mapper = new ObjectMapper(); EnigmaOrderSubmission orderSubmission = mapper.readValue(is, EnigmaOrderSubmission.class); Trade trade = EnigmaAdapters.adaptTrade(orderSubmission); assertThat(trade.getId()).isEqualTo("195"); assertThat(trade.getCurrencyPair()).isEqualTo(getCurrencyPairFromString("BTC-USD")); assertThat(trade.getType()).isEqualTo(Order.OrderType.ASK); assertThat(trade.getPrice()).isEqualTo(new BigDecimal("10200.5865")); }