Toothpick { public static Scope openRootScope() { synchronized (ROOT_SCOPES) { if (ROOT_SCOPES.size() > 1) { throw new RuntimeException( "openRootScope() is not supported when multiple root scopes are enabled. Use 'Configuration.preventMultipleRootScopes()' to enable it."); } else if (ROOT_SCOPES.size() == 1) { return ROOT_SCOPES.values().iterator().next(); } return openScope(Toothpick.class); } } protected  Toothpick(); static Scope openRootScope(); static Scope openRootScope(ScopeConfig scopeConfig); static boolean isRootScopeOpen(); static boolean isScopeOpen(Object name); static Scope openScopes(Object... names); static Scope openScope(Object name); static Scope openScope(Object name, ScopeConfig scopeConfig); static void closeScope(Object name); static void reset(); static void reset(Scope scope); static void release(Scope scope); static void inject(Object obj, Scope scope); static void setConfiguration(Configuration configuration);  }
@Test public void openRootScope_shouldReturnDefaultScope_WhenThereIsNoScopeTreeDefined() { Scope rootScope = Toothpick.openRootScope(); assertThat(rootScope, notNullValue()); assertThat(rootScope.getName(), equalToObject(Toothpick.class)); }
@Test public void openRootScope_shouldApplyConfig() { TestScopeConfig scopeConfig = new TestScopeConfig(); Scope rootScope = Toothpick.openRootScope(scopeConfig); assertThat(rootScope, notNullValue()); assertThat(rootScope.getName(), equalToObject(Toothpick.class)); assertThat(scopeConfig.wasApplied, is(true)); }