Annotation Interface OnlyRunWhen


@Target(TYPE) @Retention(RUNTIME) @Inherited public @interface OnlyRunWhen
This annotation is used to specify which tests should be run based on the backing services that are selected.

If the backing service is not selected the test class will be entirely skipped, including all test methods and any setup/teardown methods.

Any @Inject annotated fields will not be injected if the test class is skipped, allowing you to inject backing services that are only available in certain environments without causing test failures in other environments.

When using this annotation, the test class must use a Saga test runner, e.g. FullFlowExtensionIntegrationRunner or FullFlowExtensionComponentRunner.

If multiple of a single type of backing service is specified on the test class, the test will run if any of the specified backing services are selected.

If multiple different types of backing services are specified on the test class, the test will only run if all the specified backing services are selected.

Specifying an empty array for any of the backing service types will cause the test to run regardless of the availability of that backing service type.

  • Element Details

    • unboundedStorageType

      Returns:
      the unbounded storage types that must be selected for the test to run
      Default:
      {}
    • boundedStorageType

      Returns:
      the bounded storage types that must be selected for the test to run
      Default:
      {}
    • indexType

      Returns:
      the index types that must be selected for the test to run
      Default:
      {}
    • queueingType

      Returns:
      the queueing types that must be selected for the test to run
      Default:
      {}
    • coordinatorType

      Returns:
      the coordinator types that must be selected for the test to run
      Default:
      {}
    • sqlVendor

      DialectType[] sqlVendor
      Returns:
      the SQL vendors that must be selected for the test to run
      Default:
      {}
    • sqlOnly

      boolean sqlOnly
      Returns:
      true if the test should only run in SQL_ONLY mode
      Default:
      false