Class RestClientProducer
java.lang.Object
org.wildfly.testing.junit.extension.RestClientProducer
- All Implemented Interfaces:
ServerResourceProducer
Produces
Client (Jakarta REST Client) instances for injection into test fields and parameters.
The Client is obtained from ServerContext and shared across all tests for the server lifecycle.- Author:
- James R. Perkins
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanInject(ExtensionContext context, Class<?> clazz, Annotation... annotations) Indicates the type can be produced from this producer.produce(ExtensionContext context, Class<?> clazz, Annotation... annotations) Creates the object which can be injected into a static field, an instance field or a parameter.
-
Constructor Details
-
RestClientProducer
public RestClientProducer()
-
-
Method Details
-
canInject
Description copied from interface:ServerResourceProducerIndicates the type can be produced from this producer.- Specified by:
canInjectin interfaceServerResourceProducer- Parameters:
context- the current extension contextclazz- the type to checkannotations- the annotations, if any, for the field or parameter- Returns:
trueif this producer can create this type, otherwisefalse
-
produce
public Object produce(ExtensionContext context, Class<?> clazz, Annotation... annotations) throws IllegalArgumentException Description copied from interface:ServerResourceProducerCreates the object which can be injected into a static field, an instance field or a parameter.- Specified by:
producein interfaceServerResourceProducer- Parameters:
context- the current extension contextclazz- the type of the field or parameterannotations- the annotations, if any, for the field or parameter- Returns:
- the newly constructed object or
nullif it could not be produced - Throws:
IllegalArgumentException- if the type cannot be assigned to the type this producer can produce
-