@Test public void bundle_binds_work() { final Bundle bundle = mock(Bundle.class); final Class<TestBundle> bundleClass = TestBundle.class; Injector injector = Guice.createInjector(new AbstractPlugin() { @Override protected void configure() { bindBundle(bundle); bindBundle(bundleClass); } }); Set<Bundle> bundleSet = injector.getInstance(Keys.Bundles); Set<Class<? extends Bundle>> bundleClassSet = injector.getInstance(Keys.BundleClasses); assertThat(bundleSet, hasSize(1)); assertThat(bundleSet, hasItem(bundle)); assertThat(bundleClassSet, hasSize(1)); assertThat(bundleClassSet, hasItem(TestBundle.class)); }
protected void bindBundle(Bundle bundle) { Preconditions.checkNotNull(bundle, "Bundle cannot be null."); buildBinders(); bundleBinder.addBinding().toInstance(bundle); }
AbstractPlugin extends AbstractModule implements Plugin { protected void bindBundle(Bundle bundle) { Preconditions.checkNotNull(bundle, "Bundle cannot be null."); buildBinders(); bundleBinder.addBinding().toInstance(bundle); } }
AbstractPlugin extends AbstractModule implements Plugin { protected void bindBundle(Bundle bundle) { Preconditions.checkNotNull(bundle, "Bundle cannot be null."); buildBinders(); bundleBinder.addBinding().toInstance(bundle); }  }
AbstractPlugin extends AbstractModule implements Plugin { protected void bindBundle(Bundle bundle) { Preconditions.checkNotNull(bundle, "Bundle cannot be null."); buildBinders(); bundleBinder.addBinding().toInstance(bundle); }   }
AbstractPlugin extends AbstractModule implements Plugin { protected void bindBundle(Bundle bundle) { Preconditions.checkNotNull(bundle, "Bundle cannot be null."); buildBinders(); bundleBinder.addBinding().toInstance(bundle); }    }