All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mockito.internal.stubbing.ConsecutiveStubbing Maven / Gradle / Ivy

There is a newer version: 2.0.2-beta
Show newest version
/*
 * Copyright (c) 2007 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */
package org.mockito.internal.stubbing;

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

public class ConsecutiveStubbing extends BaseStubbing {
    private final InvocationContainerImpl invocationContainerImpl;

    public ConsecutiveStubbing(InvocationContainerImpl invocationContainerImpl) {
        this.invocationContainerImpl = invocationContainerImpl;
    }

    public OngoingStubbing thenAnswer(Answer answer) {
        invocationContainerImpl.addConsecutiveAnswer(answer);
        return this;
    }

    public OngoingStubbing then(Answer answer) {
        return thenAnswer(answer);
    }
    
    public DeprecatedOngoingStubbing toAnswer(Answer answer) {
        invocationContainerImpl.addConsecutiveAnswer(answer);
        return this;
    }

    public  M getMock() {
        return (M) invocationContainerImpl.invokedMock();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy