diff --git a/projects/Mockito/16/org/mockito/Mockito.java b/projects/Mockito/16/org/mockito/Mockito.java index 5eb16aa..980587d 100644 --- a/projects/Mockito/16/org/mockito/Mockito.java +++ b/projects/Mockito/16/org/mockito/Mockito.java @@ -824,7 +824,7 @@ public static T mock(Class classToMock, Answer defaultAnswer) { * @return mock object */ public static T mock(Class classToMock, MockSettings mockSettings) { - return MOCKITO_CORE.mock(classToMock, mockSettings); + return MOCKITO_CORE.mock(classToMock, mockSettings, true); } /** @@ -896,7 +896,7 @@ public static T mock(Class classToMock, MockSettings mockSettings) { public static T spy(T object) { return MOCKITO_CORE.mock((Class) object.getClass(), withSettings() .spiedInstance(object) - .defaultAnswer(CALLS_REAL_METHODS)); + .defaultAnswer(CALLS_REAL_METHODS), true); } /** diff --git a/projects/Mockito/16/org/mockito/internal/MockitoCore.java b/projects/Mockito/16/org/mockito/internal/MockitoCore.java index 5321566..61acce8 100755 --- a/projects/Mockito/16/org/mockito/internal/MockitoCore.java +++ b/projects/Mockito/16/org/mockito/internal/MockitoCore.java @@ -29,10 +29,11 @@ public class MockitoCore { private final MockUtil mockUtil = new MockUtil(); private final MockingProgress mockingProgress = new ThreadSafeMockingProgress(); - public T mock(Class classToMock, MockSettings mockSettings, boolean shouldResetOngoingStubbing) { return mock(classToMock, mockSettings); } - public T mock(Class classToMock, MockSettings mockSettings) { + public T mock(Class classToMock, MockSettings mockSettings, boolean shouldResetOngoingStubbing) { mockingProgress.validateState(); + if (shouldResetOngoingStubbing) { mockingProgress.resetOngoingStubbing(); + } return mockUtil.createMock(classToMock, (MockSettingsImpl) mockSettings); }