3
0
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:
Mike Hearn 2014-03-29 14:37:04 +01:00
parent 51b71a4363
commit 4df59adeb9
3 changed files with 5 additions and 5 deletions

View File

@ -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);
}
/**

View File

@ -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);

View File

@ -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.