Question

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

Was it helpful?

Solution

You can use IMethodOptions.callOriginalMethod() to call the actual implementation on a stubbed class:

SetupResult.forCall(authatoPlayerMock.play(null))
    .ignoreArguments()
    .callOriginalMethod();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top