CoinbaseProAdapters { protected static Date parseDate(final String rawDate) { String modified; if (rawDate.length() > 23) { modified = rawDate.substring(0, 23); } else if (rawDate.endsWith("Z")) { switch (rawDate.length()) { case 20: modified = rawDate.substring(0, 19) + ".000"; break; case 22: modified = rawDate.substring(0, 21) + "00"; break; case 23: modified = rawDate.substring(0, 22) + "0"; break; default: modified = rawDate; break; } } else { switch (rawDate.length()) { case 19: modified = rawDate + ".000"; break; case 21: modified = rawDate + "00"; break; case 22: modified = rawDate + "0"; break; default: modified = rawDate; break; } } try { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); return dateFormat.parse(modified); } catch (ParseException e) { logger.warn("unable to parse rawDate={} modified={}", rawDate, modified, e); return null; } } private  CoinbaseProAdapters(); static CurrencyPair toCurrencyPair(final String productId); static Ticker adaptTicker(
      CoinbaseProProductTicker ticker, CoinbaseProProductStats stats, CurrencyPair currencyPair); static OrderBook adaptOrderBook(
      CoinbaseProProductBook book, CurrencyPair currencyPair, Date date); static OrderBook adaptOrderBook(CoinbaseProProductBook book, CurrencyPair currencyPair); static Wallet adaptAccountInfo(CoinbaseProAccount[] coinbaseProAccounts); @SuppressWarnings("unchecked") static OpenOrders adaptOpenOrders(CoinbaseProOrder[] coinbaseExOpenOrders); static Order adaptOrder(CoinbaseProOrder order); static OrderStatus[] adaptOrderStatuses(CoinbaseProOrder[] orders); static OrderStatus adaptOrderStatus(CoinbaseProOrder order); static Trades adaptTrades(
      List<CoinbaseProTrade> coinbaseProTradesList, CurrencyPair currencyPair); static UserTrades adaptTradeHistory(CoinbaseProFill[] coinbaseExFills); static Trades adaptTrades(CoinbaseProTrade[] coinbaseExTrades, CurrencyPair currencyPair); static CurrencyPair adaptCurrencyPair(CoinbaseProProduct product); static ExchangeMetaData adaptToExchangeMetaData(
      ExchangeMetaData exchangeMetaData,
      CoinbaseProProduct[] products,
      CoinbaseProCurrency[] cbCurrencies); static String adaptProductID(CurrencyPair currencyPair); static CoinbaseProPlaceOrder.Side adaptSide(OrderType orderType); static CoinbaseProPlaceOrder.Stop adaptStop(OrderType orderType); static CoinbaseProPlaceLimitOrder adaptCoinbaseProPlaceLimitOrder(LimitOrder limitOrder); static CoinbaseProPlaceMarketOrder adaptCoinbaseProPlaceMarketOrder(
      MarketOrder marketOrder); static CoinbaseProPlaceOrder adaptCoinbaseProStopOrder(StopOrder stopOrder); static FundingRecord adaptFundingRecord(
      Currency currency, CoinbaseProTransfer coinbaseProTransfer);  }
@Test public void parseDateTest() { assertThat(CoinbaseProAdapters.parseDate("2017-05-02T15:10:03Z").getTime()) .isEqualTo(1493737803000L); assertThat(CoinbaseProAdapters.parseDate("2017-05-02T15:10:03.1Z").getTime()) .isEqualTo(1493737803100L); assertThat(CoinbaseProAdapters.parseDate("2017-05-02T15:10:03.12Z").getTime()) .isEqualTo(1493737803120L); assertThat(CoinbaseProAdapters.parseDate("2017-05-02T15:10:03.123Z").getTime()) .isEqualTo(1493737803123L); assertThat(CoinbaseProAdapters.parseDate("2017-05-02T15:10:03.1234567Z").getTime()) .isEqualTo(1493737803123L); assertThat(CoinbaseProAdapters.parseDate("2017-05-02T15:10:03").getTime()) .isEqualTo(1493737803000L); assertThat(CoinbaseProAdapters.parseDate("2017-05-02T15:10:03.1").getTime()) .isEqualTo(1493737803100L); assertThat(CoinbaseProAdapters.parseDate("2017-05-02T15:10:03.12").getTime()) .isEqualTo(1493737803120L); assertThat(CoinbaseProAdapters.parseDate("2017-05-02T15:10:03.123").getTime()) .isEqualTo(1493737803123L); assertThat(CoinbaseProAdapters.parseDate("2017-05-02T15:10:03.123456").getTime()) .isEqualTo(1493737803123L); assertThat(CoinbaseProAdapters.parseDate("2017-06-21T04:52:01.996Z").getTime()) .isEqualTo(1498020721996L); }