Annotation Type UseGuiceyApp


  • @Retention(RUNTIME)
    @Target(TYPE)
    public @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 GuiceyConfigurationHook annotated with EnableHook - hook from field will be registered
    • ClientSupport annotated with InjectClient field 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:
    InjectClient
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      java.lang.Class<? extends io.dropwizard.Application> value  
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String config  
      ConfigOverride[] configOverride  
      java.lang.Class<? extends GuiceyConfigurationHook>[] hooks
      Hooks provide access to guice builder allowing complete customization of application context in tests.
    • Element Detail

      • value

        java.lang.Class<? extends io.dropwizard.Application> value
        Returns:
        application class
      • config

        java.lang.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

        java.lang.Class<? extends GuiceyConfigurationHook>[] hooks
        Hooks 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 info, EnableHook
        Default:
        {}