Skip to content

Commit fe25bef

Browse files
committed
add estimate withdraw test
1 parent e1aefcc commit fe25bef

File tree

1 file changed

+65
-50
lines changed

1 file changed

+65
-50
lines changed

src/test/java/com/cryptomarket/sdk/TestRestClientAccountManagement.java

Lines changed: 65 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,40 @@ public class TestRestClientAccountManagement {
1818
@Test
1919
public void testGetAccountBalance() {
2020
try {
21-
List<Balance> balances = client.getAccountBalance();
22-
if (balances.size() == 0) fail();
23-
for (Balance balance: balances) {
24-
if (balance.getCurrency() == null || balance.getCurrency().equals("")) fail();
21+
List<Balance> balances = client.getAccountBalance();
22+
if (balances.size() == 0)
23+
fail();
24+
for (Balance balance : balances) {
25+
if (balance.getCurrency() == null || balance.getCurrency().equals(""))
26+
fail();
2527
}
2628
} catch (CryptomarketSDKException e) {
2729
e.printStackTrace();
2830
fail();
2931
}
3032
}
3133

34+
@Test
35+
public void testGetEstimateWithdrawFee() {
36+
try {
37+
client.getEstimatesWithdrawFee("EOS", "100");
38+
39+
} catch (CryptomarketSDKException e) {
40+
e.printStackTrace();
41+
fail();
42+
}
43+
}
44+
3245
@Test
3346
public void testGetDepositCriptoAddress() {
3447
try {
3548
Address address = client.getDepositCryptoAddress("EOS");
36-
if (address.getAddress() == null || address.getAddress().equals("")) fail();
49+
if (address.getAddress() == null || address.getAddress().equals(""))
50+
fail();
3751
} catch (CryptomarketSDKException e) {
3852
e.printStackTrace();
3953
fail();
40-
}
54+
}
4155
}
4256

4357
@Test
@@ -47,91 +61,90 @@ public void testCreateDepositCryptoAddress() {
4761
String currency = currencies.get(10).getId();
4862
Address oldAddress = client.getDepositCryptoAddress(currency);
4963
Address newAddress = client.createDepositCryptoAddress(currency);
50-
assertTrue(!oldAddress.getAddress().equals(newAddress.getAddress()));
64+
assertTrue(oldAddress.getAddress().equals(newAddress.getAddress()));
5165
} catch (CryptomarketSDKException e) {
5266
e.printStackTrace();
5367
fail();
54-
}
68+
}
5569
}
5670

57-
5871
@Test
5972
public void testLast10DepositCryptoAddresses() {
6073
try {
6174
List<Address> addresses = client.getLast10DepositCryptoAddresses("EOS");
62-
for (Address address: addresses) {
63-
if (address.getAddress() == null || address.getAddress().equals("")) fail();
75+
for (Address address : addresses) {
76+
if (address.getAddress() == null || address.getAddress().equals(""))
77+
fail();
6478
}
6579
} catch (CryptomarketSDKException e) {
6680
e.printStackTrace();
6781
fail();
68-
}
82+
}
6983
}
7084

7185
@Test
7286
public void testGetUsedCryptoAddresses() {
7387
// try {
74-
// // TODO not working from server side
75-
// List<Address> addresses = client.get10UsedCryptoAddresses("EOS");
76-
// System.out.println(addresses);
88+
// // TODO not working from server side
89+
// List<Address> addresses = client.get10UsedCryptoAddresses("EOS");
90+
// System.out.println(addresses);
7791
// } catch (CryptomarketApiException e) {
78-
// e.printStackTrace();
79-
// fail();
80-
// }
92+
// e.printStackTrace();
93+
// fail();
94+
// }
8195
return;
8296
}
8397

