Annotation Type FailAt


  • @Retention(RUNTIME)
    @Target({METHOD,TYPE})
    @Inherited
    @ExtendWith(FailAtExtension.class)
    public @interface FailAt
    @FailAt is a JUnit Jupiter extension to mark tests that shouldn't be executed after a given date, essentially failing a test when the date is reached. The date is given as an ISO 8601 string.

    It may optionally be declared with a reason to document why the annotated test class or test method should fail at the given date.

    @FailAt can be used on the method and class level. It can only be used once per method or class, but is inherited from higher-level containers.

    WARNING: This annotation allows the user to move an assumption out of one or multiple test method's code into an annotation. But this comes at a cost: Applying @FailAt can make the test suite non-reproducible. If a passing test is run again after the specified date, that build would fail. A report entry is issued for every test that does not fail until a certain date.

    Since:
    2.3.0
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      java.lang.String date
      The date from which this annotated test class or test method should fail as an ISO 8601 string in the format yyyy-MM-dd, e.g.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String reason
      The reason this annotated test class or test method should fail as soon as the given date is reached.
    • Element Detail

      • date

        java.lang.String date
        The date from which this annotated test class or test method should fail as an ISO 8601 string in the format yyyy-MM-dd, e.g. 2023-05-28. The test will be executed regularly if that date is not yet reached.
      • reason

        java.lang.String reason
        The reason this annotated test class or test method should fail as soon as the given date is reached.
        Default:
        ""