From: Nat P. <nat...@b1...> - 2003-09-23 21:17:55
|
With the dynamic mocks you can write your own Callable objects to match against any method or in some other custom manner. Cheers, Nat. _______________________ Dr. Nathaniel Pryce B13media Ltd. http://www.b13media.com +44 (0)7712 526 661 ----- Original Message ----- From: "Frederic Donckels" <fre...@ac...> To: <moc...@li...> Sent: Tuesday, September 23, 2003 11:11 AM Subject: [MO-java-users] A kind of "don't care" Mock? > Hi all, > > I must confess I haven't thoroughly searched through either Wiki, > the lists or the source code (Flame disclaimer :) ) > > Is there a way to create a mock with a default 'I don't care' > behaviour for most of the methods? > What I mean is that, for some tests, there might be a bunch of > methods called, for which I don't want to set expectations (because > sometimes I don't know which methods will be called, how many times, > ..., or if the mock-proxy is temporarily handled to an outside object > for which I don''t have the source code, or I just don't care to > provide an 'implementation' (hashcode, toString, ..)). > For those methods, I'd just like to set a global default behaviour: > - match any call, with any args (or no args) > - return a default value (true or false for boolean, 0 for numeric > values, null for objects) (with this default value that could be > changed). > > but still to be able to set expectations on methods I care. > > In the same way, is there a way to say "this method will be called, > I don't care how many times, just return always this value" ? > > Thanks!! > > Regards > > Frederic > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Mockobjects-java-users mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-users |