@Test public void testDestroy() throws Exception { final MockRealm mockRealm = createMock(MockRealm.class); final MyDestroyable myDestroyable = createMock(MyDestroyable.class); myDestroyable.destroy(); replay(myDestroyable); final ShiroModule shiroModule = new ShiroModule() { @Override protected void configureShiro() { bindRealm().to(MockRealm.class); bind(MyDestroyable.class).toInstance(myDestroyable); expose(MyDestroyable.class); } @Provides public MockRealm createRealm() { return mockRealm; } }; Injector injector = Guice.createInjector(shiroModule); injector.getInstance(MyDestroyable.class); shiroModule.destroy(); verify(myDestroyable); }
public final void destroy() { for (Destroyable destroyable : destroyables) { try { destroyable.destroy(); } catch(Exception e) { log.warn("Error destroying component class: " + destroyable.getClass(), e); } } }
ShiroModule extends PrivateModule implements Destroyable { public final void destroy() { for (Destroyable destroyable : destroyables) { try { destroyable.destroy(); } catch(Exception e) { log.warn("Error destroying component class: " + destroyable.getClass(), e); } } } }
ShiroModule extends PrivateModule implements Destroyable { public final void destroy() { for (Destroyable destroyable : destroyables) { try { destroyable.destroy(); } catch(Exception e) { log.warn("Error destroying component class: " + destroyable.getClass(), e); } } }  }
ShiroModule extends PrivateModule implements Destroyable { public final void destroy() { for (Destroyable destroyable : destroyables) { try { destroyable.destroy(); } catch(Exception e) { log.warn("Error destroying component class: " + destroyable.getClass(), e); } } }  void configure(); final void destroy(); void add(Destroyable destroyable); }
ShiroModule extends PrivateModule implements Destroyable { public final void destroy() { for (Destroyable destroyable : destroyables) { try { destroyable.destroy(); } catch(Exception e) { log.warn("Error destroying component class: " + destroyable.getClass(), e); } } }  void configure(); final void destroy(); void add(Destroyable destroyable);  }