Search in sources :

Example 1 with InvocationContainer

use of org.mockito.internal.stubbing.InvocationContainer in project powermock by powermock.

the class MockitoMethodInvocationControl method verifyNoMoreInteractions.

public void verifyNoMoreInteractions() {
    try {
        final MockHandler mockHandler = methodInterceptorFilter.getHandler();
        if (mockHandler instanceof MockHandler) {
            InvocationContainer invocationContainer = Whitebox.invokeMethod(mockHandler, "getInvocationContainer");
            VerificationDataImpl data = new VerificationDataImpl(invocationContainer, null);
            VerificationModeFactory.noMoreInteractions().verify(data);
        } else {
            throw new RuntimeException("Cannot perform verifyNoMoreInteractions because of unknown mockhandler type " + mockHandler.getClass());
        }
    } catch (MockitoAssertionError e) {
        InvocationControlAssertionError.updateErrorMessageForVerifyNoMoreInteractions(e);
        throw e;
    } catch (Exception e) {
        throw new RuntimeException("PowerMock internal error", e);
    }
}
Also used : VerificationDataImpl(org.mockito.internal.verification.VerificationDataImpl) MockitoAssertionError(org.mockito.exceptions.base.MockitoAssertionError) InternalMockHandler(org.mockito.internal.InternalMockHandler) MockHandler(org.mockito.invocation.MockHandler) InvocationContainer(org.mockito.internal.stubbing.InvocationContainer) NotAMockException(org.mockito.exceptions.misusing.NotAMockException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 MockitoAssertionError (org.mockito.exceptions.base.MockitoAssertionError)1 NotAMockException (org.mockito.exceptions.misusing.NotAMockException)1 InternalMockHandler (org.mockito.internal.InternalMockHandler)1 InvocationContainer (org.mockito.internal.stubbing.InvocationContainer)1 VerificationDataImpl (org.mockito.internal.verification.VerificationDataImpl)1 MockHandler (org.mockito.invocation.MockHandler)1