@Test @SuppressWarnings("unchecked") public void testDestroy() { ParameterizedCommand<StunnerPreferences> completeCallback = mock(ParameterizedCommand.class); ParameterizedCommand<Throwable> errorCallback = mock(ParameterizedCommand.class); sessionLoader.load(metadata, completeCallback, errorCallback); sessionLoader.destroy(); verify(initializer, atLeastOnce()).destroy(); verify(initializerInstances, times(1)).destroyAll(); assertTrue(sessionLoader.getInitializers().isEmpty()); }
public void destroy() { initializers.forEach(SessionInitializer::destroy); initializers.clear(); initializerInstances.destroyAll(); }
SessionLoader { public void destroy() { initializers.forEach(SessionInitializer::destroy); initializers.clear(); initializerInstances.destroyAll(); } }
SessionLoader { public void destroy() { initializers.forEach(SessionInitializer::destroy); initializers.clear(); initializerInstances.destroyAll(); } @Inject  SessionLoader(final DefinitionUtils definitionUtils,
                         final StunnerPreferencesRegistryLoader preferencesRegistryLoader,
                         final @Any ManagedInstance<SessionInitializer> beanInstances); }
SessionLoader { public void destroy() { initializers.forEach(SessionInitializer::destroy); initializers.clear(); initializerInstances.destroyAll(); } @Inject  SessionLoader(final DefinitionUtils definitionUtils,
                         final StunnerPreferencesRegistryLoader preferencesRegistryLoader,
                         final @Any ManagedInstance<SessionInitializer> beanInstances); void load(final Metadata metadata,
                     final ParameterizedCommand<StunnerPreferences> completeCallback,
                     final ParameterizedCommand<Throwable> errorCallback); void destroy(); }
SessionLoader { public void destroy() { initializers.forEach(SessionInitializer::destroy); initializers.clear(); initializerInstances.destroyAll(); } @Inject  SessionLoader(final DefinitionUtils definitionUtils,
                         final StunnerPreferencesRegistryLoader preferencesRegistryLoader,
                         final @Any ManagedInstance<SessionInitializer> beanInstances); void load(final Metadata metadata,
                     final ParameterizedCommand<StunnerPreferences> completeCallback,
                     final ParameterizedCommand<Throwable> errorCallback); void destroy();  }