-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug fix for FastRawTransactionManager.resetNonce
Signed-off-by: Junsung Cho <[email protected]>
- Loading branch information
1 parent
8d9e8ee
commit f34ea4b
Showing
3 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
core/src/test/java/org/web3j/tx/FastRawTransactionManagerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.web3j.tx; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.web3j.crypto.SampleKeys; | ||
import org.web3j.protocol.Web3j; | ||
|
||
import java.io.IOException; | ||
import java.math.BigInteger; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.mockito.Mockito.mock; | ||
|
||
public class FastRawTransactionManagerTest { | ||
private Web3j web3j; | ||
private FastRawTransactionManager fastRawTransactionManager; | ||
|
||
@BeforeEach | ||
public void setUp() throws Exception { | ||
web3j = mock(Web3j.class); | ||
fastRawTransactionManager = new FastRawTransactionManager(web3j, SampleKeys.CREDENTIALS); | ||
} | ||
|
||
@Test | ||
void clearNonce() throws IOException { | ||
fastRawTransactionManager.setNonce(BigInteger.valueOf(42)); | ||
|
||
fastRawTransactionManager.clearNonce(); | ||
|
||
BigInteger currentNonce = fastRawTransactionManager.getCurrentNonce(); | ||
assertEquals(currentNonce, BigInteger.valueOf(-1)); | ||
} | ||
} |