/** * Verifies that no interactions happened on given mocks beyond the previously verified interactions.<br/> * This method has the same behavior as {@link #verifyNoMoreInteractions(Object...)}. * * @param mocks to be verified */ public static void verifyZeroInteractions(Object... mocks) { MOCKITO_CORE.verifyNoMoreInteractions(mocks); }
private static Stubber stubber() { return MOCKITO_CORE.stubber(Strictness.LENIENT); } }
public void verifyNoMoreInteractions() { mockitoCore.verifyNoMoreInteractionsInOrder(mocksToBeVerifiedInOrder, this); } }
public InOrder inOrder(Object... mocks) { if (mocks == null || mocks.length == 0) { throw mocksHaveToBePassedWhenCreatingInOrder(); } for (Object mock : mocks) { if (mock == null) { throw nullPassedWhenCreatingInOrder(); } if (!isMock(mock)) { throw notAMockPassedWhenCreatingInOrder(); } assertNotStubOnlyMock(mock); } return new InOrderImpl(Arrays.asList(mocks)); }
Object returnValueFor(Class<?> clazz) { if (!mockitoCore.isTypeMockable(clazz)) { return null; } return mockitoCore.mock(clazz, new MockSettingsImpl().defaultAnswer(this)); } }
public Object handle(Invocation invocation) throws Throwable { try { Object returnedValue = mockHandler.handle(invocation); notifyMethodCall(invocation, returnedValue); return returnedValue; } catch (Throwable t){ notifyMethodCallException(invocation, t); throw t; } }
@Override public <T> OngoingStubbing<T> when(T methodCall) { OngoingStubbingImpl<T> ongoingStubbing = (OngoingStubbingImpl) MOCKITO_CORE.when(methodCall); ongoingStubbing.setStrictness(Strictness.LENIENT); return ongoingStubbing; }
public InvocationContainer getInvocationContainer() { return delegate.getInvocationContainer(); } }
/** * Returns a MockingDetails instance that enables inspecting a particular object for Mockito related information. * Can be used to find out if given object is a Mockito mock * or to find out if a given mock is a spy or mock. * <p> * In future Mockito versions MockingDetails may grow and provide other useful information about the mock, * e.g. invocations, stubbing info, etc. * * @param toInspect - object to inspect. null input is allowed. * @return A {@link org.mockito.MockingDetails} instance. * @since 1.9.5 */ @CheckReturnValue public static MockingDetails mockingDetails(Object toInspect) { return MOCKITO_CORE.mockingDetails(toInspect); }
public MockCreationSettings getMockSettings() { return mockHandler.getMockSettings(); }
public void setAnswersForStubbing(List<Answer> answers) { mockHandler.setAnswersForStubbing(answers); }
public VoidMethodStubbable voidMethodStubbable(Object mock) { return delegate.voidMethodStubbable(mock); }
/** * Use this method in order to only clear invocations, when stubbing is non-trivial. Use-cases can be: * <ul> * <li>You are using a dependency injection framework to inject your mocks.</li> * <li>The mock is used in a stateful scenario. For example a class is Singleton which depends on your mock.</li> * </ul> * * <b>Try to avoid this method at all costs. Only clear invocations if you are unable to efficiently test your program.</b> * @param <T> The type of the mocks * @param mocks The mocks to clear the invocations for */ public static <T> void clearInvocations(T ... mocks) { MOCKITO_CORE.clearInvocations(mocks); }
public void verifyNoMoreInteractions() { mockitoCore.verifyNoMoreInteractionsInOrder(mocksToBeVerifiedInOrder, this); } }
public InvocationContainer getInvocationContainer() { return mockHandler.getInvocationContainer(); }
public Stubber stubber() { return stubber(null); }
public MockCreationSettings getMockSettings() { return delegate.getMockSettings(); }
public void setAnswersForStubbing(List answers) { delegate.setAnswersForStubbing(answers); }
public VoidMethodStubbable<T> voidMethodStubbable(T mock) { return mockHandler.voidMethodStubbable(mock); }