|
1 | 1 | package io.goodforgod.api.etherscan.model;
|
2 | 2 |
|
| 3 | +import io.goodforgod.api.etherscan.model.proxy.BlockProxy; |
| 4 | +import io.goodforgod.api.etherscan.model.proxy.ReceiptProxy; |
| 5 | +import io.goodforgod.api.etherscan.model.proxy.TxProxy; |
3 | 6 | import java.math.BigDecimal;
|
4 | 7 | import java.math.BigInteger;
|
5 | 8 | import java.time.LocalDateTime;
|
| 9 | +import java.util.Arrays; |
6 | 10 | import java.util.Collections;
|
7 | 11 | import org.junit.jupiter.api.Assertions;
|
8 | 12 | import org.junit.jupiter.api.Test;
|
@@ -84,8 +88,8 @@ void logBuilder() {
|
84 | 88 | .withAddress("1")
|
85 | 89 | .withBlockNumber(1L)
|
86 | 90 | .withData("1")
|
87 |
| - .withGasPrice(BigInteger.ONE) |
88 |
| - .withGasUsed(BigInteger.ONE) |
| 91 | + .withGasPrice(Wei.ofWei(1)) |
| 92 | + .withGasUsed(Wei.ofWei(1)) |
89 | 93 | .withLogIndex(1L)
|
90 | 94 | .withTimeStamp(timestamp)
|
91 | 95 | .withTransactionHash("1")
|
@@ -268,4 +272,100 @@ void txInternalBuilder() {
|
268 | 272 | assertEquals("1", value.getTo());
|
269 | 273 | assertEquals("1", value.getFrom());
|
270 | 274 | }
|
| 275 | + |
| 276 | + @Test |
| 277 | + void ethSupplyBuilder() { |
| 278 | + EthSupply value = EthSupply.builder() |
| 279 | + .withBurntFees(Wei.ofWei(1)) |
| 280 | + .withEth2Staking(Wei.ofWei(1)) |
| 281 | + .withEthSupply(Wei.ofWei(1)) |
| 282 | + .withWithdrawnTotal(Wei.ofWei(1)) |
| 283 | + .build(); |
| 284 | + |
| 285 | + assertNotNull(value); |
| 286 | + assertEquals(BigInteger.valueOf(1), value.getTotal().asWei()); |
| 287 | + |
| 288 | + EthSupply valueEmpty = EthSupply.builder() |
| 289 | + .build(); |
| 290 | + assertNotNull(valueEmpty); |
| 291 | + assertEquals(BigInteger.ZERO, valueEmpty.getTotal().asWei()); |
| 292 | + } |
| 293 | + |
| 294 | + @Test |
| 295 | + void receiptProxyBuilder() { |
| 296 | + LocalDateTime timestamp = LocalDateTime.now(); |
| 297 | + ReceiptProxy value = ReceiptProxy.builder() |
| 298 | + .withBlockHash("1") |
| 299 | + .withBlockNumber(1L) |
| 300 | + .withContractAddress("1") |
| 301 | + .withCumulativeGasUsed(Wei.ofWei(1)) |
| 302 | + .withFrom("1") |
| 303 | + .withTo("1") |
| 304 | + .withGasUsed(Wei.ofWei(1)) |
| 305 | + .withRoot("1") |
| 306 | + .withLogsBloom("1") |
| 307 | + .withTransactionHash("1") |
| 308 | + .withTransactionIndex(1L) |
| 309 | + .withLogs(Arrays.asList(Log.builder() |
| 310 | + .withTopics(Arrays.asList("1")) |
| 311 | + .withTransactionIndex(1L) |
| 312 | + .withTransactionHash("1") |
| 313 | + .withTimeStamp(timestamp) |
| 314 | + .withLogIndex(1L) |
| 315 | + .withGasUsed(Wei.ofWei(1)) |
| 316 | + .withGasPrice(Wei.ofWei(1)) |
| 317 | + .withData("1") |
| 318 | + .withAddress("1") |
| 319 | + .build())) |
| 320 | + .build(); |
| 321 | + |
| 322 | + assertNotNull(value); |
| 323 | + assertEquals(BigInteger.valueOf(1), value.getGasUsed().asWei()); |
| 324 | + } |
| 325 | + |
| 326 | + @Test |
| 327 | + void blockProxyBuilder() { |
| 328 | + LocalDateTime timestamp = LocalDateTime.now(); |
| 329 | + BlockProxy value = BlockProxy.builder() |
| 330 | + .withGasUsed(Wei.ofWei(1)) |
| 331 | + .withLogsBloom("1") |
| 332 | + .withDifficulty("1") |
| 333 | + .withExtraData("1") |
| 334 | + .withGasLimit(Wei.ofWei(1)) |
| 335 | + .withHash("1") |
| 336 | + .withMiner("1") |
| 337 | + .withMixHash("1") |
| 338 | + .withNonce("1") |
| 339 | + .withNumber(1L) |
| 340 | + .withParentHash("1") |
| 341 | + .withReceiptsRoot("1") |
| 342 | + .withSha3Uncles("1") |
| 343 | + .withSize(1L) |
| 344 | + .withStateRoot("1") |
| 345 | + .withTimestamp(timestamp) |
| 346 | + .withTotalDifficulty("1") |
| 347 | + .withTransactionsRoot("1") |
| 348 | + .withUncles(Arrays.asList("1")) |
| 349 | + .withTransactions(Arrays.asList(TxProxy.builder() |
| 350 | + .withBlockHash("1") |
| 351 | + .withBlockNumber(1L) |
| 352 | + .withFrom("1") |
| 353 | + .withGas(Wei.ofWei(1)) |
| 354 | + .withGasPrice(Wei.ofWei(1)) |
| 355 | + .withHash("1") |
| 356 | + .withInput("1") |
| 357 | + .withNonce(1L) |
| 358 | + .withR("1") |
| 359 | + .withS("1") |
| 360 | + .withTo("1") |
| 361 | + .withTransactionIndex(1L) |
| 362 | + .withV("1") |
| 363 | + .withValue("1") |
| 364 | + .withV("1") |
| 365 | + .build())) |
| 366 | + .build(); |
| 367 | + |
| 368 | + assertNotNull(value); |
| 369 | + assertEquals(BigInteger.valueOf(1), value.getGasUsed().asWei()); |
| 370 | + } |
271 | 371 | }
|
0 commit comments