1 3 package test.jmock.core.testsupport; 4 5 import junit.framework.AssertionFailedError; 6 import org.jmock.core.Verifiable; 7 import org.jmock.expectation.ExpectationCounter; 8 import org.jmock.util.Verifier; 9 10 11 public class MockVerifiable implements Verifiable 12 { 13 public ExpectationCounter verifyCalls = 14 new ExpectationCounter("verify #calls"); 15 public AssertionFailedError verifyFailure; 16 17 public void setExpectedVerifyCalls( int expectedCalls ) { 18 verifyCalls.setExpected(expectedCalls); 19 } 20 21 24 public void verify() { 25 verifyCalls.inc(); 26 if (verifyFailure != null) { 27 throw verifyFailure; 28 } 29 } 30 31 public void verifyExpectations() { 32 Verifier.verifyObject(this); 33 } 34 35 } 36 | Popular Tags |