1 3 package test.jmock.core.testsupport; 4 5 import org.jmock.core.Invocation; 6 import org.jmock.core.InvocationMatcher; 7 import org.jmock.expectation.ExpectationValue; 8 9 10 public class MockInvocationMatcher 11 extends MockVerifiable 12 implements InvocationMatcher 13 { 14 private String name; 15 16 public MockInvocationMatcher( String name ) { 17 this.name = name; 18 } 19 20 public MockInvocationMatcher() { 21 this("mockInvocationMatcher"); 22 } 23 24 public String toString() { 25 return name; 26 } 27 28 29 public ExpectationValue matchesInvocation = new ExpectationValue("matches invocation"); 30 public boolean matchesResult = false; 31 32 public boolean matches( Invocation invocation ) { 33 matchesInvocation.setActual(invocation); 34 return matchesResult; 35 } 36 37 public ExpectationValue invokedInvocation = new ExpectationValue("invoked invocation"); 38 39 public void invoked( Invocation invocation ) { 40 invokedInvocation.setActual(invocation); 41 } 42 43 public ExpectationValue describeToBuffer = new ExpectationValue("describeTo buffer"); 44 public String describeToOutput = ""; 45 46 public boolean hasDescription() { 47 return describeToOutput.length() > 0; 48 } 49 50 public StringBuffer describeTo( StringBuffer buffer ) { 51 describeToBuffer.setActual(buffer); 52 buffer.append(describeToOutput); 53 return buffer; 54 } 55 } 56 | Popular Tags |