⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mockstub.java

📁 不管是测试驱动开发或者是其它的开发模式
💻 JAVA
字号:
/*  Copyright (c) 2000-2004 jMock.org
 */
package test.jmock.core.testsupport;

import org.jmock.core.Invocation;
import org.jmock.core.Stub;
import org.jmock.core.Verifiable;
import org.jmock.expectation.ExpectationValue;
import org.jmock.util.Verifier;


public class MockStub
        implements Stub, Verifiable
{
    private String name;

    public MockStub() {
        this("mockStub");
    }

    public MockStub( String name ) {
        this.name = name;
    }

    public String toString() {
        return name;
    }

    public ExpectationValue invokeInvocation =
            new ExpectationValue("invoke invocation");
    public Object invokeResult;

    public Object invoke( Invocation invocation ) throws Throwable {
        invokeInvocation.setActual(invocation);
        return invokeResult;
    }


    public ExpectationValue describeToBuffer = new ExpectationValue("describeTo buffer");
    public String describeToOutput = "";

    public StringBuffer describeTo( StringBuffer buffer ) {
        describeToBuffer.setActual(buffer);
        buffer.append(describeToOutput);
        return buffer;
    }

    public void verify() {
        Verifier.verifyObject(this);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -