2009/4/9 Jeudy, Guillaume <
gjeudy@...>:
> Hi,
>
> I don't know how you setup your tests but if you have a separate folder containing test classes with exactly the same package structure as your production classes you should be able to make you run() method package-private or protected. That way you don't give on too much encapsulation and you still allow your PresenterTest class to see the Presenter run method.
>
But then the tests aren't exercising the object in the same way as
it's used in the production code, so there's a risk of a defect
slipping in, and of tests diverging from the code when either are
changed. That's why I prefer to put tests in a different package from
the production code: they are forced to exercise the object through
its API without reaching in through some backdoor. And, if that's
difficult, it pushes me to sort out the design problems that are
making it difficult.
In this case, I'd implement an Action that held on to the listener and
let you call back to it from the test. For a simple example, see
http://www.jmock.org/gwt.html.
--Nat
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email