/** * Resets the state of a single scope. Useful for automation testing when we want to reset the scope used to install * test modules. * @param scope the scope we want to reset. */ public static void reset(Scope scope) { ScopeNode scopeNode = (ScopeNode) scope; scopeNode.reset(); }
/** * Resets the state of the scope. * Useful for automation testing when we want to reset the scope used to install test modules. */ @Override protected void reset() { super.reset(); mapClassesToNamedBoundProviders.clear(); mapClassesToUnNamedBoundProviders.clear(); hasTestModules = false; installBindingForScope(); }
@Test public void reset_shouldCallResetForProvidedScope() throws Exception { // GIVEN ScopeNode mockScope = createMock(ScopeNode.class); mockScope.reset(); replay(mockScope); // WHEN Toothpick.reset(mockScope); // THEN verify(mockScope); }
@Test public void testReset_shouldRebindScopeAnnotation() throws Exception { //GIVEN ScopeNode scope = new ScopeImpl(CustomScope.class); //WHEN scope.reset(); //THEN assertThat(scope.isBoundToScopeAnnotation(CustomScope.class), is(true)); } }
@Test public void testReset_shouldClearBoundAnnotations_andFlagTheScopeAsOpen() throws Exception { //GIVEN ScopeNode scope = new ScopeImpl("root"); scope.bindScopeAnnotation(CustomScope.class); scope.close(); //WHEN scope.reset(); //THEN assertThat(scope.isBoundToScopeAnnotation(CustomScope.class), is(false)); assertThat(scope.isOpen, is(true)); }
/** * Resets the state of a single scope. Useful for automation testing when we want to reset the scope used to install * test modules. * @param scope the scope we want to reset. */ public static void reset(Scope scope) { ScopeNode scopeNode = (ScopeNode) scope; scopeNode.reset(); }
/** * Resets the state of the scope. * Useful for automation testing when we want to reset the scope used to install test modules. */ @Override protected void reset() { super.reset(); mapClassesToNamedBoundProviders.clear(); mapClassesToUnNamedBoundProviders.clear(); hasTestModules = false; installBindingForScope(); }