@Test
public void testParseCoin() {

    // String version
    assertEquals(CENT, parseCoin("0.01"));
    assertEquals(CENT, parseCoin("1E-2"));
    assertEquals(COIN.add(CENT), parseCoin("1.01"));
    assertEquals(COIN.negate(), parseCoin("-1"));
    try {
        parseCoin("2E-20");
        org.junit.Assert.fail("should not have accepted fractional satoshis");
    } catch (IllegalArgumentException expected) {
    } catch (Exception e) {
        org.junit.Assert.fail("should throw IllegalArgumentException");
    }
    assertEquals(1, parseCoin("0.00000001").value);
    assertEquals(1, parseCoin("0.000000010").value);
}