If I write something like this:
verify().that( mockPromise.handleFault( any() ))
it works fine to tell me that ‘handleFault’ was invoked.
But later I want to invoke the fault handler function that was passed in. The handler will be a private function so there isn’t another way to access it.
In Java Mockito, the feature you’re looking for is called
ArgumentCaptor. In short, it’s a special kind ofMatcher(likeany()) that matches any type of object and keeps the object it “matches” in a variable.Unfortunately, it looks like it’s not available in Flex yet.
The good news is that if you feel like it, you can probably write an implementation of the
Matcherinterface that does exactly that–save its most recent value and return true–in fifteen minutes or so. 🙂Good luck!