Class EpochService

java.lang.Object
org.mockserver.time.EpochService

public class EpochService extends Object
  • Field Details

    • FIXED_TIME_FOR_TESTS

      public static final long FIXED_TIME_FOR_TESTS
  • Constructor Details

    • EpochService

      public EpochService()
  • Method Details

    • currentTimeMillis

      public static long currentTimeMillis()
    • fixedTime

      public static void fixedTime(boolean fixed)
      Test-only: pin (or unpin) currentTimeMillis() to FIXED_TIME_FOR_TESTS for the CURRENT thread only, so parallel test classes do not observe each other's fixed clock. Prefer the org.mockserver.time.FixedTime JUnit rule, which guarantees the reset even on failure.
    • fixedTimeGlobally

      public static void fixedTimeGlobally(boolean fixed)
      Test-only: pin (or unpin) currentTimeMillis() for ALL threads. Required only by tests that assert on timestamps generated off the test thread (e.g. the event-log disruptor). Because it is JVM-global it is NOT parallel-safe - such tests must run in the sequential Surefire phase. Prefer the org.mockserver.time.GlobalFixedTime JUnit rule, which guarantees the reset.
    • fixedTime

      public static boolean fixedTime()