-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathAccountTest.java
More file actions
77 lines (64 loc) · 2.05 KB
/
AccountTest.java
File metadata and controls
77 lines (64 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package io.bytom.integration;
import org.junit.Test;
import io.bytom.api.Account;
import io.bytom.api.Address;
import io.bytom.api.Key;
import io.bytom.http.Client;
import static org.junit.Assert.*;
public class AccountTest {
private static Client client;
@Test
public void run() {
try {
// testCreateAcount();
// testListAcounts();
// testDeleteAccount();
// testCreateAccountReceiver();
//testListAddresses();
testValidateAddress();
}
catch (Exception e) {
e.printStackTrace();
}
}
public void testCreateAcount() throws Exception {
client = TestUtils.generateClient();
Key key = Key.create(client, "keytest0033", "123456");
if (key != null && key.xpub != null) {
Account account = new Account.Builder().setAlias("hello_bytom9")
.addXpub(key.xpub).setQuorum(1).create(client);
assertNotNull(account.id);
assertNotNull(account.alias);
assertNotNull(account.keyIndex);
assertEquals(1, account.xpubs.size());
assertNotNull(account.xpubs.get(0));
}
}
public void testListAcounts() throws Exception {
client = TestUtils.generateClient();
Account.Items items = new Account.QueryBuilder().list(client);
assertNotNull(items);
System.out.println(items.data.get(0).alias);
System.out.println(items.data.get(0).id);
}
public void testDeleteAccount() throws Exception {
client = TestUtils.generateClient();
new Account().delete(client, "hello_bytom9");
}
public void testCreateAccountReceiver() throws Exception {
client = TestUtils.generateClient();
new Account.ReceiverBuilder().setAccountId("0DSPTV6T00A08").create(client);
}
public void testListAddresses() throws Exception {
client = TestUtils.generateClient();
Account.AddressBuilder.Items items = new Account.AddressBuilder().setAccountId(
"0DSPTV6T00A08").list(client);
assertNotNull(items.data);
}
public void testValidateAddress() throws Exception {
client = TestUtils.generateClient();
Address address = new Account.AddressBuilder().validate(client,
"bm1qg3v9awlqh530fv7aqh230pkf62rpp35lap3unt");
assertNotNull(address);
}
}