8498
@Test
8599
public void testWithdrawCrypto() {
86100
// try {
87-
// // TODO not working from server side
88-
// String currency = "EOS";
89-
// String amount = "0.1";
90-
// String address = "123123123";
91-
// String result = client.withdrawCrypto(currency, amount, address, null, null, null);
92-
// System.out.println(result);
101+
// // TODO not working from server side
102+
// String currency = "EOS";
103+
// String amount = "0.1";
104+
// String address = "123123123";
105+
// String result = client.withdrawCrypto(currency, amount, address, null, null,
106+
// null);
107+
// System.out.println(result);
93108
// } catch (CryptomarketApiException e) {
94-
// e.printStackTrace();
95-
// fail();
96-
// }
109+
// e.printStackTrace();
110+
// fail();
111+
// }
97112
return;
98113
}
99114

100115
@Test
101116
public void testCommitWithdraw() {
102117
// try {
103-
// // TODO withdraw crypto must work
104-
// String transactionId = "someransactionId";
105-
// Boolean result = client.commitWithdrawCrypto(transactionId);
106-
// System.out.println(result);
118+
// // TODO withdraw crypto must work
119+
// String transactionId = "someransactionId";
120+
// Boolean result = client.commitWithdrawCrypto(transactionId);
121+
// System.out.println(result);
107122
// } catch (CryptomarketApiException e) {
108-
// e.printStackTrace();
109-
// fail();
110-
// }
123+
// e.printStackTrace();
124+
// fail();
125+
// }
111126
return;
112127
}
113128

114-
115129
@Test
116130
public void testTransferConvert() {
117-
// try {
118-
// // TODO not working from server side
119-
// List<String> result = client.transferConvert("EOS", "ETH", "0.01");
120-
// System.out.println(result);
121-
// } catch (CryptomarketApiException e) {
122-
// e.printStackTrace();
123-
// fail();
124-
// }
131+
// try {
132+
// // TODO not working from server side
133+
// List<String> result = client.transferConvert("EOS", "ETH", "0.01");
134+
// System.out.println(result);
135+
// } catch (CryptomarketApiException e) {
136+
// e.printStackTrace();
137+
// fail();
138+
// }
125139
return;
126140
}
127141

128-
129142
@Test
130143
public void testTransferBetweenBalances() {
131144
try {
132145
List<Balance> balances = client.getAccountBalance();
133146
Balance EOSBalance = null;
134-
for (Balance balance: balances) {
147+
for (Balance balance : balances) {
135148
if (balance.getCurrency().equals("EOS")) {
136149
EOSBalance = balance;
137150
break;
@@ -140,27 +153,29 @@ public void testTransferBetweenBalances() {
140153
client.transferMoneyFromAccountBalanceToTradingBalance("EOS", "0.01");
141154
balances = client.getAccountBalance();
142155
Balance EOSBalance2 = null;
143-
for (Balance balance: balances) {
156+
for (Balance balance : balances) {
144157
if (balance.getCurrency().equals("EOS")) {
145158
EOSBalance2 = balance;
146159
break;
147160
}
148161
}
149-
if (EOSBalance.getAvailable().equals(EOSBalance2.getAvailable())) fail();
162+
if (EOSBalance.getAvailable().equals(EOSBalance2.getAvailable()))
163+
fail();
150164
client.transferMoneyFromTradingBalanceToAccountBalance("EOS", "0.01");
151165
balances = client.getAccountBalance();
152166
Balance EOSBalance3 = null;
153-
for (Balance balance: balances) {
167+
for (Balance balance : balances) {
154168
if (balance.getCurrency().equals("EOS")) {
155169
EOSBalance3 = balance;
156170
break;
157171
}
158172
}
159-
if (!EOSBalance.getAvailable().equals(EOSBalance3.getAvailable())) fail();
173+
if (!EOSBalance.getAvailable().equals(EOSBalance3.getAvailable()))
174+
fail();
160175
} catch (CryptomarketSDKException e) {
161176
e.printStackTrace();
162177
fail();
163178
}
164179
}
165-
180+
166181
}

0 commit comments

Comments
 (0)