1 /* Copyright (c) 2000-2003, jMock.org. See bundled LICENSE.txt */ 2 package org.jmock.dynamic.support; 3 4 import org.jmock.dynamic.Invocation; 5 import org.jmock.dynamic.Invokable; 6 import org.jmock.expectation.ExpectationCounter; 7 import org.jmock.expectation.ExpectationValue; 8 import org.jmock.expectation.Verifier; 9 10 public class MockInvokable implements Invokable { 11 12 public boolean matchesResult; 13 public ExpectationValue matchesInvocation = new ExpectationValue("matches.invocation"); 14 15 public Object invokeResult; 16 public ExpectationValue invokeInvocation = new ExpectationValue("invoke.invocation"); 17 public Throwable invokeThrow; 18 public ExpectationCounter verifyCalls = new ExpectationCounter("verify.calls"); 19 20 21 public String getDescription() { 22 return null; 23 } 24 25 public boolean matches(Invocation invocation) { 26 matchesInvocation.setActual(invocation); 27 return matchesResult; 28 } 29 30 public Object invoke(Invocation invocation) throws Throwable { 31 invokeInvocation.setActual(invocation); 32 if (invokeThrow != null) { 33 throw invokeThrow; 34 } 35 return invokeResult; 36 } 37 38 public void verify() { 39 verifyCalls.inc(); 40 } 41 42 public void verifyExpectations() { 43 Verifier.verifyObject(this); 44 } 45 46 }

This page was automatically generated by Maven