Annotation Type DefaultTimeZone
@DefaultTimeZone is a JUnit Jupiter extension to change the value
returned by TimeZone.getDefault() for a test execution.
The TimeZone to set as the default TimeZone is
configured by specifying the TimeZone ID as defined by
TimeZone.getTimeZone(String). After the annotated element
has been executed, the default TimeZone will be restored to its
original value.
@DefaultTimeZone can be used on the method and on the class
level. It is inherited from higher-level containers, but can only be used
once per method or class. If a class is annotated, the configured
TimeZone will be the default TimeZone for all tests inside
that class. Any method level configurations will override the class level
default TimeZone.
During
parallel test execution,
all tests annotated with DefaultTimeZone, ReadsDefaultTimeZone, and WritesDefaultTimeZone
are scheduled in a way that guarantees correctness under mutation of shared global state.
For more details and examples, see
the documentation on @DefaultLocale and @DefaultTimeZone.
- Since:
- 0.2
- See Also:
-
Required Element Summary
Required Elements
-
Element Details
-
value
String valueThe ID for aTimeZone, either an abbreviation such as "PST", a full name such as "America/Los_Angeles", or a custom ID such as "GMT-8:00". Note that the support of abbreviations is for JDK 1.1.x compatibility only and full names should be used.
-