mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-01-31 15:22:16 +00:00
Use setMockClock instead of rollMockClock(0) to resolve flaky tests.
This commit is contained in:
parent
51b71a4363
commit
4df59adeb9
@ -510,8 +510,8 @@ public class Utils {
|
||||
/**
|
||||
* Sets the mock clock to the given time (in seconds).
|
||||
*/
|
||||
public static void setMockClock(long mockClock) {
|
||||
mockTime = new Date(mockClock * 1000);
|
||||
public static void setMockClock(long mockClockSeconds) {
|
||||
mockTime = new Date(mockClockSeconds * 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,7 +61,7 @@ public class BasicKeyChainTest {
|
||||
@Test
|
||||
public void importKeys() {
|
||||
long now = Utils.currentTimeSeconds();
|
||||
Utils.rollMockClock(0);
|
||||
Utils.setMockClock(now);
|
||||
final ECKey key1 = new ECKey();
|
||||
Utils.rollMockClock(86400);
|
||||
final ECKey key2 = new ECKey();
|
||||
@ -185,7 +185,7 @@ public class BasicKeyChainTest {
|
||||
|
||||
@Test
|
||||
public void serializationUnencrypted() throws UnreadableWalletException {
|
||||
Utils.rollMockClock(0);
|
||||
Utils.setMockClock();
|
||||
Date now = Utils.now();
|
||||
final ECKey key1 = new ECKey();
|
||||
Utils.rollMockClock(5000);
|
||||
|
@ -45,7 +45,7 @@ public class KeyChainGroupTest {
|
||||
|
||||
public KeyChainGroupTest() {
|
||||
BriefLogFormatter.init();
|
||||
Utils.rollMockClock(0);
|
||||
Utils.setMockClock();
|
||||
group = new KeyChainGroup();
|
||||
group.setLookaheadSize(LOOKAHEAD_SIZE); // Don't want slow tests.
|
||||
group.getActiveKeyChain(); // Force create a chain.
|
||||
|
Loading…
Reference in New Issue
Block a user