1   package com.atlassian.pageobjects.elements.mock.clock;
2   
3   import com.atlassian.pageobjects.elements.query.util.Clock;
4   
5   /**
6    * Simple clock that returns a constant value given during construction. Useful for testing date related functions.
7    *
8    */
9   public final class ConstantClock implements Clock
10  {
11      private final long currentTime;
12  
13      public ConstantClock(long currentDate)
14      {
15          this.currentTime = currentDate;
16      }
17  
18      public long currentTime()
19      {
20          return currentTime;
21      }
22  
23      @Override
24      public String toString()
25      {
26          return "ConstantClock[time=" + currentTime + "]";
27      }
28  }