1 3 package org.jmock.core.stub; 4 5 import junit.framework.AssertionFailedError; 6 import org.jmock.core.Invocation; 7 import org.jmock.core.Stub; 8 9 10 public class TestFailureStub implements Stub 11 { 12 String errorMessage; 13 14 public TestFailureStub( String errorMessage ) { 15 this.errorMessage = errorMessage; 16 } 17 18 public Object invoke( Invocation invocation ) throws Throwable { 19 throw new AssertionFailedError(errorMessage); 20 } 21 22 public StringBuffer describeTo( StringBuffer buffer ) { 23 return buffer.append("fails the test and reports \"" + errorMessage + "\""); 24 } 25 } 26 | Popular Tags |