ScopeImpl extends ScopeNode { @Override public synchronized Scope installTestModules(Module... modules) { if (hasTestModules) { throw new IllegalStateException("TestModules can only be installed once per scope."); } installModules(true, modules); hasTestModules = true; return this; } ScopeImpl(Object name); @Override T getInstance(Class<T> clazz); @Override T getInstance(Class<T> clazz, String name); @Override Provider<T> getProvider(Class<T> clazz); @Override Provider<T> getProvider(Class<T> clazz, String name); @Override Lazy<T> getLazy(Class<T> clazz); @Override Lazy<T> getLazy(Class<T> clazz, String name); @Override synchronized Scope installTestModules(Module... modules); @Override Scope installModules(Module... modules); @Override void inject(Object obj); @Override String toString(); @Override Scope openSubScope(Object subScopeName); @Override Scope openSubScope(Object subScopeName, ScopeConfig scopeConfig); @Override void release();  }
@Test(expected = IllegalStateException.class) public void installTestModules_shoudFailToInstallTestsBindingsAgain_whenCalledTwice() { Foo testFoo = new Foo(); Foo testFoo2 = new Foo(); ScopeImpl scope = new ScopeImpl(""); scope.installTestModules(new TestModule(testFoo)); scope.installTestModules(new TestModule(testFoo2)); fail("Should throw an exception"); }