1 /* Copyright (c) 2000-2003, jMock.org. See bundled LICENSE.txt */
2 package org.jmock.expectation;
3
4 import junit.framework.AssertionFailedError;
5 import org.jmock.AbstractTestCase;
6
7 public class TestReturnObjectList extends AbstractTestCase {
8 private ReturnObjectList list = new ReturnObjectList("test");
9
10 public void testLeftoverObjectFails() {
11 list.addObjectToReturn("one");
12
13 assertVerifyFails(list);
14 }
15
16 public void testEmptyList() {
17 list.verify();
18 }
19
20 public void testReturnSucceeds() {
21 list.addObjectToReturn("one");
22 list.addObjectToReturn("two");
23
24 assertEquals("Should be first result", "one", list.nextReturnObject());
25 assertEquals("Should be second result", "two", list.nextReturnObject());
26 list.verify();
27 }
28
29 public void testTooManyReturns() {
30 try {
31 list.nextReturnObject();
32 fail("Error should have been raised");
33 } catch (AssertionFailedError expected) {
34 }
35 }
36 }
This page was automatically generated by Maven