From 1e1c299f1003705a0c020f854c025b17bbda1607 Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Wed, 11 Jan 2012 12:25:07 +0000
Subject: [PATCH] LMS-2717 more flexible MockTimeProvider

SVN: 24144
---
 .../common/utilities/MockTimeProvider.java    | 21 +++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/common/sourceTest/java/ch/systemsx/cisd/common/utilities/MockTimeProvider.java b/common/sourceTest/java/ch/systemsx/cisd/common/utilities/MockTimeProvider.java
index ff0cfb659a0..f1cc30dec22 100644
--- a/common/sourceTest/java/ch/systemsx/cisd/common/utilities/MockTimeProvider.java
+++ b/common/sourceTest/java/ch/systemsx/cisd/common/utilities/MockTimeProvider.java
@@ -17,17 +17,34 @@
 package ch.systemsx.cisd.common.utilities;
 
 /**
- * A time provider which increases time by 1 second each call.
+ * A time provider which increases time from a start time by specified steps.
  *
  * @author Franz-Josef Elmer
  */
 public class MockTimeProvider implements ITimeProvider
 {
     private long time;
+    private final long timeStep;
+    
+    /**
+     * Creates an instance which increases from 0 in steps of one second.
+     */
+    public MockTimeProvider()
+    {
+        this(0, 1000);
+    }
+    
+    public MockTimeProvider(long startTime, long timeStep)
+    {
+        time = startTime;
+        this.timeStep = timeStep;
+    }
     
     public long getTimeInMilliseconds()
     {
-        return time++ * 1000L;
+        long result = time;
+        time += timeStep;
+        return result;
     }
 
 }
-- 
GitLab