Class GuiceyAppRule<C extends io.dropwizard.Configuration>

  • Type Parameters:
    C - configuration type
    All Implemented Interfaces:
    org.junit.rules.TestRule

    @Deprecated
    public class GuiceyAppRule<C extends io.dropwizard.Configuration>
    extends org.junit.rules.ExternalResource
    Deprecated.
    use junit 5 extension TestGuiceyApp
    A JUnit rule for starting and stopping your guice application at the start and end of a test class.

    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.

    Since:
    23.10.2014
    • Constructor Summary

      Constructors 
      Constructor Description
      GuiceyAppRule​(java.lang.Class<? extends io.dropwizard.Application<C>> applicationClass, java.lang.String configPath, io.dropwizard.testing.ConfigOverride... configOverrides)
      Deprecated.
       
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      protected void after()
      Deprecated.
       
      protected void before()
      Deprecated.
       
      <A extends io.dropwizard.Application<C>>
      A
      getApplication()
      Deprecated.
       
      <T> T getBean​(java.lang.Class<T> type)
      Deprecated.
       
      C getConfiguration()
      Deprecated.
       
      io.dropwizard.setup.Environment getEnvironment()
      Deprecated.
       
      com.google.inject.Injector getInjector()
      Deprecated.
       
      protected io.dropwizard.Application<C> newApplication()
      Deprecated.
       
      • Methods inherited from class org.junit.rules.ExternalResource

        apply
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GuiceyAppRule

        public GuiceyAppRule​(java.lang.Class<? extends io.dropwizard.Application<C>> applicationClass,
                             @Nullable
                             java.lang.String configPath,
                             io.dropwizard.testing.ConfigOverride... configOverrides)
        Deprecated.
    • Method Detail

      • getConfiguration

        public C getConfiguration()
        Deprecated.
      • getApplication

        public <A extends io.dropwizard.Application<C>> A getApplication()
        Deprecated.
      • getEnvironment

        public io.dropwizard.setup.Environment getEnvironment()
        Deprecated.
      • getInjector

        public com.google.inject.Injector getInjector()
        Deprecated.
      • getBean

        public <T> T getBean​(java.lang.Class<T> type)
        Deprecated.
      • newApplication

        protected io.dropwizard.Application<C> newApplication()
        Deprecated.
      • before

        protected void before()
                       throws java.lang.Throwable
        Deprecated.
        Overrides:
        before in class org.junit.rules.ExternalResource
        Throws:
        java.lang.Throwable
      • after

        protected void after()
        Deprecated.
        Overrides:
        after in class org.junit.rules.ExternalResource