Class TestTime


  • public class TestTime
    extends java.lang.Object
    Sets 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.
    The default sits in the middle of that window. A VEE Port whose backend rejects it can move it with the "date" property, within the same bounds.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DATE_PROPERTY
      Property overriding the date the suite runs at, as YYYY-MM-DD.
      static java.lang.String DEFAULT_DATE
      The date the suite runs at unless "date" says otherwise.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void setUp()
      Sets the application time to the configured date.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DATE_PROPERTY

        public static final java.lang.String DATE_PROPERTY
        Property overriding the date the suite runs at, as YYYY-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.Util at all.

        Throws:
        java.lang.IllegalStateException - if "date" is not a YYYY-MM-DD date