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 for
TestSupport.build(Class) builder. Listener works only when
builder run method used! Useful for test-specific setup and cleanup. Note that
GuiceyTestSupport extends
DropwizardTestSupport. 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 TestSupport utility methods if something guice-related is
required. To access web client use TestSupport.getContextClient()
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidCalled after application shutdown (including startup error case).default voidAn application started, but test logic was not executed yet.default voidCalled before application startup.default voidCalled after test action (or after exception during action execution), but before application shutdown.
-
Method Details
-
setup
Called before application startup.- Parameters:
support- initialized support object (not started)- Throws:
Exception- any errors pass through
-
run
default void run(io.dropwizard.testing.DropwizardTestSupport<C> support, com.google.inject.Injector injector) throws 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:
Exception- any errors pass through
-
stop
default void stop(io.dropwizard.testing.DropwizardTestSupport<C> support, com.google.inject.Injector injector) throws 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:
Exception- any errors pass through
-
cleanup
Called after application shutdown (including startup error case).- Parameters:
support- stopped support object- Throws:
Exception- any errors pass through
-