Package com.microej.crypto.test.util
Class TestTime
- java.lang.Object
-
- com.microej.crypto.test.util.TestTime
-
public class TestTime extends java.lang.ObjectSets the application time to a date at which every certificate of the test material behaves as its test expects.A target whose clock is not set boots in 1970, which is outside the validity window of every certificate the suite loads, so the certificate tests fail for a reason that has nothing to do with the backend. Each test class that loads a certificate calls
setUp()before its first test.The date has to satisfy every certificate at once, which leaves one window:
- after November 2023, the earliest a certificate the suite expects to be valid becomes valid;
- before November 2053, when the certificate the suite expects to be not yet valid becomes valid;
- after January 2020, so that the two deliberately expired certificates of the certification path are expired.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDATE_PROPERTYProperty overriding the date the suite runs at, asYYYY-MM-DD.static java.lang.StringDEFAULT_DATEThe date the suite runs at unless "date" says otherwise.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidsetUp()Sets the application time to the configured date.
-
-
-
Field Detail
-
DATE_PROPERTY
public static final java.lang.String DATE_PROPERTY
Property overriding the date the suite runs at, asYYYY-MM-DD.- See Also:
- Constant Field Values
-
DEFAULT_DATE
public static final java.lang.String DEFAULT_DATE
The date the suite runs at unless "date" says otherwise.- See Also:
- Constant Field Values
-
-
Method Detail
-
setUp
public static void setUp()
Sets the application time to the configured date.Does nothing when the platform does not let the application set its time, and the tests then run at the current time of the platform. A VEE Port can refuse: on Linux, setting the system clock needs a privilege the run may not have. A plain JVM has no
ej.bon.Utilat all.- Throws:
java.lang.IllegalStateException- if "date" is not aYYYY-MM-DDdate
-
-