Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit08edbb2

Browse files
committed
JavaDoc Improvements & coverage improvements
Final 1.0.0
1 parent296d156 commit08edbb2

File tree

5 files changed

+73
-65
lines changed

5 files changed

+73
-65
lines changed

‎src/main/java/io/api/etherscan/core/impl/ProxyApiProvider.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ public Optional<String> txSendRaw(final String hexEncodedTx) throws ApiException
143143
finalStringProxyTOresponse =postRequest(urlParams,"",StringProxyTO.class);
144144
if(response.getError() !=null)
145145
thrownewEtherScanException("Error occurred with code " +response.getError().getCode()
146-
+" with message " +response.getError().getMessage());
146+
+" with message " +response.getError().getMessage()
147+
+", error id " +response.getId() +", jsonRPC " +response.getJsonrpc());
147148

148149
return (BasicUtils.isEmpty(response.getResult()))
149150
?Optional.empty()

‎src/test/java/io/api/etherscan/logs/LogQueryBuilderTest.java‎

Lines changed: 38 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
importio.api.etherscan.model.query.LogOp;
66
importio.api.etherscan.model.query.impl.LogQuery;
77
importio.api.etherscan.model.query.impl.LogQueryBuilder;
8+
importio.api.etherscan.model.query.impl.LogTopicQuadro;
89
importorg.junit.Assert;
910
importorg.junit.Test;
1011

