mockdescriber.java

来自「不管是测试驱动开发或者是其它的开发模式」· Java 代码 · 共 46 行

JAVA
46
字号
/*  Copyright (c) 2000-2004 jMock.org
 */
package test.jmock.core;

import java.util.List;
import org.jmock.core.InvocationMocker;
import org.jmock.core.Stub;
import org.jmock.core.Verifiable;
import org.jmock.expectation.ExpectationCounter;
import org.jmock.expectation.ExpectationList;
import org.jmock.expectation.ExpectationValue;
import org.jmock.util.Verifier;


public class MockDescriber implements InvocationMocker.Describer, Verifiable
{
    public ExpectationCounter hasDescriptionCalls =
            new ExpectationCounter("hasDescription #calls");
    public boolean hasDescriptionResult = false;

    public boolean hasDescription() {
        hasDescriptionCalls.inc();
        return hasDescriptionResult;
    }

    public ExpectationValue describeToBuf =
            new ExpectationValue("describeTo buf");
    public ExpectationList describeToMatchers =
            new ExpectationList("describeTo matchers");
    public ExpectationValue describeToStub =
            new ExpectationValue("describeTo stub");
    public ExpectationValue describeToName =
            new ExpectationValue("describeTo name");

    public void describeTo( StringBuffer buf, List matchers, Stub stub, String name ) {
        describeToBuf.setActual(buf);
        describeToMatchers.addActualMany(matchers.iterator());
        describeToStub.setActual(stub);
        describeToName.setActual(name);
    }

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

⌨️ 快捷键说明

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