OSDN Git Service

add BalanceTest and some list methods
[bytom/bytom-java-sdk.git] / src / test / java / io / bytom / integration / BalanceTest.java
1 package io.bytom.integration;
2
3 import io.bytom.TestUtils;
4 import io.bytom.api.Balance;
5 import io.bytom.api.Wallet;
6 import io.bytom.exception.BytomException;
7 import io.bytom.http.Client;
8 import org.apache.log4j.Logger;
9 import org.junit.Assert;
10 import org.junit.Test;
11
12 import java.util.List;
13
14 public class BalanceTest {
15
16     static Client client;
17
18     static {
19         try {
20             client = TestUtils.generateClient();
21         } catch (BytomException e) {
22             e.printStackTrace();
23         }
24     }
25
26     static Balance balance;
27
28     @Test
29     public void testBalanceList() throws Exception {
30         List<Balance> balanceList = new Balance.QueryBuilder().list(client);
31         Assert.assertNotNull(balanceList);
32     }
33
34     @Test
35     public void testBalanceByAssetAlias() throws Exception {
36         long amount = new Balance.QueryBuilder().listByAssetAlias(client, "BTM");
37         Assert.assertNotNull(amount);
38     }
39
40     @Test
41     public void testBalanceByAccountAlias() throws Exception {
42         List<Balance> balanceList = new Balance.QueryBuilder().listByAccountAlias(client, "test");
43         Assert.assertNotNull(balanceList);
44     }
45
46 }