forked from hyperledger-web3j/web3j
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request hyperledger-web3j#433 from mushketyk/web3j-shutdown
Adds web3j shutdown method
- Loading branch information
Showing
5 changed files
with
46 additions
and
1 deletion.
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
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
27 changes: 27 additions & 0 deletions
27
core/src/test/java/org/web3j/protocol/core/JsonRpc2_0Web3jTest.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,27 @@ | ||
package org.web3j.protocol.core; | ||
|
||
import java.util.concurrent.ScheduledExecutorService; | ||
|
||
import org.junit.Test; | ||
|
||
import org.web3j.protocol.Web3j; | ||
import org.web3j.protocol.Web3jService; | ||
|
||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.verify; | ||
|
||
public class JsonRpc2_0Web3jTest { | ||
|
||
@Test | ||
public void testStopExecutorOnShutdown() { | ||
ScheduledExecutorService scheduledExecutorService = mock(ScheduledExecutorService.class); | ||
|
||
Web3j web3j = Web3j.build( | ||
mock(Web3jService.class), 10, scheduledExecutorService | ||
); | ||
|
||
web3j.shutdown(); | ||
|
||
verify(scheduledExecutorService).shutdown(); | ||
} | ||
} |
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