Package org.powermock.api.mockito.internal.invocation

Examples of org.powermock.api.mockito.internal.invocation.MockitoMethodInvocationControl


        settings.setMockName(new MockNameImpl(mockName));
        InternalMockHandler mockHandler = new MockHandlerFactory().create(settings);
        MethodInterceptorFilter filter = new PowerMockMethodInterceptorFilter(
                mockHandler, settings);
        final T mock = (T) ClassImposterizer.INSTANCE.imposterise(filter, type);
        final MockitoMethodInvocationControl invocationControl = new MockitoMethodInvocationControl(filter,
                isSpy && delegator == null ? new Object() : delegator, mock, methods);

        return new MockData<T>(invocationControl, mock);
    }
View Full Code Here


        settings.setTypeToMock(type);

        InternalMockHandler mockHandler = new MockHandlerFactory().create(settings);
        MethodInterceptorFilter filter = new PowerMockMethodInterceptorFilter(mockHandler, settings);
        final T mock = (T) ClassImposterizer.INSTANCE.imposterise(filter, type);
        final MockitoMethodInvocationControl invocationControl = new MockitoMethodInvocationControl(filter,
                isSpy && delegator == null ? new Object() : delegator, mock, methods);

        return new MockData<T>(invocationControl, mock);
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void when(Class<?> classMock) {
        MockitoMethodInvocationControl invocationControl = (MockitoMethodInvocationControl) MockRepository
                .getStaticMethodInvocationControl(classMock);
        addAnswersForStubbing(invocationControl);
    }
View Full Code Here

     *
     * @see Stubber#when(Object)
     */
    @Override
    public <T> T when(T instanceMock) {
        MockitoMethodInvocationControl invocationControl = (MockitoMethodInvocationControl) MockRepository
                .getInstanceMethodInvocationControl(instanceMock);
        final T returnValue;
        if (invocationControl == null) {
            returnValue = super.when(instanceMock);
        } else {
View Full Code Here

            throw new IllegalArgumentException(name + " cannot be null");
        }
    }

    private <T> void prepareForStubbing(T mock) {
        MockitoMethodInvocationControl invocationControl = (MockitoMethodInvocationControl) MockRepository.getInstanceMethodInvocationControl(mock);
        addAnswersForStubbing(invocationControl);
    }
View Full Code Here

    public static void verifyNoMoreInteractions(Object... objects) {
        for (Object mock : objects) {
            if (mock instanceof Class<?>) {
                verifyNoMoreInteractions((Class<?>) mock);
            } else {
                MockitoMethodInvocationControl invocationControl = (MockitoMethodInvocationControl) MockRepository
                        .getInstanceMethodInvocationControl(mock);
                if (invocationControl != null) {
                    invocationControl.verifyNoMoreInteractions();
                } else {
                    /*
                     * Delegate to Mockito if we have no handler registered for
                     * this object.
                     */
 
View Full Code Here

        }
    }

    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();
            }
View Full Code Here

TOP

Related Classes of org.powermock.api.mockito.internal.invocation.MockitoMethodInvocationControl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.