From: Tim M. <tim...@po...> - 2003-07-02 00:11:20
|
The functional test is in examples (the package name probably bad). This was the functional test we used to drive the thing. It may be slightly incomplete but it shows most of the usage. You are correct that its missing an example of using matchAndReturn twice - it does show expectAndReturn twice however. > -----Original Message----- > From: moc...@li... > [mailto:moc...@li...]On Behalf Of > chris cottee > Sent: 01 July 2003 23:46 > To: Tim Mackinnon; moc...@li...; Nat Pryce > Subject: Re: [MO-java-dev] DynaMock proxy toString issue > > > I think there need to be some functional tests for Mock as well as the > mocked unit tests. Functional tests > are (in this case) better at expressing the intent of the code since they > are effectively examples of usage. > > For instance what is the intended behaviour of the Mock if you setup a > match and then call it more than once? How about for OrderedMock? > > I have to look at the tests for CallSequence and CallBag (in the 0.09 > release) to figure this out which means that I have to > read the implementation to tell that Mock uses these things and I can't > tell from the tests what the intent is, it is easier to read the code. I > chose this example because the test is easy if you have setup a mock and > proxy > > public void testMatchAndReturn() throws Throwable { > mock.matchAndReturn(METHOD_NOARGANDRETURN_NAME, > METHOD_NOARGANDRETURN_RESULT); > mock.verify(); > for (int i = 0; i < 4; i++) { > assertEquals("should get expected result every time:" + i, > METHOD_NOARGANDRETURN_RESULT, proxy.noArgMethod()); > } > > mock.verify(); > } > And it passes on Mock and fails on OrderedMock in both 0.09 versions and > Nat's branch. Now I don't know if OrderedMock > is supposed to treat matches differently to Mock or not and I really have > no way of telling. My feeling is that this is a > bug and that the only difference between Mock and OrderedMock > should be the > way they handle the order of expected calls, in all other ways the > behaviour should be identical. > > Is this right? > Chris. > > > > > > > > > ------------------------------------------------------- > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > Data Reports, E-commerce, Portals, and Forums are available now. > Download today and enter to win an XBOX or Visual Studio .NET. > http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01 > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.490 / Virus Database: 289 - Release Date: 16/06/2003 > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.490 / Virus Database: 289 - Release Date: 16/06/2003 |