From: Francois B. <fb...@us...> - 2003-08-26 21:10:20
|
Hi, Here's my test implementation: private final Mock mockNewsIterator =3D new Mock(Iterator.class); private final Iterator newsIterator =3D (Iterator) mockNewsIterator.proxy(); public void testInstructsTheCallerToPrintTheBodyAgainWhenMoreItemsRemain() throws JspException { mockNewsIterator.expectAndReturn("hasNext", C.NO_ARGS, Boolean.TRUE); mockNewsIterator.expectAndReturn("next", C.NO_ARGS, new NewsItem()); mockNewsIterator.expectAndReturn("hasNext", C.NO_ARGS, Boolean.FALSE); assertEquals(TagSupport.EVAL_BODY_AGAIN, tag.doAfterBody()); assertEquals(TagSupport.SKIP_BODY, tag.doAfterBody()); mockNewsIterator.verify(); } When I had 0.09 installed, this test was not failing. Now, I have 0.10dev (CVS pserver as of 2003/08/26 ~ 15:30), and the test fails. Does this mean that I should switch to using OrderedMock for such tests ? What I am trying to achieve here is to have the mockIterator return true once, and false once. If it is called any more times, it should fail.=20 In the mean time, there should be one call to the next() method. Thanks, Fran=E7ois Developer of Java Gui Builder http://jgb.sourceforge.net/ |