@Test public void testEventListener() throws Exception { final MockRealm mockRealm = createMock(MockRealm.class); final EventBus eventBus = createMock(EventBus.class); eventBus.register(anyObject(MockEventListener1.class)); eventBus.register(anyObject(MockEventListener2.class)); replay(eventBus); final ShiroModule shiroModule = new ShiroModule() { @Override protected void configureShiro() { bindRealm().to(MockRealm.class); binder().bind(MockEventListener1.class).asEagerSingleton(); binder().bind(MockEventListener2.class).asEagerSingleton(); } @Override protected void bindEventBus(AnnotatedBindingBuilder<EventBus> bind) { bind.toInstance(eventBus); } @Provides public MockRealm createRealm() { return mockRealm; } }; Guice.createInjector(shiroModule); verify(eventBus); }
protected final LinkedBindingBuilder<Realm> bindRealm() { Multibinder<Realm> multibinder = Multibinder.newSetBinder(binder(), Realm.class); return multibinder.addBinding(); }
ShiroModule extends PrivateModule implements Destroyable { protected final LinkedBindingBuilder<Realm> bindRealm() { Multibinder<Realm> multibinder = Multibinder.newSetBinder(binder(), Realm.class); return multibinder.addBinding(); } }
ShiroModule extends PrivateModule implements Destroyable { protected final LinkedBindingBuilder<Realm> bindRealm() { Multibinder<Realm> multibinder = Multibinder.newSetBinder(binder(), Realm.class); return multibinder.addBinding(); }  }
ShiroModule extends PrivateModule implements Destroyable { protected final LinkedBindingBuilder<Realm> bindRealm() { Multibinder<Realm> multibinder = Multibinder.newSetBinder(binder(), Realm.class); return multibinder.addBinding(); }  void configure(); final void destroy(); void add(Destroyable destroyable); }
ShiroModule extends PrivateModule implements Destroyable { protected final LinkedBindingBuilder<Realm> bindRealm() { Multibinder<Realm> multibinder = Multibinder.newSetBinder(binder(), Realm.class); return multibinder.addBinding(); }  void configure(); final void destroy(); void add(Destroyable destroyable);  }