C
- configuration typepublic class GuiceyAppRule<C extends io.dropwizard.Configuration>
extends org.junit.rules.ExternalResource
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).
Based on DropwizardAppRule
, but doesn't start jetty and as a consequence
jersey and guice web modules not initialized. Emulates managed objects lifecycle.
Suppose to be used for testing internal services business logic as lightweight alternative for dropwizard rule.
Constructor and Description |
---|
GuiceyAppRule(java.lang.Class<? extends io.dropwizard.Application<C>> applicationClass,
java.lang.String configPath,
io.dropwizard.testing.ConfigOverride... configOverrides) |
Modifier and Type | Method and Description |
---|---|
protected void |
after() |
protected void |
before() |
<A extends io.dropwizard.Application<C>> |
getApplication() |
<T> T |
getBean(java.lang.Class<T> type) |
C |
getConfiguration() |
io.dropwizard.setup.Environment |
getEnvironment() |
com.google.inject.Injector |
getInjector() |
protected io.dropwizard.Application<C> |
newApplication() |
public GuiceyAppRule(java.lang.Class<? extends io.dropwizard.Application<C>> applicationClass, @Nullable java.lang.String configPath, io.dropwizard.testing.ConfigOverride... configOverrides)
public C getConfiguration()
public <A extends io.dropwizard.Application<C>> A getApplication()
public io.dropwizard.setup.Environment getEnvironment()
public com.google.inject.Injector getInjector()
public <T> T getBean(java.lang.Class<T> type)
protected io.dropwizard.Application<C> newApplication()
protected void before() throws java.lang.Throwable
before
in class org.junit.rules.ExternalResource
java.lang.Throwable
protected void after()
after
in class org.junit.rules.ExternalResource