Class ResourceExtension

java.lang.Object
io.dropwizard.testing.junit5.ResourceExtension
All Implemented Interfaces:
DropwizardExtension

public class ResourceExtension extends Object implements DropwizardExtension
An extension for testing Jersey resources.
  • Method Details

    • builder

      public static ResourceExtension.Builder builder()
      Creates a new Jersey testing environment builder for ResourceExtension
      Returns:
      a new ResourceExtension.Builder
    • getValidator

      public jakarta.validation.Validator getValidator()
    • getObjectMapper

      public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
    • getClientConfigurator

      public Consumer<org.glassfish.jersey.client.ClientConfig> getClientConfigurator()
    • target

      public jakarta.ws.rs.client.WebTarget target(String path)
      Creates a web target to be sent to the resource under testing.
      Parameters:
      path - relative path (from tested application base URI) this web target should point to.
      Returns:
      the created JAX-RS web target.
    • client

      public jakarta.ws.rs.client.Client client()
      Returns the pre-configured Client for this test. For sending requests prefer target(String)
      Returns:
      the JerseyTest configured Client
    • getJerseyTest

      public org.glassfish.jersey.test.JerseyTest getJerseyTest()
      Returns the underlying JerseyTest. For sending requests prefer target(String).
      Returns:
      the underlying JerseyTest
    • before

      public void before() throws Throwable
      Description copied from interface: DropwizardExtension
      Executed before test method or class.
      Specified by:
      before in interface DropwizardExtension
      Throws:
      Throwable
    • after

      public void after() throws Throwable
      Description copied from interface: DropwizardExtension
      Executed after test method or class.
      Specified by:
      after in interface DropwizardExtension
      Throws:
      Throwable