@@ -19,8 +20,8 @@ public class LogQueryBuilderTest extends Assert {
1920
@Test
2021
publicvoidsingleCorrect() {
2122
LogQuerysingle =LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c")
22-
.topic("0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545")
23-
.build();
23+
.topic("0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545")
24+
.build();
2425

2526
assertNotNull(single);
2627
assertNotNull(single.getParams());
@@ -107,7 +108,7 @@ public void tripleInCorrectTopic1() {
107108
"0x72657075746174696f6e00000000000000000000000000000000000000000000",
108109
"0x72657075746174696f6e00000000000000000000000000000000000000000000")
109110
.setOpTopic0_1(LogOp.AND)
110-
.setOpTopic0_2(null)
111+
.setOpTopic0_2(LogOp.AND)
111112
.setOpTopic1_2(LogOp.AND)
112113
.build();
113114

@@ -119,10 +120,10 @@ public void tripleInCorrectTopic1() {
119120
publicvoidtripleInCorrectTopic2() {
120121
LogQuerytriple =LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c",379224,400000)
121122
.topic("0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545",
122-
"null",
123+
null,
123124
"0x72657075746174696f6e00000000000000000000000000000000000000000000")
124125
.setOpTopic0_1(LogOp.AND)
125-
.setOpTopic0_2(null)
126+
.setOpTopic0_2(LogOp.AND)
126127
.setOpTopic1_2(LogOp.AND)
127128
.build();
128129

@@ -135,9 +136,9 @@ public void tripleInCorrectTopic3() {
135136
LogQuerytriple =LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c",379224,400000)
136137
.topic("0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545",
137138
"0x72657075746174696f6e00000000000000000000000000000000000000000000",
138-
"null")
139+
null)
139140
.setOpTopic0_1(LogOp.AND)
140-
.setOpTopic0_2(null)
141+
.setOpTopic0_2(LogOp.AND)
141142
.setOpTopic1_2(LogOp.AND)
142143
.build();
143144

@@ -209,59 +210,55 @@ public void tupleIncorrectTopic1() {
209210

210211
@Test(expected =LogQueryException.class)
211212
publicvoidquadroIncorrectOp1() {
212-
LogQueryquadro =LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c")
213+
LogTopicQuadrotopicQuadro =LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c")
213214
.topic("0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545",
214-
null,
215+
"0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545",
215216
"0x72657075746174696f6e00000000000000000000000000000000000000000000",
216-
"0x72657075746174696f6e00000000000000000000000000000000000000000000")
217+
"0x72657075746174696f6e00000000000000000000000000000000000000000000");
218+
219+
topicQuadro
217220
.setOpTopic0_1(null)
218221
.setOpTopic0_2(LogOp.OR)
219222
.setOpTopic0_3(LogOp.AND)
220223
.setOpTopic1_2(LogOp.OR)
221224
.setOpTopic1_3(LogOp.OR)
222225
.setOpTopic2_3(LogOp.OR)
223226
.build();
224-
225-
assertNotNull(quadro);
226-
assertNotNull(quadro.getParams());
227227
}
228228

229229
@Test(expected =LogQueryException.class)
230230
publicvoidquadroIncorrectOp2() {
231-
LogQueryquadro =LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c")
231+
LogTopicQuadrotopicQuadro =LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c")
232232
.topic("0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545",
233-
null,
233+
"0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545",
234234
"0x72657075746174696f6e00000000000000000000000000000000000000000000",
235-
"0x72657075746174696f6e00000000000000000000000000000000000000000000")
236-
.setOpTopic0_1(LogOp.AND)
235+
"0x72657075746174696f6e00000000000000000000000000000000000000000000");
236+
237+
topicQuadro.setOpTopic0_1(LogOp.AND)
237238
.setOpTopic0_2(null)
238239
.setOpTopic0_3(LogOp.AND)
239240
.setOpTopic1_2(LogOp.OR)
240241
.setOpTopic1_3(LogOp.OR)
241242
.setOpTopic2_3(LogOp.OR)
242243
.build();
243-
244-
assertNotNull(quadro);
245-
assertNotNull(quadro.getParams());
246244
}
247245

248246
@Test(expected =LogQueryException.class)
249247
publicvoidquadroIncorrectOp3() {
250-
LogQueryquadro =LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c")
248+
LogTopicQuadrotopicQuadro =LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c")
251249
.topic("0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545",
252-
null,
250+
"0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545",
253251
"0x72657075746174696f6e00000000000000000000000000000000000000000000",
254-
"0x72657075746174696f6e00000000000000000000000000000000000000000000")
252+
"0x72657075746174696f6e00000000000000000000000000000000000000000000");
253+
254+
topicQuadro
255255
.setOpTopic0_1(LogOp.AND)
256256
.setOpTopic0_2(LogOp.OR)
257257
.setOpTopic0_3(null)
258258
.setOpTopic1_2(LogOp.OR)
259259
.setOpTopic1_3(LogOp.OR)
260260
.setOpTopic2_3(LogOp.OR)
261261
.build();
262-
263-
assertNotNull(quadro);
264-
assertNotNull(quadro.getParams());
265262
}
266263

267264
@Test(expected =LogQueryException.class)
@@ -285,59 +282,56 @@ public void quadroInCorrectAgainTopic() {
285282

286283
@Test(expected =LogQueryException.class)
287284
publicvoidquadroInCorrectOp4() {
288-
LogQueryquadro =LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c")
285+
LogTopicQuadrotopicQuadro =LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c")
289286
.topic("0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545",
290287
"0x72657075746174696f6e00000000000000000000000000000000000000000000",
291-
"",
292-
"")
288+
"0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545",
289+
"0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545");
290+
291+
topicQuadro
293292
.setOpTopic0_1(LogOp.AND)
294293
.setOpTopic0_2(LogOp.OR)
295294
.setOpTopic0_3(LogOp.AND)
296295
.setOpTopic1_2(null)
297296
.setOpTopic1_3(LogOp.OR)
298297
.setOpTopic2_3(LogOp.OR)
299298
.build();
300-
301-
assertNotNull(quadro);
302-
assertNotNull(quadro.getParams());
303299
}
304300

305301
@Test(expected =LogQueryException.class)
306302
publicvoidquadroInCorrectOp5() {
307-
LogQueryquadro =LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c")
303+
LogTopicQuadrotopicQuadro =LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c")
308304
.topic("0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545",
309305
"0x72657075746174696f6e00000000000000000000000000000000000000000000",
310-
"",
311-
"")
306+
"0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545",
307+
"0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545");
308+
309+
topicQuadro
312310
.setOpTopic0_1(LogOp.AND)
313311
.setOpTopic0_2(LogOp.OR)
314312
.setOpTopic0_3(LogOp.AND)
315313
.setOpTopic1_2(LogOp.AND)
316314
.setOpTopic1_3(null)
317315
.setOpTopic2_3(LogOp.OR)
318316
.build();
319-
320-
assertNotNull(quadro);
321-
assertNotNull(quadro.getParams());
322317
}
323318

324319
@Test(expected =LogQueryException.class)
325320
publicvoidquadroInCorrectOp6() {
326-
LogQueryquadro =LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c")
321+
LogTopicQuadrotopicQuadro =LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c")
327322
.topic("0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545",
328323
"0x72657075746174696f6e00000000000000000000000000000000000000000000",
329-
"",
330-
"")
324+
"0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545",
325+
"0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545");
326+
327+
topicQuadro
331328
.setOpTopic0_1(LogOp.AND)
332329
.setOpTopic0_2(LogOp.OR)
333330
.setOpTopic0_3(LogOp.AND)
334331
.setOpTopic1_2(LogOp.AND)
335332
.setOpTopic1_3(LogOp.OR)
336333
.setOpTopic2_3(null)
337334
.build();
338-
339-
assertNotNull(quadro);
340-
assertNotNull(quadro.getParams());
341335
}
342336

