1 /* Copyright (c) 2000-2003, jMock.org. See bundled LICENSE.txt */
2 package org.jmock.dynamic;
3
4 import junit.framework.TestCase;
5 import org.jmock.stub.ReturnStub;
6 import org.jmock.stub.ThrowStub;
7
8 public class StubTest extends TestCase {
9
10 public StubTest(String name) {
11 super(name);
12 }
13
14 Invocation invocation = new Invocation("ignoredName", new Class[0], void.class, new Object[0]);
15
16 public void testReturnStub() throws Throwable {
17 final String RESULT = "result";
18
19 assertSame("Should be the same result object", RESULT, new ReturnStub(RESULT).invoke(invocation));
20 }
21
22 public void testThrowStub() {
23 final Throwable throwable = new DummyThrowable();
24
25 try {
26 new ThrowStub(throwable).invoke(invocation);
27 } catch (Throwable t) {
28 assertSame("Should be the same throwable", throwable, t);
29 }
30 }
31
32 }
This page was automatically generated by Maven