<T> NewInvocationControl<OngoingStubbing<T>> createNewInvocationControl(InvocationSubstitute<T> mock) { return new MockitoNewInvocationControl(mock); }
private void invokeSubstitute(Object... arguments) throws Exception { try { invocationControl.getSubstitute().performSubstitutionLogic(arguments); } catch (MockitoAssertionError e) { InvocationControlAssertionError.throwAssertionErrorForNewSubstitutionFailure(e, type); } }
private static void verifyNoMoreInteractions(Class<?>... types) { for (Class<?> type : types) { final MockitoMethodInvocationControl invocationHandler = (MockitoMethodInvocationControl) MockRepository .getStaticMethodInvocationControl(type); if (invocationHandler != null) { invocationHandler.verifyNoMoreInteractions(); } MockitoNewInvocationControl<?> newInvocationControl = (MockitoNewInvocationControl<?>) MockRepository.getNewInstanceControl(type); if (newInvocationControl != null) { newInvocationControl.verifyNoMoreInteractions(); } } } }
public <T> DefaultConstructorArgumentsVerification<T> verifyNew(final Class<T> mock, final VerificationMode mode) { assertNotNull(mock, "Class to verify cannot be null"); assertNotNull(mode, "Verify mode cannot be null"); @SuppressWarnings("unchecked") MockitoNewInvocationControl<T> invocationControl = (MockitoNewInvocationControl<T>) MockRepository.getNewInstanceControl(mock); assertNotNull(invocationControl, String.format(NO_OBJECT_CREATION_ERROR_MESSAGE_TEMPLATE, Whitebox.getType(mock).getName())); invocationControl.verify(mode); //noinspection unchecked return new DefaultConstructorArgumentsVerification<T>((NewInvocationControl<T>) invocationControl, mock); }
private void invokeSubstitute(Object... arguments) throws Exception { try { invocationControl.getSubstitute().performSubstitutionLogic(arguments); } catch (MockitoAssertionError e) { InvocationControlAssertionError.throwAssertionErrorForNewSubstitutionFailure(e, type); } }
private NewInvocationControl<OngoingStubbing<T>> createNewInvocationControl(InvocationSubstitute<T> mock) { return new MockitoNewInvocationControl<T>(mock); }
private static void verifyNoMoreInteractions(Class<?>... types) { for (Class<?> type : types) { final MockitoMethodInvocationControl invocationHandler = (MockitoMethodInvocationControl) MockRepository .getStaticMethodInvocationControl(type); if (invocationHandler != null) { invocationHandler.verifyNoMoreInteractions(); } MockitoNewInvocationControl<?> newInvocationControl = (MockitoNewInvocationControl<?>) MockRepository.getNewInstanceControl(type); if (newInvocationControl != null) { newInvocationControl.verifyNoMoreInteractions(); } } } }