### Question:
Coin implements Monetary, Comparable<Coin>, Serializable { public static long btcToSatoshi(BigDecimal coins) { return coins.movePointRight(SMALLEST_UNIT_EXPONENT).longValueExact(); } private  Coin(final long satoshis); static Coin valueOf(final long satoshis); @Override int smallestUnitExponent(); @Override long getValue(); static Coin valueOf(final int coins, final int cents); static long btcToSatoshi(BigDecimal coins); static BigDecimal satoshiToBtc(long satoshis); static Coin ofBtc(BigDecimal coins); static Coin ofSat(long satoshis); static Coin parseCoin(final String str); static Coin parseCoinInexact(final String str); Coin add(final Coin value); Coin plus(final Coin value); Coin subtract(final Coin value); Coin minus(final Coin value); Coin multiply(final long factor); Coin times(final long factor); Coin times(final int factor); Coin divide(final long divisor); Coin div(final long divisor); Coin div(final int divisor); Coin[] divideAndRemainder(final long divisor); long divide(final Coin divisor); boolean isPositive(); boolean isNegative(); boolean isZero(); boolean isGreaterThan(Coin other); boolean isLessThan(Coin other); Coin shiftLeft(final int n); Coin shiftRight(final int n); @Override int signum(); Coin negate(); long longValue(); long toSat(); BigDecimal toBtc(); String toFriendlyString(); String toPlainString(); @Override String toString(); @Override boolean equals(final Object o); @Override int hashCode(); @Override int compareTo(final Coin other); static final int SMALLEST_UNIT_EXPONENT; static final Coin ZERO; static final Coin COIN; static final Coin CENT; static final Coin MILLICOIN; static final Coin MICROCOIN; static final Coin SATOSHI; static final Coin FIFTY_COINS; static final Coin NEGATIVE_SATOSHI; final long value; }### Answer:
@Test public void testBtcToSatoshi() { assertEquals(Long.MIN_VALUE, btcToSatoshi(new BigDecimal("-92233720368.54775808"))); assertEquals(0L, btcToSatoshi(BigDecimal.ZERO)); assertEquals(COIN.value, btcToSatoshi(BigDecimal.ONE)); assertEquals(Long.MAX_VALUE, btcToSatoshi(new BigDecimal("92233720368.54775807"))); }
@Test(expected = ArithmeticException.class) public void testBtcToSatoshi_tooSmall() { btcToSatoshi(new BigDecimal("-92233720368.54775809")); }
@Test(expected = ArithmeticException.class) public void testBtcToSatoshi_tooBig() { btcToSatoshi(new BigDecimal("92233720368.54775808")); }
@Test(expected = ArithmeticException.class) public void testBtcToSatoshi_tooPrecise1() { btcToSatoshi(new BigDecimal("0.000000001")); }
@Test(expected = ArithmeticException.class) public void testBtcToSatoshi_tooPrecise2() { btcToSatoshi(new BigDecimal("92233720368.547758079")); }