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

Commit051bf29

Browse files
committed
Code coverage improvements
README badges
1 parent48d4aa4 commit051bf29

File tree

14 files changed

+98
-8
lines changed

14 files changed

+98
-8
lines changed

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#java-etherscan-api
22

3+
![travis](https://travis-ci.org/GoodforGod/java-etherscan-api.svg?branch=master)
4+
[![Maintainability](https://api.codeclimate.com/v1/badges/808997be2e69ff1ae8fe/maintainability)](https://codeclimate.com/github/GoodforGod/java-etherscan-api/maintainability)
5+
[![codecov](https://codecov.io/gh/GoodforGod/java-etherscan-api/branch/master/graph/badge.svg)](https://codecov.io/gh/GoodforGod/java-etherscan-api)
6+
37
[Etherscan](https://etherscan.io/apis) Java API implementation.
48

59
Library supports all available EtherScan*API* calls for all available*Ethereum Networks*.

‎src/main/java/io/api/etherscan/model/Supply.java‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@
1010
*/
1111
publicclassSupplyextendsWei {
1212

13-
publicSupply() {
14-
super();
15-
}
16-
17-
publicSupply(longvalue) {
18-
super(value);
19-
}
20-
2113
publicSupply(BigIntegervalue) {
2214
super(value);
2315
}

‎src/test/java/io/api/etherscan/account/AccountBalanceListTest.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ public void correctMoreThat20Addresses() {
4747
for(Balancebalance :balances) {
4848
assertNotNull(balance.getAddress());
4949
assertNotEquals(0,balance.getWei());
50+
assertNotEquals(0,balance.getKwei());
51+
assertNotEquals(0,balance.getMwei());
52+
assertNotEquals(0,balance.getEther());
53+
assertNotEquals(0,balance.getGwei());
5054
}
55+
56+
assertFalse(balances.get(0).equals(balances.get(1)));
5157
}
5258

5359
@Test(expected =InvalidAddressException.class)

‎src/test/java/io/api/etherscan/account/AccountMinedBlocksTest.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public void correct() {
6969

7070
assertEquals(blocksMined,blocks.size());
7171
assertBlocks(blocks);
72+
Blockblock =newBlock();
73+
assertFalse(blocks.get(0).equals(block));
7274
}
7375

7476
@Test(expected =InvalidAddressException.class)

‎src/test/java/io/api/etherscan/account/AccountTokenBalanceTest.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
importorg.junit.runners.Parameterized;
1212
importorg.junit.runners.Parameterized.Parameters;
1313

14+
importjava.math.BigInteger;
1415
importjava.util.Arrays;
1516
importjava.util.Collection;
1617

@@ -90,6 +91,9 @@ public void correct() {
9091
assertNotNull(balance.getAddress());
9192
assertNotNull(balance.getContract());
9293
assertNotEquals(0,balance.getWei());
94+
TokenBalancebalance1 =newTokenBalance("",BigInteger.ONE,"");
95+
assertFalse(balance.equals(balance1));
96+
assertFalse(balance.hashCode() ==balance1.hashCode());
9397
}
9498

9599
@Test(expected =InvalidAddressException.class)

‎src/test/java/io/api/etherscan/account/AccountTxInternalByHashTest.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ public void correct() {
8282
assertNotNull(txs.get(0).getTimeStamp());
8383
assertNotNull(txs.get(0).getGas());
8484
assertNotNull(txs.get(0).getValue());
85+
assertNotNull(txs.get(0).getType());
86+
assertFalse(txs.get(0).haveError());
87+
assertFalse(txs.get(0).haveError());
88+
assertNotEquals(-1,txs.get(0).getTraceId());
8589
assertTrue(BasicUtils.isEmpty(txs.get(0).getErrCode()));
8690
}
8791

‎src/test/java/io/api/etherscan/account/AccountTxTokenTest.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ private void assertTxs(List<TxToken> txs) {
6262
assertNotNull(tx.getFrom());
6363
assertNotNull(tx.getTo());
6464
assertNotNull(tx.getTimeStamp());
65+
assertNotNull(tx.getTokenDecimal());
66+
assertNotEquals(0,(tx.getConfirmations()));
67+
assertNotNull(tx.getGasUsed());
68+
assertNotEquals(0,(tx.getCumulativeGasUsed()));
69+
assertNotEquals(0,tx.getTransactionIndex());
6570
}
6671
}
6772
}

‎src/test/java/io/api/etherscan/account/AccountTxsTest.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public void correctStartBlockEndBlock() {
4949
assertNotNull(txs);
5050
assertEquals(3,txs.size());
5151
assertTxs(txs);
52+
assertFalse(txs.get(0).equals(txs.get(1)));
5253
}
5354

5455
@Test(expected =InvalidAddressException.class)
@@ -65,10 +66,15 @@ public void correctParamWithEmptyExpectedResult() {
6566

6667
privatevoidassertTxs(List<Tx>txs) {
6768
for (Txtx :txs) {
69+
assertFalse(tx.haveError());
6870
assertNotNull(tx.getBlockHash());
6971
assertNotNull(tx.getFrom());
7072
assertNotNull(tx.getTo());
7173
assertNotNull(tx.getTimeStamp());
74+
assertNotEquals(-1, (tx.getNonce()));
75+
assertNotEquals(0, (tx.getTransactionIndex()));
76+
assertNotEquals(0,tx.getConfirmations());
77+
assertNotNull(tx.getTxreceipt_status());
7278
}
7379
}
7480
}

‎src/test/java/io/api/etherscan/block/BlockApiTest.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public void correct() {
2828
assertFalse(uncles.get().getUncles().isEmpty());
2929
assertNotNull(uncles.get().getUncles().get(0).getBlockreward());
3030
assertNotNull(uncles.get().getUncles().get(0).getMiner());
31+
32+
assertNotEquals(0,uncles.get().hashCode());
3133
}
3234

3335
@Test

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,45 @@ public void quadroCorrect() {
119119
assertNotNull(quadro.getParams());
120120
}
121121

122+
@Test(expected =LogQueryException.class)
123+
publicvoidquadroIncorrectTopic() {
124+
LogQueryquadro =LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c")
125+
.topic("0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545",
126+
null,
127+
"0x72657075746174696f6e00000000000000000000000000000000000000000000",
128+
"0x72657075746174696f6e00000000000000000000000000000000000000000000")
129+
.setOpTopic0_1(LogOp.AND)
130+
.setOpTopic0_2(LogOp.OR)
131+
.setOpTopic0_3(LogOp.AND)
132+
.setOpTopic1_2(LogOp.OR)
133+
.setOpTopic1_3(LogOp.OR)
134+
.setOpTopic2_3(LogOp.OR)
135+
.build();
136+
137+
assertNotNull(quadro);
138+
assertNotNull(quadro.getParams());
139+
}
140+
141+
142+
@Test(expected =LogQueryException.class)
143+
publicvoidquadroInCorrectAgainTopic() {
144+
LogQueryquadro =LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c")
145+
.topic("0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545",
146+
"0x72657075746174696f6e00000000000000000000000000000000000000000000",
147+
"0x72657075746174696f6e00000000000000000000000000000000000000000000",
148+
null)
149+
.setOpTopic0_1(LogOp.AND)
150+
.setOpTopic0_2(LogOp.OR)
151+
.setOpTopic0_3(LogOp.AND)
152+
.setOpTopic1_2(LogOp.OR)
153+
.setOpTopic1_3(LogOp.OR)
154+
.setOpTopic2_3(LogOp.OR)
155+
.build();
156+
157+
assertNotNull(quadro);
158+
assertNotNull(quadro.getParams());
159+
}
160+
122161
@Test(expected =LogQueryException.class)
123162
publicvoidquadroInCorrectOp() {
124163
LogQueryquadro =LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp