From: Vincent M. <vm...@oc...> - 2001-08-09 06:50:19
|
----- Original Message ----- From: "Steve Freeman" <st...@m3...> To: <moc...@li...> Sent: Wednesday, August 08, 2001 10:21 PM Subject: Re: [Mockobjects-java-users] Advantage for In-Container vs Mock ? > > The getLocale() method is actually implemented in the Action class ... So I > > can see 2 ways of coping with this : > > * Solution 1: Create a LogonActionForTest class that extends LogonAction and > > override the getLocale() method so that it returns what we want, > > the point here is that you're not testing the LogonAction class, only its clients. My inclination would be to override _everything_ in LogonAction with dumb mock methods. That way you're not relying on any mysterious behaviour of the parent. > > We've done this for mocking up Dynamo classes. er ... what do I test then ? :) No, I think there is misunderstanding: what I am unit testing is the LogonAction class itself, which is why I cannot mock it ... The class that we are not testing is the Action class but we cannot override it as the LogonAction is extending it. The only way is by extending the LogonAction class and override the methods that are implemented in Action and _not_ in LogonAction, which is what solution 1 is about. > > steve -Vincent |