mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-19 13:45:48 +00:00
BitcoinURITest: Migrate references to deprecated BitcoinURI.BITCOIN_SCHEME field.
This commit is contained in:
parent
7ad2da9ab1
commit
6fcbca10e0
@ -30,11 +30,13 @@ import static org.junit.Assert.*;
|
|||||||
public class BitcoinURITest {
|
public class BitcoinURITest {
|
||||||
private BitcoinURI testObject = null;
|
private BitcoinURI testObject = null;
|
||||||
|
|
||||||
|
private static final NetworkParameters MAINNET = MainNetParams.get();
|
||||||
private static final String MAINNET_GOOD_ADDRESS = "1KzTSfqjF2iKCduwz59nv2uqh1W2JsTxZH";
|
private static final String MAINNET_GOOD_ADDRESS = "1KzTSfqjF2iKCduwz59nv2uqh1W2JsTxZH";
|
||||||
|
private static final String BITCOIN_SCHEME = MAINNET.getUriScheme();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConvertToBitcoinURI() throws Exception {
|
public void testConvertToBitcoinURI() throws Exception {
|
||||||
Address goodAddress = Address.fromBase58(MainNetParams.get(), MAINNET_GOOD_ADDRESS);
|
Address goodAddress = Address.fromBase58(MAINNET, MAINNET_GOOD_ADDRESS);
|
||||||
|
|
||||||
// simple example
|
// simple example
|
||||||
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&message=AMessage", BitcoinURI.convertToBitcoinURI(goodAddress, parseCoin("12.34"), "Hello", "AMessage"));
|
||||||
@ -82,7 +84,7 @@ public class BitcoinURITest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGood_Simple() throws BitcoinURIParseException {
|
public void testGood_Simple() throws BitcoinURIParseException {
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS);
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS);
|
||||||
assertNotNull(testObject);
|
assertNotNull(testObject);
|
||||||
assertNull("Unexpected amount", testObject.getAmount());
|
assertNull("Unexpected amount", testObject.getAmount());
|
||||||
assertNull("Unexpected label", testObject.getLabel());
|
assertNull("Unexpected label", testObject.getLabel());
|
||||||
@ -95,7 +97,7 @@ public class BitcoinURITest {
|
|||||||
@Test
|
@Test
|
||||||
public void testBad_Scheme() {
|
public void testBad_Scheme() {
|
||||||
try {
|
try {
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), "blimpcoin:" + MAINNET_GOOD_ADDRESS);
|
testObject = new BitcoinURI(MAINNET, "blimpcoin:" + MAINNET_GOOD_ADDRESS);
|
||||||
fail("Expecting BitcoinURIParseException");
|
fail("Expecting BitcoinURIParseException");
|
||||||
} catch (BitcoinURIParseException e) {
|
} catch (BitcoinURIParseException e) {
|
||||||
}
|
}
|
||||||
@ -108,14 +110,14 @@ public class BitcoinURITest {
|
|||||||
public void testBad_BadSyntax() {
|
public void testBad_BadSyntax() {
|
||||||
// Various illegal characters
|
// Various illegal characters
|
||||||
try {
|
try {
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + "|" + MAINNET_GOOD_ADDRESS);
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME + "|" + MAINNET_GOOD_ADDRESS);
|
||||||
fail("Expecting BitcoinURIParseException");
|
fail("Expecting BitcoinURIParseException");
|
||||||
} catch (BitcoinURIParseException e) {
|
} catch (BitcoinURIParseException e) {
|
||||||
assertTrue(e.getMessage().contains("Bad URI syntax"));
|
assertTrue(e.getMessage().contains("Bad URI syntax"));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS + "\\");
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS + "\\");
|
||||||
fail("Expecting BitcoinURIParseException");
|
fail("Expecting BitcoinURIParseException");
|
||||||
} catch (BitcoinURIParseException e) {
|
} catch (BitcoinURIParseException e) {
|
||||||
assertTrue(e.getMessage().contains("Bad URI syntax"));
|
assertTrue(e.getMessage().contains("Bad URI syntax"));
|
||||||
@ -123,7 +125,7 @@ public class BitcoinURITest {
|
|||||||
|
|
||||||
// Separator without field
|
// Separator without field
|
||||||
try {
|
try {
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":");
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":");
|
||||||
fail("Expecting BitcoinURIParseException");
|
fail("Expecting BitcoinURIParseException");
|
||||||
} catch (BitcoinURIParseException e) {
|
} catch (BitcoinURIParseException e) {
|
||||||
assertTrue(e.getMessage().contains("Bad URI syntax"));
|
assertTrue(e.getMessage().contains("Bad URI syntax"));
|
||||||
@ -136,7 +138,7 @@ public class BitcoinURITest {
|
|||||||
@Test
|
@Test
|
||||||
public void testBad_Address() {
|
public void testBad_Address() {
|
||||||
try {
|
try {
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME);
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME);
|
||||||
fail("Expecting BitcoinURIParseException");
|
fail("Expecting BitcoinURIParseException");
|
||||||
} catch (BitcoinURIParseException e) {
|
} catch (BitcoinURIParseException e) {
|
||||||
}
|
}
|
||||||
@ -148,7 +150,7 @@ public class BitcoinURITest {
|
|||||||
@Test
|
@Test
|
||||||
public void testBad_IncorrectAddressType() {
|
public void testBad_IncorrectAddressType() {
|
||||||
try {
|
try {
|
||||||
testObject = new BitcoinURI(TestNet3Params.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS);
|
testObject = new BitcoinURI(TestNet3Params.get(), BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS);
|
||||||
fail("Expecting BitcoinURIParseException");
|
fail("Expecting BitcoinURIParseException");
|
||||||
} catch (BitcoinURIParseException e) {
|
} catch (BitcoinURIParseException e) {
|
||||||
assertTrue(e.getMessage().contains("Bad address"));
|
assertTrue(e.getMessage().contains("Bad address"));
|
||||||
@ -164,17 +166,17 @@ public class BitcoinURITest {
|
|||||||
@Test
|
@Test
|
||||||
public void testGood_Amount() throws BitcoinURIParseException {
|
public void testGood_Amount() throws BitcoinURIParseException {
|
||||||
// Test the decimal parsing
|
// Test the decimal parsing
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
||||||
+ "?amount=6543210.12345678");
|
+ "?amount=6543210.12345678");
|
||||||
assertEquals("654321012345678", testObject.getAmount().toString());
|
assertEquals("654321012345678", testObject.getAmount().toString());
|
||||||
|
|
||||||
// Test the decimal parsing
|
// Test the decimal parsing
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
||||||
+ "?amount=.12345678");
|
+ "?amount=.12345678");
|
||||||
assertEquals("12345678", testObject.getAmount().toString());
|
assertEquals("12345678", testObject.getAmount().toString());
|
||||||
|
|
||||||
// Test the integer parsing
|
// Test the integer parsing
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
||||||
+ "?amount=6543210");
|
+ "?amount=6543210");
|
||||||
assertEquals("654321000000000", testObject.getAmount().toString());
|
assertEquals("654321000000000", testObject.getAmount().toString());
|
||||||
}
|
}
|
||||||
@ -187,7 +189,7 @@ public class BitcoinURITest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGood_Label() throws BitcoinURIParseException {
|
public void testGood_Label() throws BitcoinURIParseException {
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
||||||
+ "?label=Hello%20World");
|
+ "?label=Hello%20World");
|
||||||
assertEquals("Hello World", testObject.getLabel());
|
assertEquals("Hello World", testObject.getLabel());
|
||||||
}
|
}
|
||||||
@ -202,7 +204,7 @@ public class BitcoinURITest {
|
|||||||
public void testGood_LabelWithAmpersandAndPlus() throws BitcoinURIParseException {
|
public void testGood_LabelWithAmpersandAndPlus() throws BitcoinURIParseException {
|
||||||
String testString = "Hello Earth & Mars + Venus";
|
String testString = "Hello Earth & Mars + Venus";
|
||||||
String encodedLabel = BitcoinURI.encodeURLString(testString);
|
String encodedLabel = BitcoinURI.encodeURLString(testString);
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS + "?label="
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS + "?label="
|
||||||
+ encodedLabel);
|
+ encodedLabel);
|
||||||
assertEquals(testString, testObject.getLabel());
|
assertEquals(testString, testObject.getLabel());
|
||||||
}
|
}
|
||||||
@ -218,7 +220,7 @@ public class BitcoinURITest {
|
|||||||
// Moscow in Russian in Cyrillic
|
// Moscow in Russian in Cyrillic
|
||||||
String moscowString = "\u041c\u043e\u0441\u043a\u0432\u0430";
|
String moscowString = "\u041c\u043e\u0441\u043a\u0432\u0430";
|
||||||
String encodedLabel = BitcoinURI.encodeURLString(moscowString);
|
String encodedLabel = BitcoinURI.encodeURLString(moscowString);
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS + "?label="
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS + "?label="
|
||||||
+ encodedLabel);
|
+ encodedLabel);
|
||||||
assertEquals(moscowString, testObject.getLabel());
|
assertEquals(moscowString, testObject.getLabel());
|
||||||
}
|
}
|
||||||
@ -231,7 +233,7 @@ public class BitcoinURITest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGood_Message() throws BitcoinURIParseException {
|
public void testGood_Message() throws BitcoinURIParseException {
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
||||||
+ "?message=Hello%20World");
|
+ "?message=Hello%20World");
|
||||||
assertEquals("Hello World", testObject.getMessage());
|
assertEquals("Hello World", testObject.getMessage());
|
||||||
}
|
}
|
||||||
@ -244,7 +246,7 @@ public class BitcoinURITest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGood_Combinations() throws BitcoinURIParseException {
|
public void testGood_Combinations() throws BitcoinURIParseException {
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
||||||
+ "?amount=6543210&label=Hello%20World&message=Be%20well");
|
+ "?amount=6543210&label=Hello%20World&message=Be%20well");
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"BitcoinURI['amount'='654321000000000','label'='Hello World','message'='Be well','address'='1KzTSfqjF2iKCduwz59nv2uqh1W2JsTxZH']",
|
"BitcoinURI['amount'='654321000000000','label'='Hello World','message'='Be well','address'='1KzTSfqjF2iKCduwz59nv2uqh1W2JsTxZH']",
|
||||||
@ -261,7 +263,7 @@ public class BitcoinURITest {
|
|||||||
public void testBad_Amount() throws BitcoinURIParseException {
|
public void testBad_Amount() throws BitcoinURIParseException {
|
||||||
// Missing
|
// Missing
|
||||||
try {
|
try {
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
||||||
+ "?amount=");
|
+ "?amount=");
|
||||||
fail("Expecting BitcoinURIParseException");
|
fail("Expecting BitcoinURIParseException");
|
||||||
} catch (BitcoinURIParseException e) {
|
} catch (BitcoinURIParseException e) {
|
||||||
@ -270,7 +272,7 @@ public class BitcoinURITest {
|
|||||||
|
|
||||||
// Non-decimal (BIP 21)
|
// Non-decimal (BIP 21)
|
||||||
try {
|
try {
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
||||||
+ "?amount=12X4");
|
+ "?amount=12X4");
|
||||||
fail("Expecting BitcoinURIParseException");
|
fail("Expecting BitcoinURIParseException");
|
||||||
} catch (BitcoinURIParseException e) {
|
} catch (BitcoinURIParseException e) {
|
||||||
@ -280,13 +282,13 @@ public class BitcoinURITest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEmpty_Label() throws BitcoinURIParseException {
|
public void testEmpty_Label() throws BitcoinURIParseException {
|
||||||
assertNull(new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
assertNull(new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
||||||
+ "?label=").getLabel());
|
+ "?label=").getLabel());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEmpty_Message() throws BitcoinURIParseException {
|
public void testEmpty_Message() throws BitcoinURIParseException {
|
||||||
assertNull(new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
assertNull(new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
||||||
+ "?message=").getMessage());
|
+ "?message=").getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,7 +301,7 @@ public class BitcoinURITest {
|
|||||||
@Test
|
@Test
|
||||||
public void testBad_Duplicated() throws BitcoinURIParseException {
|
public void testBad_Duplicated() throws BitcoinURIParseException {
|
||||||
try {
|
try {
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
||||||
+ "?address=aardvark");
|
+ "?address=aardvark");
|
||||||
fail("Expecting BitcoinURIParseException");
|
fail("Expecting BitcoinURIParseException");
|
||||||
} catch (BitcoinURIParseException e) {
|
} catch (BitcoinURIParseException e) {
|
||||||
@ -309,7 +311,7 @@ public class BitcoinURITest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGood_ManyEquals() throws BitcoinURIParseException {
|
public void testGood_ManyEquals() throws BitcoinURIParseException {
|
||||||
assertEquals("aardvark=zebra", new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":"
|
assertEquals("aardvark=zebra", new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":"
|
||||||
+ MAINNET_GOOD_ADDRESS + "?label=aardvark=zebra").getLabel());
|
+ MAINNET_GOOD_ADDRESS + "?label=aardvark=zebra").getLabel());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,7 +324,7 @@ public class BitcoinURITest {
|
|||||||
@Test
|
@Test
|
||||||
public void testUnknown() throws BitcoinURIParseException {
|
public void testUnknown() throws BitcoinURIParseException {
|
||||||
// Unknown not required field
|
// Unknown not required field
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
||||||
+ "?aardvark=true");
|
+ "?aardvark=true");
|
||||||
assertEquals("BitcoinURI['aardvark'='true','address'='1KzTSfqjF2iKCduwz59nv2uqh1W2JsTxZH']", testObject.toString());
|
assertEquals("BitcoinURI['aardvark'='true','address'='1KzTSfqjF2iKCduwz59nv2uqh1W2JsTxZH']", testObject.toString());
|
||||||
|
|
||||||
@ -330,7 +332,7 @@ public class BitcoinURITest {
|
|||||||
|
|
||||||
// Unknown not required field (isolated)
|
// Unknown not required field (isolated)
|
||||||
try {
|
try {
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
||||||
+ "?aardvark");
|
+ "?aardvark");
|
||||||
fail("Expecting BitcoinURIParseException");
|
fail("Expecting BitcoinURIParseException");
|
||||||
} catch (BitcoinURIParseException e) {
|
} catch (BitcoinURIParseException e) {
|
||||||
@ -339,7 +341,7 @@ public class BitcoinURITest {
|
|||||||
|
|
||||||
// Unknown and required field
|
// Unknown and required field
|
||||||
try {
|
try {
|
||||||
testObject = new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
testObject = new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
||||||
+ "?req-aardvark=true");
|
+ "?req-aardvark=true");
|
||||||
fail("Expecting BitcoinURIParseException");
|
fail("Expecting BitcoinURIParseException");
|
||||||
} catch (BitcoinURIParseException e) {
|
} catch (BitcoinURIParseException e) {
|
||||||
@ -358,19 +360,19 @@ public class BitcoinURITest {
|
|||||||
|
|
||||||
@Test(expected = BitcoinURIParseException.class)
|
@Test(expected = BitcoinURIParseException.class)
|
||||||
public void testBad_AmountTooPrecise() throws BitcoinURIParseException {
|
public void testBad_AmountTooPrecise() throws BitcoinURIParseException {
|
||||||
new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
||||||
+ "?amount=0.123456789");
|
+ "?amount=0.123456789");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = BitcoinURIParseException.class)
|
@Test(expected = BitcoinURIParseException.class)
|
||||||
public void testBad_NegativeAmount() throws BitcoinURIParseException {
|
public void testBad_NegativeAmount() throws BitcoinURIParseException {
|
||||||
new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
||||||
+ "?amount=-1");
|
+ "?amount=-1");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = BitcoinURIParseException.class)
|
@Test(expected = BitcoinURIParseException.class)
|
||||||
public void testBad_TooLargeAmount() throws BitcoinURIParseException {
|
public void testBad_TooLargeAmount() throws BitcoinURIParseException {
|
||||||
new BitcoinURI(MainNetParams.get(), BitcoinURI.BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
new BitcoinURI(MAINNET, BITCOIN_SCHEME + ":" + MAINNET_GOOD_ADDRESS
|
||||||
+ "?amount=100000000");
|
+ "?amount=100000000");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,7 +388,7 @@ public class BitcoinURITest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMultiplePaymentProtocolReq() throws Exception {
|
public void testMultiplePaymentProtocolReq() throws Exception {
|
||||||
BitcoinURI uri = new BitcoinURI(MainNetParams.get(),
|
BitcoinURI uri = new BitcoinURI(MAINNET,
|
||||||
"bitcoin:?r=https%3A%2F%2Fbitcoincore.org%2F%7Egavin&r1=bt:112233445566");
|
"bitcoin:?r=https%3A%2F%2Fbitcoincore.org%2F%7Egavin&r1=bt:112233445566");
|
||||||
assertEquals(ImmutableList.of("bt:112233445566", "https://bitcoincore.org/~gavin"), uri.getPaymentRequestUrls());
|
assertEquals(ImmutableList.of("bt:112233445566", "https://bitcoincore.org/~gavin"), uri.getPaymentRequestUrls());
|
||||||
assertEquals("https://bitcoincore.org/~gavin", uri.getPaymentRequestUrl());
|
assertEquals("https://bitcoincore.org/~gavin", uri.getPaymentRequestUrl());
|
||||||
@ -394,7 +396,7 @@ public class BitcoinURITest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNoPaymentProtocolReq() throws Exception {
|
public void testNoPaymentProtocolReq() throws Exception {
|
||||||
BitcoinURI uri = new BitcoinURI(MainNetParams.get(), "bitcoin:" + MAINNET_GOOD_ADDRESS);
|
BitcoinURI uri = new BitcoinURI(MAINNET, "bitcoin:" + MAINNET_GOOD_ADDRESS);
|
||||||
assertNull(uri.getPaymentRequestUrl());
|
assertNull(uri.getPaymentRequestUrl());
|
||||||
assertEquals(ImmutableList.of(), uri.getPaymentRequestUrls());
|
assertEquals(ImmutableList.of(), uri.getPaymentRequestUrls());
|
||||||
assertNotNull(uri.getAddress());
|
assertNotNull(uri.getAddress());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user