From: Nat P. <nat...@b1...> - 2003-06-19 17:49:56
|
The Mock class has the method add( Callable callable ) that adds a custom callable object to the mock. The argument can be a user defined implementation of the Callable interface, a chain of decorators built by the user or a combination of the two. The expect... and match... methods are implemented in terms of the add method. There should be no need to change the CallFactory implementation used by the mock. Cheers, Nat. _______________________ Dr. Nathaniel Pryce B13media Ltd. http://www.b13media.com +44 (0)7712 526 661 ----- Original Message ----- From: "Barry Kaplan" <bk...@in...> To: "mockobjects" <moc...@li...> Sent: Thursday, June 19, 2003 5:23 PM Subject: [MO-java-dev] factorying calls on a per method basis? > Often I find the need for a method to be called at least once, but its > ok if its called more times. Generally this is with a getter that is > providing a property used for some external purpose. What I end up doing is: > > myMock.expectAndReturn("getSomething", 12); > myMock.matchAndReturn("getSomething", 12); > > While this works just fine, it gets to be a bit verbose at times. > > I know I can override the callable created by the 'expectAndReturn' > method by creating the mock with a custom factory. But the that factory > applies to all invocations of 'expect*'. What I would like is the > ability to define custom callables on a per-method basis. I guess like > the previous version allowed. > > Would it be so bad to have?: > > Mock.expectAndReturn(Callable callable) > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: INetU > Attention Web Developers & Consultants: Become An INetU Hosting Partner. > Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! > INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |