1 3 package test.jmock.core; 4 5 import java.util.List ; 6 import org.jmock.core.InvocationMocker; 7 import org.jmock.core.Stub; 8 import org.jmock.core.Verifiable; 9 import org.jmock.expectation.ExpectationCounter; 10 import org.jmock.expectation.ExpectationList; 11 import org.jmock.expectation.ExpectationValue; 12 import org.jmock.util.Verifier; 13 14 15 public class MockDescriber implements InvocationMocker.Describer, Verifiable 16 { 17 public ExpectationCounter hasDescriptionCalls = 18 new ExpectationCounter("hasDescription #calls"); 19 public boolean hasDescriptionResult = false; 20 21 public boolean hasDescription() { 22 hasDescriptionCalls.inc(); 23 return hasDescriptionResult; 24 } 25 26 public ExpectationValue describeToBuf = 27 new ExpectationValue("describeTo buf"); 28 public ExpectationList describeToMatchers = 29 new ExpectationList("describeTo matchers"); 30 public ExpectationValue describeToStub = 31 new ExpectationValue("describeTo stub"); 32 public ExpectationValue describeToName = 33 new ExpectationValue("describeTo name"); 34 35 public void describeTo( StringBuffer buf, List matchers, Stub stub, String name ) { 36 describeToBuf.setActual(buf); 37 describeToMatchers.addActualMany(matchers.iterator()); 38 describeToStub.setActual(stub); 39 describeToName.setActual(name); 40 } 41 42 public void verify() { 43 Verifier.verifyObject(this); 44 } 45 } 46 | Popular Tags |