### Question:
BitcoinUnitConverter { public static BigDecimal convert(BigDecimal value, BitcoinUnit unitFrom, BitcoinUnit unitTo) throws BitcoinUnitConversionNotImplementedException { if (unitFrom.equals(BitcoinUnit.SATOSHI) && unitTo.equals(BitcoinUnit.COIN)) { return new BigDecimal(Coin.valueOf(value.longValueExact()).toPlainString()); } if (unitFrom.equals(BitcoinUnit.COIN) && unitTo.equals(BitcoinUnit.SATOSHI)) { return value.multiply(BitcoinUnit.COIN.getSatoshiFactor()); } throw new BitcoinUnitConversionNotImplementedException( String.format("Converting %s to %s is not implemented.", unitFrom, unitTo)); }  static BigDecimal convert(BigDecimal value, BitcoinUnit unitFrom, BitcoinUnit unitTo); static BigDecimal convert(BigInteger value, BitcoinUnit unitFrom, BitcoinUnit unitTo);  }### Answer:
@Test public void testSatoshiToBitcoinConversion() { BigDecimal coin = BigDecimal.ZERO; try { coin = BitcoinUnitConverter.convert( BigDecimal.valueOf(100_000_099), BitcoinUnit.SATOSHI, BitcoinUnit.COIN); } catch (BitcoinUnitConversionNotImplementedException e) { fail(); } assertEquals(0, coin.compareTo(new BigDecimal("1.00000099"))); }
@Test public void testBitcoinToSatoshiConversion() { BigDecimal satoshi = BigDecimal.ZERO; try { satoshi = BitcoinUnitConverter.convert( new BigDecimal("1.00000099"), BitcoinUnit.COIN, BitcoinUnit.SATOSHI); } catch (BitcoinUnitConversionNotImplementedException e) { fail(); } assertEquals(0, satoshi.compareTo(new BigDecimal(100_000_099))); }