343337
@Test(expected =LogQueryException.class)

‎src/test/java/io/api/etherscan/proxy/ProxyTxApiTest.java‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ public class ProxyTxApiTest extends Assert {
2222
publicvoidcorrectByHash() {
2323
Optional<TxProxy>tx =api.proxy().tx("0x1e2910a262b1008d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1");
2424
assertTrue(tx.isPresent());
25-
assertNotNull(tx.get().getBlockHash());
26-
assertNotNull(tx.get().getFrom());
27-
assertNotNull(tx.get().getTo());
28-
assertNotNull(tx.get().getHash());
29-
assertNotNull(tx.get().getNonce());
25+
26+
TxProxytxProxy =tx.get();
27+
assertNotNull(txProxy.getBlockHash());
28+
assertNotNull(txProxy.getBlockNumber());
29+
assertNotNull(txProxy.getFrom());
30+
assertNotNull(txProxy.getTo());
31+
assertNotNull(txProxy.getHash());
32+
assertNotNull(txProxy.getNonce());
3033
}
3134

3235
@Test

‎src/test/java/io/api/etherscan/proxy/ProxyTxReceiptApiTest.java‎

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,21 @@ public class ProxyTxReceiptApiTest extends Assert {
2222
publicvoidcorrect() {
2323
Optional<ReceiptProxy>infoProxy =api.proxy().txReceipt("0x1e2910a262b1008d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1");
2424
assertTrue(infoProxy.isPresent());
25-
assertNotNull(infoProxy.get().getBlockHash());
26-
assertNotNull(infoProxy.get().getRoot());
27-
assertNotNull(infoProxy.get().getFrom());
28-
assertNotNull(infoProxy.get().getTo());
29-
assertNotNull(infoProxy.get().getBlockNumber());
30-
assertNotNull(infoProxy.get().getBlockHash());
31-
assertNotNull(infoProxy.get().getTransactionHash());
32-
assertNotNull(infoProxy.get().getTransactionIndex());
33-
assertNotNull(infoProxy.get().getGasUsed());
34-
assertNotNull(infoProxy.get().getCumulativeGasUsed());
35-
assertNotNull(infoProxy.get().getLogs());
36-
assertNotNull(infoProxy.get().getLogsBloom());
37-
assertNull(infoProxy.get().getContractAddress());
25+
26+
ReceiptProxyreceiptProxy =infoProxy.get();
27+
assertNotNull(receiptProxy.getBlockHash());
28+
assertNotNull(receiptProxy.getRoot());
29+
assertNotNull(receiptProxy.getFrom());
30+
assertNotNull(receiptProxy.getTo());
31+
assertNotNull(receiptProxy.getBlockNumber());
32+
assertNotNull(receiptProxy.getBlockHash());
33+
assertNotNull(receiptProxy.getTransactionHash());
34+
assertNotNull(receiptProxy.getTransactionIndex());
35+
assertNotNull(receiptProxy.getGasUsed());
36+
assertNotNull(receiptProxy.getCumulativeGasUsed());
37+
assertNotNull(receiptProxy.getLogs());
38+
assertNotNull(receiptProxy.getLogsBloom());
39+
assertNull(receiptProxy.getContractAddress());
3840
}
3941

4042
@Test(expected =InvalidTxHashException.class)

‎src/test/java/io/api/util/UtilTests.java‎renamed to ‎src/test/java/io/api/util/BasicUtilsTests.java‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
importorg.junit.Test;
99

1010
importjava.util.ArrayList;
11+
importjava.util.Collections;
1112
importjava.util.List;
1213

1314
/**
@@ -16,7 +17,7 @@
1617
* @author GoodforGod
1718
* @since 13.11.2018
1819
*/
19-
publicclassUtilTestsextendsAssert {
20+
publicclassBasicUtilsTestsextendsAssert {
2021

2122
@Test(expected =EtherScanException.class)
2223
publicvoidresponseValidateEmpty() {
@@ -31,9 +32,16 @@ public void responseValidateNullable() {
3132
}
3233

3334
@Test
34-
publicvoidpartitionEmpty() {
35+
publicvoidpartitionNewArrayList() {
3536
ArrayList<String>list =newArrayList<>();
3637
List<List<String>>lists =BasicUtils.partition(list,12);
3738
assertTrue(lists.isEmpty());
3839
}
40+
41+
@Test
42+
publicvoidpartitionEmpty() {
43+
List<String>list =Collections.emptyList();
44+
List<List<String>>lists =BasicUtils.partition(list,12);
45+
assertTrue(lists.isEmpty());
46+
}
3947
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp