From: Gilles D. <rh...@wa...> - 2002-08-23 12:41:03
|
i repost the reply i sent to nat cuz it seems ive replied to him without = cc the list. >Messsage du 23/08/2002 13:00 >De : Gilles DODINET <rh...@wa...> >A : <moc...@li...> >Copie =E0 : >Objet : Feature-request > > Hi, > > I think MockObjects are missing a feature very useful when working with= factories. imho they should follow the Composite pattern. For instance, l= et's say i wanna use a MockConnection : i need a MockPreparedStatement and= a MockResultset as well. If i want to externalize the creation of my Mock= Objects from the TestCase perspective (ok thats perhaps arguable), i have= no practical way to do it, since i will have to call verify() on both myM= ockPreparedStatement and myMockResultset as well. But since the creation o= f the MockObject was delegated, i lost the references to those objects (an= d also Verifier.verifyObject() doesnt verify myPreparedStatement : it just= ensure that it has been used). > There's also a crappy work-around : using AspectJ, we can these functio= nnality at the price of extending MockConnection, MockPreparedStatement an= d MockResultSet. thats not satisfactory tho. so the better way i think wou= ld be to modify MockObject class to make it composite. What do you think o= f this =3F > > -- gd > |