Annotation Type SetSystemProperty


@SetSystemProperty is a JUnit Jupiter extension to set the value of a system property for a test execution.

The key and value of the system property to be set must be specified via key() and value(). After the annotated method has been executed, the original value or the value of the higher-level container is restored.

SetSystemProperty can be used on the method and on the class level. It is repeatable and inherited from higher-level containers. If a class is annotated, the configured property will be set before every test inside that class. Any method-level configurations will override the class-level configurations.

During parallel test execution, all tests annotated with ClearSystemProperty, SetSystemProperty, ReadsSystemProperty, and WritesSystemProperty are scheduled in a way that guarantees correctness under mutation of shared global state.

For more details and examples, see the documentation on @ClearSystemProperty and @SetSystemProperty.

Since:
0.5
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static @interface 
    Containing annotation of repeatable @SetSystemProperty.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The key of the system property to be set.
    The value of the system property to be set.
  • Element Details

    • key

      String key
      The key of the system property to be set.
    • value

      String value
      The value of the system property to be set.