-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathTransactionFeedTest.java
More file actions
86 lines (74 loc) · 2.35 KB
/
TransactionFeedTest.java
File metadata and controls
86 lines (74 loc) · 2.35 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
78
79
80
81
82
83
84
85
86
package io.bytom.integration;
import static org.junit.Assert.assertEquals;
import org.junit.Assert;
import org.junit.Test;
import io.bytom.api.TransactionFeed;
import io.bytom.exception.BytomException;
import io.bytom.http.Client;
/**
* TransactionFeedApiTest
*
* @author niyuelin1990
*
*/
public class TransactionFeedTest {
private static Client client;
@Test
public void run() {
try {
String alias = "test1";
testCreatetransactionFeed(alias);
testGetTransactionFeed(alias);
testUpdateTransactionFeed(alias);
testListTransactionFeed();
testDeleteTransactionFeed(alias);
} catch (Exception e) {
e.printStackTrace();
}
}
public void testCreatetransactionFeed(String alias) throws Exception {
client = TestUtils.generateClient();
try {
String filter = "asset_id='84778a666fe453cf73b2e8c783dbc9e04bc4fd7cbb4f50caeaee99cf9967ebed' AND amount_lower_limit = 50 AND amount_upper_limit = 100";
boolean flag = new TransactionFeed.Builder().setAlias(alias).setFilter(filter).create(client);
Assert.assertEquals(true, flag);
} catch (BytomException e) {
e.printStackTrace();
}
}
public void testGetTransactionFeed(String alias) throws Exception {
client = TestUtils.generateClient();
try {
TransactionFeed txfeed = TransactionFeed.get(client, alias);
System.out.println(txfeed);
Assert.assertEquals(alias, txfeed.alias);
} catch (BytomException e) {
e.printStackTrace();
}
}
public void testUpdateTransactionFeed(String alias) throws Exception {
client = TestUtils.generateClient();
try {
String filter = "asset_id='84778a666fe453cf73b2e8c783dbc9e04bc4fd7cbb4f50caeaee99cf9967ebed' AND amount_lower_limit = 50 AND amount_upper_limit = 80";
boolean flag = TransactionFeed.update(client, alias, filter);
Assert.assertEquals(true, flag);
} catch (BytomException e) {
e.printStackTrace();
}
}
public void testListTransactionFeed() throws Exception {
client = TestUtils.generateClient();
TransactionFeed.Items items = TransactionFeed.list(client);
assertEquals(1, items.data.size());
System.out.println(items.data.get(0));
}
public void testDeleteTransactionFeed(String alias) throws Exception {
client = TestUtils.generateClient();
try {
boolean flag = TransactionFeed.delete(client, alias);
Assert.assertEquals(true, flag);
} catch (BytomException e) {
e.printStackTrace();
}
}
}