Package org.jmock.dynamic

Source Code of org.jmock.dynamic.InvocationMockerBuilder

/* Copyright (c) 2000-2003, jMock.org. See bundled LICENSE.txt */
package org.jmock.dynamic;

import org.jmock.stub.ReturnStub;
import org.jmock.stub.StubBuilder;
import org.jmock.stub.ThrowStub;
import org.jmock.stub.VoidStub;

public class InvocationMockerBuilder implements StubBuilder, ExpectationBuilder {

    private InvocationMocker mocker;

    public InvocationMockerBuilder(InvocationMocker mocker) {
        this.mocker = mocker;
    }

    public ExpectationBuilder isVoid() {
        mocker.setStub(new VoidStub());
        return this;
    }

    public ExpectationBuilder returns(Object returnValue) {
        mocker.setStub(new ReturnStub(returnValue));
        return this;
    }

    public ExpectationBuilder willThrow(Throwable throwable) {
        mocker.setStub(new ThrowStub(throwable));
        return this;
    }
}
TOP

Related Classes of org.jmock.dynamic.InvocationMockerBuilder

TOP
Copyright © 2018 www.massapi.com. 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.