In flex I want to do something similar to the following
var audioPlayerMock:AudioPlayer = AudioPlayer(mockRepository.createStub(mockRepository.createStub(AudioPlayer));
SetupResult.forCall(audioPlayerMock.play).(CALL_ACTUAL_PLAY_METHOD(WITH_ARGUMENT));
AudioPlayer has a lot of methods that I want stubbed, (so I use mockRepository.creatStub()
). But there is one method, play()
, that I want to call the actual actual method (super.play(argument)
if my thinking is right). I'm not sure how to do this?
I know I can use createDynamic(AudioPlayer)
then stub out every other method, but that is a bit tedious.
Cheers
You can use
IMethodOptions.callOriginalMethod()
to call the actual implementation on a stubbed class: