Skip to content

Commit 3a3e409

Browse files
committed
[2.0.0-SNAPSHOT]
Tests reinforced
1 parent bf30d9a commit 3a3e409

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

Diff for: src/main/java/io/goodforgod/api/etherscan/model/GasEstimate.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ public int hashCode() {
4040

4141
@Override
4242
public String toString() {
43-
return "GasEstimate{" +
44-
"duration=" + duration +
45-
'}';
43+
return duration.toString();
4644
}
4745
}

Diff for: src/test/java/io/goodforgod/api/etherscan/model/ModelBuilderTests.java

+31
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,18 @@ void gasOracleBuilder() {
7979

8080
assertNotNull(value);
8181
assertEquals(Wei.ofWei(1000000000), value.getFastGasPriceInWei());
82+
83+
GasOracle value2 = GasOracle.builder()
84+
.withFastGasPrice(Wei.ofWei(1000000000))
85+
.withProposeGasPrice(Wei.ofWei(1000000000))
86+
.withSafeGasPrice(Wei.ofWei(1000000000))
87+
.withGasUsedRatio(Collections.singletonList(new BigDecimal(1)))
88+
.withLastBlock(1L)
89+
.withSuggestBaseFee(1.0)
90+
.build();
91+
assertEquals(value, value2);
92+
assertEquals(value.hashCode(), value2.hashCode());
93+
assertEquals(value.toString(), value2.toString());
8294
}
8395

8496
@Test
@@ -289,6 +301,16 @@ void ethSupplyBuilder() {
289301
.build();
290302
assertNotNull(valueEmpty);
291303
assertEquals(BigInteger.ZERO, valueEmpty.getTotal().asWei());
304+
305+
EthSupply value2 = EthSupply.builder()
306+
.withBurntFees(Wei.ofWei(1))
307+
.withEth2Staking(Wei.ofWei(1))
308+
.withEthSupply(Wei.ofWei(1))
309+
.withWithdrawnTotal(Wei.ofWei(1))
310+
.build();
311+
assertEquals(value, value2);
312+
assertEquals(value.hashCode(), value2.hashCode());
313+
assertEquals(value.toString(), value2.toString());
292314
}
293315

294316
@Test
@@ -368,4 +390,13 @@ void blockProxyBuilder() {
368390
assertNotNull(value);
369391
assertEquals(BigInteger.valueOf(1), value.getGasUsed().asWei());
370392
}
393+
394+
@Test
395+
void gasEstimate() {
396+
GasEstimate gas1 = new GasEstimate(1);
397+
GasEstimate gas2 = new GasEstimate(1);
398+
assertEquals(gas1, gas2);
399+
assertEquals(gas1.hashCode(), gas2.hashCode());
400+
assertEquals(gas1.toString(), gas2.toString());
401+
}
371402
}

0 commit comments

Comments
 (0)