Package org.mockito.internal.stubbing.answers

Examples of org.mockito.internal.stubbing.answers.Returns


     *
     * @param toBeReturned to be returned when the stubbed method is called
     * @return stubber - to select a method for stubbing
     */
    public static Stubber doReturn(Object toBeReturned) {
        return MOCKITO_CORE.doAnswer(new Returns(toBeReturned));
    }
View Full Code Here


import org.mockito.stubbing.DeprecatedOngoingStubbing;
import org.mockito.stubbing.OngoingStubbing;

public abstract class BaseStubbing<T> implements OngoingStubbing<T>, DeprecatedOngoingStubbing<T> {
    public OngoingStubbing<T> thenReturn(T value) {
        return thenAnswer(new Returns(value));
    }
View Full Code Here

    public OngoingStubbing<T> thenCallRealMethod() {
        return thenAnswer(new CallsRealMethods());
    }

    public DeprecatedOngoingStubbing<T> toReturn(T value) {
        return toAnswer(new Returns(value));
    }
View Full Code Here

    private Callable<Object> callable;

    @Before
    @SuppressWarnings("serial")
    public void setUp() throws Exception {
        when(delegate.call()).thenAnswer(new Returns(callableResult) {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
                assertThat(SecurityContextHolder.getContext()).isEqualTo(securityContext);
                return super.answer(invocation);
            }
View Full Code Here

        mockUtil.getMockHandler(mock).setAnswersForStubbing(answers);
        return mock;
    }

    public Stubber doReturn(Object toBeReturned) {
        answers.add(new Returns(toBeReturned));
        return this;
    }
View Full Code Here

import org.mockito.stubbing.DeprecatedOngoingStubbing;
import org.mockito.stubbing.OngoingStubbing;

public abstract class BaseStubbing<T> implements OngoingStubbing<T>, DeprecatedOngoingStubbing<T> {
    public OngoingStubbing<T> thenReturn(T value) {
        return thenAnswer(new Returns(value));
    }
View Full Code Here

    public OngoingStubbing<T> thenCallRealMethod() {
        return thenAnswer(new CallsRealMethods());
    }

    public DeprecatedOngoingStubbing<T> toReturn(T value) {
        return toAnswer(new Returns(value));
    }
View Full Code Here

public abstract class BaseStubbing<T> implements OngoingStubbing<T>, DeprecatedOngoingStubbing<T> {

    //TODO why we need this method? The other thenReturn covers it.
    public OngoingStubbing<T> thenReturn(T value) {
        return thenAnswer(new Returns(value));
    }
View Full Code Here

    public OngoingStubbing<T> thenCallRealMethod() {
        return thenAnswer(new CallsRealMethods());
    }

    public DeprecatedOngoingStubbing<T> toReturn(T value) {
        return toAnswer(new Returns(value));
    }
View Full Code Here

    @Test
    //see issue 331
    public void handle_result_must_not_be_null_for_primitives() throws Throwable {
        //given:
        MockCreationSettings settings = (MockCreationSettings) new MockSettingsImpl().defaultAnswer(new Returns(null));
        InternalMockHandler handler = new MockHandlerFactory().create(settings);

        mock.intReturningMethod();
        Invocation invocation = super.getLastInvocation();
View Full Code Here

TOP

Related Classes of org.mockito.internal.stubbing.answers.Returns

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.