public class StaticTimeRule extends Object implements org.junit.rules.TestRule
At the start of each test the time as viewed by Joda Time classes is frozen to the provided time. At the end of the test it is returned to the system time. This makes time based testing predictable.
Modifier and Type | Method and Description |
---|---|
static StaticTimeRule |
always(org.joda.time.ReadableInstant instant) |
static StaticTimeRule |
alwaysNow() |
static StaticTimeRule |
alwaysStartOfEpoch() |
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
org.joda.time.ReadableInstant |
getInstant() |
public static StaticTimeRule alwaysStartOfEpoch()
public static StaticTimeRule alwaysNow()
public static StaticTimeRule always(org.joda.time.ReadableInstant instant)
instant
- the instant at which time will be frozenpublic org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
apply
in interface org.junit.rules.TestRule
public org.joda.time.ReadableInstant getInstant()
Copyright © 2013. All Rights Reserved.