Interface TestSupportBuilder.TestListener<C extends io.dropwizard.core.Configuration>
-
- Type Parameters:
C- configuration type
- Enclosing class:
- TestSupportBuilder<C extends io.dropwizard.core.Configuration>
public static interface TestSupportBuilder.TestListener<C extends io.dropwizard.core.Configuration>Listener forTestSupport.build(Class)builder. Listener works only when builder run method used! Useful for test-specific setup and cleanup. Note thatGuiceyTestSupportextendsDropwizardTestSupport. Guicey support object does not provide any useful methods (in context of the builder), so it is appropriate to always use dropwizard support object.See
TestSupportutility methods if something guice-related is required. To access web client useTestSupport.getContextClient()
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default voidcleanup(io.dropwizard.testing.DropwizardTestSupport<C> support)Called after application shutdown (including startup error case).default voidrun(io.dropwizard.testing.DropwizardTestSupport<C> support, com.google.inject.Injector injector)An application started, but test logic was not executed yet.default voidsetup(io.dropwizard.testing.DropwizardTestSupport<C> support)Called before application startup.default voidstop(io.dropwizard.testing.DropwizardTestSupport<C> support, com.google.inject.Injector injector)Called after test action (or after exception during action execution), but before application shutdown.
-
-
-
Method Detail
-
setup
default void setup(io.dropwizard.testing.DropwizardTestSupport<C> support) throws java.lang.Exception
Called before application startup.- Parameters:
support- initialized support object (not started)- Throws:
java.lang.Exception- any errors pass through
-
run
default void run(io.dropwizard.testing.DropwizardTestSupport<C> support, com.google.inject.Injector injector) throws java.lang.Exception
An application started, but test logic was not executed yet. Will not be called in case of application startup error.ClientSupportweb client could be accessed withTestSupport.getContextClient().- Parameters:
support- started support objectinjector- injector instance- Throws:
java.lang.Exception- any errors pass through
-
stop
default void stop(io.dropwizard.testing.DropwizardTestSupport<C> support, com.google.inject.Injector injector) throws java.lang.Exception
Called after test action (or after exception during action execution), but before application shutdown.ClientSupportweb client could be accessed withTestSupport.getContextClient().- Parameters:
support- still started suport objectinjector- injector instance- Throws:
java.lang.Exception- any errors pass through
-
cleanup
default void cleanup(io.dropwizard.testing.DropwizardTestSupport<C> support) throws java.lang.Exception
Called after application shutdown (including startup error case).- Parameters:
support- stopped support object- Throws:
java.lang.Exception- any errors pass through
-
-