Class UriProducer

java.lang.Object
org.wildfly.testing.junit.extension.UriProducer
All Implemented Interfaces:
ServerResourceProducer

@MetaInfServices public class UriProducer extends Object implements ServerResourceProducer
Produces URI instances for injection into test fields and parameters. The URI is resolved from the deployed application's base URI, optionally combined with a RequestPath qualifier.
Author:
James R. Perkins
  • Constructor Details

    • UriProducer

      public UriProducer()
  • Method Details

    • canInject

      public boolean canInject(ExtensionContext context, Class<?> clazz, Annotation... annotations)
      Description copied from interface: ServerResourceProducer
      Indicates the type can be produced from this producer.
      Specified by:
      canInject in interface ServerResourceProducer
      Parameters:
      context - the current extension context
      clazz - the type to check
      annotations - the annotations, if any, for the field or parameter
      Returns:
      true if this producer can create this type, otherwise false
    • produce

      public Object produce(ExtensionContext context, Class<?> clazz, Annotation... annotations) throws IllegalArgumentException
      Description copied from interface: ServerResourceProducer
      Creates the object which can be injected into a static field, an instance field or a parameter.
      Specified by:
      produce in interface ServerResourceProducer
      Parameters:
      context - the current extension context
      clazz - the type of the field or parameter
      annotations - the annotations, if any, for the field or parameter
      Returns:
      the newly constructed object or null if it could not be produced
      Throws:
      IllegalArgumentException - if the type cannot be assigned to the type this producer can produce