Annotation Interface UseGuiceyApp
Guicey spock extension. Starts guice context only (without web part).
Managed
objects will be still executed correctly. Guice injectior is created before all tests in class and shut down
after them.
Gucie injections will work on test class (just annotate required fields with Inject.
Shared may be used to define common injection points for all tests in class.
Note: setupSpec() fixture is called after application start and cleanupSpec() before
application tear down.
Extension would also recognize the following test fields (including super classes):
- static
GuiceyConfigurationHookannotated withEnableHook- hook from field will be registered ClientSupportannotated withInjectClientfield will be injected with client instance. Note that only generic client may be used (to call 3rd party external services), as application's web part is not started.
Internally based on DropwizardTestSupport.
- Since:
- 02.01.2015
- See Also:
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionClass<? extends ru.vyarus.dropwizard.guice.hook.GuiceyConfigurationHook>[]Hooks provide access to guice builder allowing complete customization of application context in tests.
-
Element Details
-
value
Class<? extends io.dropwizard.core.Application> value- Returns:
- application class
-
-
-
config
String config- Returns:
- path to configuration file (optional)
- Default:
- ""
-
configOverride
ConfigOverride[] configOverride- Returns:
- list of overridden configuration values (may be used even without real configuration)
- Default:
- {}
-
hooks
Class<? extends ru.vyarus.dropwizard.guice.hook.GuiceyConfigurationHook>[] hooksHooks provide access to guice builder allowing complete customization of application context in tests.Additional hooks could be declared in static test fields:
@EnableHook static GuiceyConfigurationHook HOOK = { it.disableExtensions(Something.class)}.- Returns:
- list of hooks to use
- See Also:
-
for more infoEnableHook
- Default:
- {}
-