@Target(value={METHOD,TYPE})
@Retention(value=RUNTIME)
@ExtendWith(value=org.junitpioneer.jupiter.DefaultTimeZoneExtension.class)
public @interface 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. 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
.
TimeZone.getDefault()
,
DefaultLocale
Modifier and Type | Required Element and Description |
---|---|
java.lang.String |
value
The ID for a
TimeZone , either an abbreviation such as "PST", a
full name such as "America/Los_Angeles", or a custom ID such as
"GMT-8:00". |
public abstract java.lang.String value
TimeZone
, 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.