1 /* Copyright (c) 2000-2003, jMock.org. See bundled LICENSE.txt */ 2 package org.jmock.dynamic.support; 3 4 import junit.framework.AssertionFailedError; 5 import org.jmock.dynamic.Invocation; 6 import org.jmock.dynamic.InvocationDispatcher; 7 import org.jmock.dynamic.Invokable; 8 import org.jmock.expectation.ExpectationCounter; 9 import org.jmock.expectation.ExpectationValue; 10 import org.jmock.expectation.MockObject; 11 12 public class MockInvocationDispatcher 13 extends MockObject 14 implements InvocationDispatcher { 15 public ExpectationValue dispatchInvocation = new ExpectationValue("dispatchInvocation"); 16 public Object dispatchResult; 17 public Throwable dispatchThrowable; 18 public ExpectationValue addInvokable = new ExpectationValue("addInvokable"); 19 public ExpectationCounter clearCalls = new ExpectationCounter("clear calls"); 20 public ExpectationCounter verifyCalls = new ExpectationCounter("verify calls"); 21 public AssertionFailedError verifyFailure; 22 23 public void add(Invokable invokable) { 24 addInvokable.setActual(invokable); 25 } 26 27 public void clear() { 28 clearCalls.inc(); 29 } 30 31 public Object dispatch(Invocation invocation) throws Throwable { 32 dispatchInvocation.setActual(invocation); 33 if (null != dispatchThrowable) { 34 throw dispatchThrowable; 35 } 36 return dispatchResult; 37 } 38 39 /*** 40 * @deprecated Use verifyExpectations to verify this object 41 */ 42 public void verify() { 43 verifyCalls.inc(); 44 if (null != verifyFailure) { 45 throw verifyFailure; 46 } 47 } 48 49 50 public void verifyExpectations() { 51 super.verify(); 52 } 53 }

This page was automatically generated by Maven