Class QuarkusComponentTestExtensionBuilder

java.lang.Object
io.quarkus.test.component.QuarkusComponentTestExtensionBuilder

public class QuarkusComponentTestExtensionBuilder extends Object
Convenient builder for QuarkusComponentTestExtension.
  • Field Details

    • DEFAULT_CONFIG_SOURCE_ORDINAL

      public static final int DEFAULT_CONFIG_SOURCE_ORDINAL
      By default, test config properties take precedence over system properties (400), ENV variables (300) and application.properties (250)
      See Also:
  • Constructor Details

    • QuarkusComponentTestExtensionBuilder

      public QuarkusComponentTestExtensionBuilder()
  • Method Details

    • addComponentClasses

      public QuarkusComponentTestExtensionBuilder addComponentClasses(Class<?>... componentClasses)
      The initial set of components under test is derived from the test class. The types of all fields annotated with Inject are considered the component types.
      Parameters:
      componentClasses -
      Returns:
      self
      See Also:
    • configProperty

      public QuarkusComponentTestExtensionBuilder configProperty(String key, String value)
      Set a configuration property for the test.
      Parameters:
      key -
      value -
      Returns:
      self
    • useDefaultConfigProperties

      public QuarkusComponentTestExtensionBuilder useDefaultConfigProperties()
      Use the default values for missing config properties. By default, a missing config property results in a test failure.

      For primitives the default values as defined in the JLS are used. For any other type null is injected.

      Returns:
      self
    • ignoreNestedClasses

      public QuarkusComponentTestExtensionBuilder ignoreNestedClasses()
      Ignore the static nested classes declared on the test class.

      By default, all static nested classes declared on the test class are added to the set of additional components under test.

      Returns:
      self
    • setConfigSourceOrdinal

      public QuarkusComponentTestExtensionBuilder setConfigSourceOrdinal(int val)
      Set the ordinal of the config source used for all test config properties. By default, 500 is used.
      Parameters:
      val -
      Returns:
      self
    • addAnnotationsTransformer

      public QuarkusComponentTestExtensionBuilder addAnnotationsTransformer(AnnotationsTransformer transformer)
      Add an additional AnnotationsTransformer.
      Parameters:
      transformer -
      Returns:
      self
    • mock

      public <T> MockBeanConfigurator<T> mock(Class<T> beanClass)
      Configure a new mock of a bean.

      Note that a mock is created automatically for all unsatisfied dependencies in the test. This API provides full control over the bean attributes. The default values are derived from the bean class.

      Parameters:
      beanClass -
      Returns:
      a new mock bean configurator
      See Also:
    • build

      Returns:
      a new extension instance
    • registerMockBean

      void registerMockBean(MockBeanConfiguratorImpl<?> mock)