Vincent
"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,"
If I am following this thread correctly, I think it is useful to consider
that, although the article I posted earlier shows how to override methods of
objects passed in *as parameters*, the same technique is useful in
overriding methods of the actual test subject during testing, as I think you
are realizing in terms of overriding the getLocale() method.
At first, it feels like a violation of the normative Heisenberg uncertainty
principle because you are *changing the class you are testing*, but unit
testing is concerned with particular *methods*, not classes. Therefore, as
long as you do not override the method you are testing with the anonymous
inner class, you can actually use an anonymous inner class to redefine an
object you are about to test, including any methods except the one you are
testing. I can provide a code example if necessary (I need to write one for
the article anyway).
Tom