mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-07 06:44:16 +00:00
TestWithPeerGroup: don't stopAsync if the peergroup isn't running and update the class description.
This commit is contained in:
parent
5a8ed59029
commit
34017e16f8
@ -34,7 +34,9 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class that makes it easy to work with mock NetworkConnections in PeerGroups.
|
* You can derive from this class and call peerGroup.start() in your tests to get a functional PeerGroup that can be
|
||||||
|
* used with loopback peers created using connectPeer. This involves real TCP connections so is a pretty accurate
|
||||||
|
* mock, but means unit tests cannot be run simultaneously.
|
||||||
*/
|
*/
|
||||||
public class TestWithPeerGroup extends TestWithNetworkConnections {
|
public class TestWithPeerGroup extends TestWithNetworkConnections {
|
||||||
protected static final NetworkParameters params = UnitTestParams.get();
|
protected static final NetworkParameters params = UnitTestParams.get();
|
||||||
@ -72,6 +74,7 @@ public class TestWithPeerGroup extends TestWithNetworkConnections {
|
|||||||
super.tearDown();
|
super.tearDown();
|
||||||
blockJobs = false;
|
blockJobs = false;
|
||||||
Utils.finishMockSleep();
|
Utils.finishMockSleep();
|
||||||
|
if (peerGroup.isRunning())
|
||||||
peerGroup.stopAsync();
|
peerGroup.stopAsync();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
Loading…
Reference in New Issue
Block a user