title: How to write a unit test for static variable?
body: <p>I have a class that has a static variable and a function that makes use of that variable. I need to write a unit test for shouldCreateNewToken() method.</p>
  <pre class="lang-sql prettyprint-override"><code>public class Auth {
      private static Instant tokenExpiration = Instant.now();
  
      public boolean shouldCreateNewToken() {
          Instant currentTimestamp = Instant.now(); 
          Duration differenceInTime = Duration.between(currentTimestamp, tokenExpiration);
  
          if (currentTimestamp.compareTo(tokenExpiration) &gt; 0 || differenceInTime.getSeconds() &lt; 120) {
              return true;
          }   
          return false;
      }
  }
  </code></pre>