ScopeContainer extends AbstractContainer { public Supplier<Scope>[] collectScope(BindInfo<?> bindInfo) { if (bindInfo == null) { return null; } DefaultBindInfoProviderAdapter<?> adapter = (DefaultBindInfoProviderAdapter<?>) bindInfo; Supplier<Scope>[] scopeProvider = adapter.getCustomerScopeProvider(); if (scopeProvider != null) { return scopeProvider; } Class<?> sourceType = adapter.getSourceType(); if (sourceType == null) { sourceType = adapter.getBindType(); } return collectScope(ContainerUtils.findImplClass(sourceType)); } 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 scopTest2() { SpiCallerContainer spiCallerContainer = new SpiCallerContainer(); ScopeContainer scopeContainer = new ScopeContainer(spiCallerContainer); spiCallerContainer.init(); scopeContainer.init(); try { scopeContainer.collectScope(AnnoMyBean.class); assert false; } catch (IllegalStateException e) { assert e.getMessage().equals("the scope " + My.class.getName() + " undefined."); } }
@Test public void scopTest7() { SpiCallerContainer spiCallerContainer = new SpiCallerContainer(); ScopeContainer scopeContainer = new ScopeContainer(spiCallerContainer); assert scopeContainer.collectScope((Class<?>) null) == null; }