Class DropwizardTestSupport<C extends Configuration>

  • Type Parameters:
    C - the configuration type

    public class DropwizardTestSupport<C extends Configuration>
    extends Object
    A test support class for starting and stopping your application at the start and end of a test class.

    By default, the Application will be constructed using reflection to invoke the nullary constructor. If your application does not provide a public nullary constructor, you will need to override the newApplication() method to provide your application instance(s).

    • Constructor Detail

      • DropwizardTestSupport

        public DropwizardTestSupport​(Class<? extends Application<C>> applicationClass,
                                     @Nullable String configPath,
                                     @Nullable String customPropertyPrefix,
                                     ConfigOverride... configOverrides)
        Since:
        2.0
      • DropwizardTestSupport

        public DropwizardTestSupport​(Class<? extends Application<C>> applicationClass,
                                     C configuration)
        Alternative constructor that may be used to directly provide Configuration to use, instead of specifying resource path for locating data to create Configuration.
        Parameters:
        applicationClass - Type of Application to create
        configuration - Pre-constructed configuration object caller provides; will not be manipulated in any way, no overriding
        Since:
        0.9
      • DropwizardTestSupport

        public DropwizardTestSupport​(Class<? extends Application<C>> applicationClass,
                                     @Nullable C configuration,
                                     Function<Application<C>,​Command> commandInstantiator)
        Alternate constructor that allows specifying the command the Dropwizard application is started with.
        Parameters:
        applicationClass - Type of Application to create
        configuration - Pre-constructed configuration object caller provides; will not be manipulated in any way, no overriding
        commandInstantiator - The Function used to instantiate the Command used to start the Application
        Since:
        1.1.0