BTCTradeAdapters { static BigDecimal nullSafeSum(BigDecimal a, BigDecimal b) { return zeroIfNull(a).add(zeroIfNull(b)); } private  BTCTradeAdapters(); static Date adaptDatetime(String datetime); static CurrencyPair adaptCurrencyPair(String coin); static Ticker adaptTicker(BTCTradeTicker btcTradeTicker, CurrencyPair currencyPair); static OrderBook adaptOrderBook(BTCTradeDepth btcTradeDepth, CurrencyPair currencyPair); static Trades adaptTrades(BTCTradeTrade[] btcTradeTrades, CurrencyPair currencyPair); static boolean adaptResult(BTCTradeResult result); static Wallet adaptWallet(BTCTradeBalance balance); static String adaptDepositAddress(BTCTradeWallet wallet); static String adaptPlaceOrderResult(BTCTradePlaceOrderResult result); static OpenOrders adaptOpenOrders(BTCTradeOrder[] btcTradeOrders); static UserTrades adaptTrades(
      BTCTradeOrder[] btcTradeOrders, BTCTradeOrder[] btcTradeOrderDetails);  }
@Test public void testNullSafeSum() throws Exception { assertEquals(BTCTradeAdapters.zeroIfNull(new BigDecimal(3)), new BigDecimal(3)); assertEquals(BTCTradeAdapters.zeroIfNull(new BigDecimal(0)), BigDecimal.ZERO); assertEquals(BTCTradeAdapters.zeroIfNull(null), BigDecimal.ZERO); assertEquals( BTCTradeAdapters.nullSafeSum(BigDecimal.ONE, new BigDecimal(2)), new BigDecimal(3)); assertEquals(BTCTradeAdapters.nullSafeSum(BigDecimal.ONE, null), BigDecimal.ONE); assertEquals(BTCTradeAdapters.nullSafeSum(null, new BigDecimal(2)), new BigDecimal(2)); assertEquals(BTCTradeAdapters.nullSafeSum(null, null), BigDecimal.ZERO); }