public static synchronized void reset ( Object ... mocks ) { try { for ( Object mock : mocks ) { if ( mock instanceof Class < ? > ) { reset ( ( Class < ? > ) mock ) ; } else { MethodInvocationControl invocationControl = MockRepository . getInstanceMethodInvocationControl ( mock ) ; if ( invocationControl != null ) { invocationControl . reset ( ) ; } else { if ( isNiceReplayAndVerifyMode ( ) && ! isEasyMocked ( mock ) ) { // ignore non-mock } else { /* * Delegate to easy mock class extension if we have * no handler registered for this object. */ try { org . easymock . EasyMock . reset ( mock ) ; } catch ( RuntimeException e ) { throw new RuntimeException ( mock + " is not a mock object" , e ) ; } } } } } } catch ( Throwable t ) { MockRepository . putAdditionalState ( NICE_REPLAY_AND_VERIFY_KEY , false ) ; if ( t instanceof RuntimeException ) { throw ( RuntimeException ) t ; } else if ( t instanceof Error ) { throw ( Error ) t ; } throw new RuntimeException ( t ) ; } }
Reset a list of mock objects or classes .