@Test public void testConvertToBitcoinURI() throws Exception { Address goodAddress = LegacyAddress.fromBase58(MAINNET, MAINNET_GOOD_ADDRESS); assertEquals("bitcoin:" + MAINNET_GOOD_ADDRESS + "?amount=12.34&label=Hello&message=AMessage", BitcoinURI.convertToBitcoinURI(goodAddress, parseCoin("12.34"), "Hello", "AMessage")); assertEquals("bitcoin:" + MAINNET_GOOD_ADDRESS + "?amount=12.34&label=Hello%20World&message=Mess%20%26%20age%20%2B%20hope", BitcoinURI.convertToBitcoinURI(goodAddress, parseCoin("12.34"), "Hello World", "Mess & age + hope")); assertEquals("bitcoin:" + MAINNET_GOOD_ADDRESS + "?label=Hello&message=glory", BitcoinURI.convertToBitcoinURI(goodAddress, null, "Hello", "glory")); assertEquals("bitcoin:" + MAINNET_GOOD_ADDRESS + "?amount=0.1&message=glory", BitcoinURI.convertToBitcoinURI(goodAddress, parseCoin("0.1"), null, "glory")); assertEquals("bitcoin:" + MAINNET_GOOD_ADDRESS + "?amount=0.1&message=glory", BitcoinURI.convertToBitcoinURI(goodAddress, parseCoin("0.1"), "", "glory")); assertEquals("bitcoin:" + MAINNET_GOOD_ADDRESS + "?amount=12.34&label=Hello", BitcoinURI.convertToBitcoinURI(goodAddress, parseCoin("12.34"), "Hello", null)); assertEquals("bitcoin:" + MAINNET_GOOD_ADDRESS + "?amount=12.34&label=Hello", BitcoinURI.convertToBitcoinURI(goodAddress, parseCoin("12.34"), "Hello", "")); assertEquals("bitcoin:" + MAINNET_GOOD_ADDRESS + "?amount=1000", BitcoinURI.convertToBitcoinURI(goodAddress, parseCoin("1000"), null, null)); assertEquals("bitcoin:" + MAINNET_GOOD_ADDRESS + "?amount=1000", BitcoinURI.convertToBitcoinURI(goodAddress, parseCoin("1000"), "", "")); assertEquals("bitcoin:" + MAINNET_GOOD_ADDRESS + "?label=Hello", BitcoinURI.convertToBitcoinURI(goodAddress, null, "Hello", null)); assertEquals("bitcoin:" + MAINNET_GOOD_ADDRESS + "?message=Agatha", BitcoinURI.convertToBitcoinURI(goodAddress, null, null, "Agatha")); assertEquals("bitcoin:" + MAINNET_GOOD_ADDRESS + "?message=Agatha", BitcoinURI.convertToBitcoinURI(goodAddress, null, "", "Agatha")); assertEquals("bitcoin:" + MAINNET_GOOD_ADDRESS, BitcoinURI.convertToBitcoinURI(goodAddress, null, null, null)); assertEquals("bitcoin:" + MAINNET_GOOD_ADDRESS, BitcoinURI.convertToBitcoinURI(goodAddress, null, "", "")); final NetworkParameters alternativeParameters = new MainNetParams() { @Override public String getUriScheme() { return "test"; } }; assertEquals("test:" + MAINNET_GOOD_ADDRESS + "?amount=12.34&label=Hello&message=AMessage", BitcoinURI.convertToBitcoinURI(LegacyAddress.fromBase58(alternativeParameters, MAINNET_GOOD_ADDRESS), parseCoin("12.34"), "Hello", "AMessage")); }
public static String convertToBitcoinURI(Address address, Coin amount, String label, String message) { return convertToBitcoinURI(address.getParameters(), address.toString(), amount, label, message); }
BitcoinURI { public static String convertToBitcoinURI(Address address, Coin amount, String label, String message) { return convertToBitcoinURI(address.getParameters(), address.toString(), amount, label, message); } }
BitcoinURI { public static String convertToBitcoinURI(Address address, Coin amount, String label, String message) { return convertToBitcoinURI(address.getParameters(), address.toString(), amount, label, message); } BitcoinURI(String uri);  BitcoinURI(@Nullable NetworkParameters params, String input); }
BitcoinURI { public static String convertToBitcoinURI(Address address, Coin amount, String label, String message) { return convertToBitcoinURI(address.getParameters(), address.toString(), amount, label, message); } BitcoinURI(String uri);  BitcoinURI(@Nullable NetworkParameters params, String input); @Nullable Address getAddress(); Coin getAmount(); String getLabel(); String getMessage(); final String getPaymentRequestUrl(); List<String> getPaymentRequestUrls(); Object getParameterByName(String name); @Override String toString(); static String convertToBitcoinURI(Address address, Coin amount,
                                             String label, String message); static String convertToBitcoinURI(NetworkParameters params,
                                             String address, @Nullable Coin amount,
                                             @Nullable String label, @Nullable String message); }
BitcoinURI { public static String convertToBitcoinURI(Address address, Coin amount, String label, String message) { return convertToBitcoinURI(address.getParameters(), address.toString(), amount, label, message); } BitcoinURI(String uri);  BitcoinURI(@Nullable NetworkParameters params, String input); @Nullable Address getAddress(); Coin getAmount(); String getLabel(); String getMessage(); final String getPaymentRequestUrl(); List<String> getPaymentRequestUrls(); Object getParameterByName(String name); @Override String toString(); static String convertToBitcoinURI(Address address, Coin amount,
                                             String label, String message); static String convertToBitcoinURI(NetworkParameters params,
                                             String address, @Nullable Coin amount,
                                             @Nullable String label, @Nullable String message); static final String FIELD_MESSAGE; static final String FIELD_LABEL; static final String FIELD_AMOUNT; static final String FIELD_ADDRESS; static final String FIELD_PAYMENT_REQUEST_URL; @Deprecated
    static final String BITCOIN_SCHEME; }