|
| 1 | +packageio.api.etherscan.account; |
| 2 | + |
| 3 | +importio.api.ApiRunner; |
| 4 | +importio.api.etherscan.error.InvalidAddressException; |
| 5 | +importio.api.etherscan.model.TxToken; |
| 6 | +importorg.junit.Test; |
| 7 | + |
| 8 | +importjava.util.List; |
| 9 | + |
| 10 | +/** |
| 11 | + * @author NGuggs |
| 12 | + * @since 11.28.2021 |
| 13 | + */ |
| 14 | +publicclassAccountTxRc721TokenTestextendsApiRunner { |
| 15 | + |
| 16 | +@Test |
| 17 | +publicvoidcorrect() { |
| 18 | +List<TxToken>txs =getApi().account().txsNftToken("0x1a1ebe0d86f72884c3fd484ae1e796e08f8ffa67"); |
| 19 | +assertNotNull(txs); |
| 20 | +assertEquals(16,txs.size()); |
| 21 | +assertTxs(txs); |
| 22 | +assertNotEquals(0,txs.get(0).getGasPrice()); |
| 23 | +assertNotEquals(-1,txs.get(0).getNonce()); |
| 24 | + |
| 25 | +assertNotNull(txs.get(0).toString()); |
| 26 | +assertNotEquals(txs.get(0).toString(),txs.get(1).toString()); |
| 27 | + |
| 28 | +assertNotEquals(txs.get(0),txs.get(1)); |
| 29 | +assertNotEquals(txs.get(0).hashCode(),txs.get(1).hashCode()); |
| 30 | + |
| 31 | +assertEquals(txs.get(1),txs.get(1)); |
| 32 | +assertEquals(txs.get(1).hashCode(),txs.get(1).hashCode()); |
| 33 | + } |
| 34 | + |
| 35 | +@Test |
| 36 | +publicvoidcorrectStartBlock() { |
| 37 | +List<TxToken>txs =getApi().account().txsNftToken("0x1a1ebe0d86f72884c3fd484ae1e796e08f8ffa67",4762071); |
| 38 | +System.out.println(txs); |
| 39 | +assertNotNull(txs); |
| 40 | +assertEquals(5,txs.size()); |
| 41 | +assertTxs(txs); |
| 42 | + } |
| 43 | + |
| 44 | +@Test |
| 45 | +publicvoidcorrectStartBlockEndBlock() { |
| 46 | +List<TxToken>txs =getApi().account().txsNftToken("0x1a1ebe0d86f72884c3fd484ae1e796e08f8ffa67",4761862,4761934); |
| 47 | +System.out.println(txs); |
| 48 | +assertNotNull(txs); |
| 49 | +assertEquals(11,txs.size()); |
| 50 | +assertTxs(txs); |
| 51 | + } |
| 52 | + |
| 53 | +@Test(expected =InvalidAddressException.class) |
| 54 | +publicvoidinvalidParamWithError() { |
| 55 | +getApi().account().txsNftToken("0x6ec53A8fBa6358d59B3C4476D82cc60A2B0FaD7"); |
| 56 | + } |
| 57 | + |
| 58 | +@Test |
| 59 | +publicvoidcorrectParamWithEmptyExpectedResult() { |
| 60 | +List<TxToken>txs =getApi().account().txsNftToken("0x31ec53A8fBa6358d59B3C4476D82cc60A2B0FaD7"); |
| 61 | +assertNotNull(txs); |
| 62 | +assertTrue(txs.isEmpty()); |
| 63 | + } |
| 64 | + |
| 65 | +privatevoidassertTxs(List<TxToken>txs) { |
| 66 | +for (TxTokentx :txs) { |
| 67 | +assertNotNull(tx.getBlockHash()); |
| 68 | +assertNotNull(tx.getTokenName()); |
| 69 | +assertNotNull(tx.getTokenSymbol()); |
| 70 | +assertNotNull(tx.getFrom()); |
| 71 | +assertNotNull(tx.getTo()); |
| 72 | +assertNotNull(tx.getTimeStamp()); |
| 73 | +assertNotNull(tx.getTokenDecimal()); |
| 74 | +assertNotEquals(-1, (tx.getConfirmations())); |
| 75 | +assertNotNull(tx.getGasUsed()); |
| 76 | +assertNotEquals(-1,tx.getCumulativeGasUsed()); |
| 77 | +assertNotEquals(-1,tx.getTransactionIndex()); |
| 78 | + } |
| 79 | + } |
| 80 | +} |