コード例 #1
0
  /**
   * Handles a simple amount
   *
   * @throws FeathercoinURIParseException If something goes wrong
   */
  @Test
  public void testGood_Amount() throws FeathercoinURIParseException {
    // Test the decimal parsing
    testObject =
        new FeathercoinURI(
            NetworkParameters.prodNet(),
            FeathercoinURI.LITECOIN_SCHEME
                + ":"
                + PRODNET_GOOD_ADDRESS
                + "?amount=9876543210.12345678");
    assertEquals("987654321012345678", testObject.getAmount().toString());

    // Test the decimal parsing
    testObject =
        new FeathercoinURI(
            NetworkParameters.prodNet(),
            FeathercoinURI.LITECOIN_SCHEME + ":" + PRODNET_GOOD_ADDRESS + "?amount=.12345678");
    assertEquals("12345678", testObject.getAmount().toString());

    // Test the integer parsing
    testObject =
        new FeathercoinURI(
            NetworkParameters.prodNet(),
            FeathercoinURI.LITECOIN_SCHEME + ":" + PRODNET_GOOD_ADDRESS + "?amount=9876543210");
    assertEquals("987654321000000000", testObject.getAmount().toString());
  }
コード例 #2
0
 @Test
 public void brokenURIs() throws FeathercoinURIParseException {
   // Check we can parse the incorrectly formatted URIs produced by blockchain.info and its iPhone
   // app.
   String str = "feathercoin://1KzTSfqjF2iKCduwz59nv2uqh1W2JsTxZH?amount=0.01000000";
   FeathercoinURI uri = new FeathercoinURI(str);
   assertEquals("1KzTSfqjF2iKCduwz59nv2uqh1W2JsTxZH", uri.getAddress().toString());
   assertEquals(Utils.toNanoCoins(0, 1), uri.getAmount());
 }
コード例 #3
0
 /**
  * Test the simplest well-formed URI
  *
  * @throws FeathercoinURIParseException If something goes wrong
  */
 @Test
 public void testGood_Simple() throws FeathercoinURIParseException {
   testObject =
       new FeathercoinURI(
           NetworkParameters.prodNet(),
           FeathercoinURI.LITECOIN_SCHEME + ":" + PRODNET_GOOD_ADDRESS);
   assertNotNull(testObject);
   assertNull("Unexpected amount", testObject.getAmount());
   assertNull("Unexpected label", testObject.getLabel());
   assertEquals("Unexpected label", 20, testObject.getAddress().getHash160().length);
 }