|
From: Mike B. <mbr...@vi...> - 2004-01-11 17:12:59
|
It makes sense to me. There are many times when I don't really care that a
certain method is called or that it is called more than once. Putting in
expectXXX() calls just clutters my test code and makes it sensitive to
implementation level changes to the real code.
Mike
> -----Original Message-----
> From: nmo...@li...
> [mailto:nmo...@li...]On Behalf Of Nat Pryce
> Sent: Thursday, January 08, 2004 5:56 AM
> To: jmo...@li...; Steve Freeman
> Cc: nmo...@li...
> Subject: Re: [jmock-dev] RE: [Nmock-general] Strict vs Lenient mode for
> mock objects
>
>
> Here's what we are envisaging.
>
> A Mock* has a set of invocation mockers and a default stub that is used to
> provide behaviour for an invocation that doesn't match against any
> invocation mocker.
>
> By default the default stub signals a test failure.
>
> The user will be able to set the default stub to change the default
> behaviour of the mock.
>
> If they change it to a DefaultResultStub then they will get a
> lenient mode.
> They can set up the DefaultResultStub to handle their own classes
> and share
> a single DefaultResultStub among multiple mock objects so that
> they all have
> the same default behaviour.
>
> Code would look like:
>
> public void setUp() {
> DefaultResultStub defaults = new DefaultResultStub();
> defaults.addDefaultResult( Date.class, new Date(-1L) );
> defaults.addDefaultResult( Point.class, new Point(0,0) );
>
> mock = new Mock( MockedInterface.class );
> mock.setDefaultStub( defaults );
> }
>
> What do people think?
> https://lists.sourceforge.net/lists/listinfo/nmock-general
|