Class RunResult<C extends io.dropwizard.core.Configuration>

java.lang.Object
ru.vyarus.dropwizard.guice.test.util.RunResult<C>
Type Parameters:
C - configuration type

public class RunResult<C extends io.dropwizard.core.Configuration> extends Object
Application run result object for TestSupport runs. It is important to construct this object in time of running application because it would be impossible to reference these objects after application shutdown.

Object supposed to be used for assertions after the application stopped.

Since:
24.11.2023
  • Constructor Details

    • RunResult

      public RunResult(io.dropwizard.testing.DropwizardTestSupport<C> support, com.google.inject.Injector injector)
      Create result.
      Parameters:
      support - dropwizard test support
      injector - injector
  • Method Details

    • getSupport

      public io.dropwizard.testing.DropwizardTestSupport<C> getSupport()
      Returns:
      support object used for application run
    • getInjector

      public com.google.inject.Injector getInjector()
      Returns:
      injector, created during application run
    • getApplication

      public <T extends io.dropwizard.core.Application<C>> T getApplication()
      Type Parameters:
      T - application type
      Returns:
      application instance (used for run)
    • getEnvironment

      public io.dropwizard.core.setup.Environment getEnvironment()
      Returns:
      environment instance (used for run)
    • getConfiguration

      public C getConfiguration()
      Returns:
      configuration instance
    • getBean

      public <T> T getBean(Class<T> type)
      Access guice bean.
      Type Parameters:
      T - target type
      Parameters:
      type - bean type
      Returns:
      bean instance or null
    • getBean

      public <T> T getBean(com.google.inject.Key<T> key)
      Access guice bean by mapping key (for qualified or generified bindings).
      Type Parameters:
      T - target type
      Parameters:
      key - bean key
      Returns:
      bean instance
    • isWebRun

      public boolean isWebRun()
      Returns:
      true for full web app run, false for core run (guice injector only)