Jason G
unread,Jun 1, 2011, 5:54:19 PM6/1/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Mockolate
Hello everyone
I'm new to ActionScript/Flex, so this may be a dumb question, but I'd
love to use Mockolate to replace a protected getter on the target
class.
We're using PureMVC, and I'm writing a test against one of our
Proxies. I'd like to replace Notifier::facade() to return a mocked
IFacade. This way I don't have to do any complex setup, and I can
directly test the Proxy's onRegister() behavior.
The test code contains:
var cut : FriendProxy = partial(FriendProxy);
var mockFacade : IFacade = nice(IFacade);
mock(cut).getter("facade").returns(mockFacade);
But when the test is run, "facade" uses the original getter, not our
mock wrapper. Further playing around seems to show that only public
getters and methods can be overridden this way... Overriding a
protected getter is effectively a no-op.
Am I wrong, and there's a way to do this? Or is there a reason why we
can only tweak public methods?
I sure hope we can, since this would greatly help our ability to test
individual behaviors without having to poke "For Testing Only" holes
in everything or having to wire up more objects than a test truly
needs.
Thank you for your time!
Jason