title: How can I test a class dedicated to returning the current time?
body: <p>I had a class that needed to get the current time. When I started writing tests for that class, I abstracted the time functionality into an external class, which was then injected into the original class and could be mocked while testing. This all works fine, but now I have a Clock class that I would like to test. How can I test this class?</p>
  
  <pre><code>import java.util.Date;
  
  public class Clock {
      public long getCurrentTime() {
          return new Date().getTime();
      }
  }
  </code></pre>
  
  <p>Note: It's very simple at the moment, but I intend to expand it to include more time methods as I continue testing.</p>