ScopeContainer extends AbstractContainer { public Supplier<Scope> findScope(String scopeName) { return this.scopeMapping.get(scopeName); } ScopeContainer(SpiCallerContainer spiContainer); Supplier<T> registerAlias(String scopeName, String aliasName); Supplier<T> registerScope(String scopeName, Scope scopeInstance); Supplier<T> registerScopeProvider(String scopeName, Supplier<T> scopeProvider); Supplier<Scope> findScope(String scopeName); Supplier<Scope>[] collectScope(BindInfo<?> bindInfo); Supplier<Scope>[] collectScope(Class<?> targetType); boolean isSingleton(BindInfo<?> bindInfo); boolean isSingleton(Class<?> targetType);  }
@Test public void scopTest1() { SpiCallerContainer spiCallerContainer = new SpiCallerContainer(); ScopeContainer scopeContainer = new ScopeContainer(spiCallerContainer); spiCallerContainer.init(); try { spiCallerContainer.init(); assert false; } catch (Exception e) { assert "the Container has been inited.".equals(e.getMessage()); } assert scopeContainer.findScope(javax.inject.Singleton.class.getName()) == null; assert scopeContainer.findScope(net.hasor.core.Singleton.class.getName()) == null; assert scopeContainer.findScope(net.hasor.core.Prototype.class.getName()) == null; scopeContainer.init(); assert scopeContainer.findScope(javax.inject.Singleton.class.getName()) != null; assert scopeContainer.findScope(net.hasor.core.Singleton.class.getName()) != null; assert scopeContainer.findScope(net.hasor.core.Prototype.class.getName()) != null; scopeContainer.close(); }