ScopeContainer extends AbstractContainer { public <T extends Scope> Supplier<T> registerScope(String scopeName, Scope scopeInstance) { return this.registerScopeProvider(scopeName, (Supplier) InstanceProvider.of(scopeInstance)); } 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 scopTest11() { SpiCallerContainer spiCallerContainer = new SpiCallerContainer(); ScopeContainer scopeContainer = new ScopeContainer(spiCallerContainer); spiCallerContainer.init(); scopeContainer.init(); HashMap<String, Object> spiTest = new HashMap<>(); spiCallerContainer.addListener(ScopeProvisionListener.class, InstanceProvider.of((scopeName, scopeSupplier) -> { spiTest.put(scopeName, scopeSupplier.get()); })); Scope mockScope = PowerMockito.mock(Scope.class); scopeContainer.registerScope(My.class.getName(), mockScope); assert spiTest.size() == 1; assert spiTest.containsKey(My.class.getName()); }