Package io.quarkus.test.component
Class QuarkusComponentTestExtensionBuilder
- java.lang.Object
-
- io.quarkus.test.component.QuarkusComponentTestExtensionBuilder
-
public class QuarkusComponentTestExtensionBuilder extends Object
Convenient builder forQuarkusComponentTestExtension.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_CONFIG_SOURCE_ORDINALBy default, test config properties take precedence over system properties (400), ENV variables (300) and application.properties (250)
-
Constructor Summary
Constructors Constructor Description QuarkusComponentTestExtensionBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QuarkusComponentTestExtensionBuilderaddAnnotationsTransformer(AnnotationsTransformer transformer)Add an additionalAnnotationsTransformer.QuarkusComponentTestExtensionBuilderaddComponentClasses(Class<?>... componentClasses)The initial set of components under test is derived from the test class.QuarkusComponentTestExtensionbuild()QuarkusComponentTestExtensionBuilderconfigProperty(String key, String value)Set a configuration property for the test.QuarkusComponentTestExtensionBuilderignoreNestedClasses()Ignore the static nested classes declared on the test class.<T> MockBeanConfigurator<T>mock(Class<T> beanClass)Configure a new mock of a bean.(package private) voidregisterMockBean(MockBeanConfiguratorImpl<?> mock)QuarkusComponentTestExtensionBuildersetConfigSourceOrdinal(int val)Set the ordinal of the config source used for all test config properties.QuarkusComponentTestExtensionBuilderuseDefaultConfigProperties()Use the default values for missing config properties.
-
-
-
Field Detail
-
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:
setConfigSourceOrdinal(int), Constant Field Values
-
-
Method Detail
-
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 withInjectare considered the component types.- Parameters:
componentClasses-- Returns:
- self
- See Also:
ignoreNestedClasses()
-
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
nullis 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 additionalAnnotationsTransformer.- 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:
MockBeanConfigurator.create(Function)
-
build
public QuarkusComponentTestExtension build()
- Returns:
- a new extension instance
-
registerMockBean
void registerMockBean(MockBeanConfiguratorImpl<?> mock)
-
-