Class World

  • All Implemented Interfaces:
    com.google.inject.Module

    public class World
    extends com.google.inject.AbstractModule
    Holder of the Guice world for running tests. Singleton.

    Hides the details of how a Guice injector is created.

    In this test harness, Guice has two important scopes. One is the singleton scope that lives for the entire duration of the VM (thus covering all the tests that are run.) This is the Singleton scope. The other scope is TestScope, which is for each test case that runs.

    Author:
    Kohsuke Kawaguchi
    • Method Detail

      • getInjector

        public com.google.inject.Injector getInjector()
      • startTestScope

        public void startTestScope​(String testName)
        Call this method when a new test starts, to reset the TestScope.
      • endTestScope

        public void endTestScope()
      • configure

        protected void configure()
        Overrides:
        configure in class com.google.inject.AbstractModule
      • get

        public static World get()