Sinon stubbing a function passed as a parameter
<p>I have the following Example class:</p>

<pre><code>function Example() {...}
Example.prototype.someFunc1() {...}
Example.prototype.someFunc2() {...}
Example.prototype.func(func) {var res = func(); ...}
</code></pre>

<p>I usually call <code>Example#func()</code> as follows:</p>

<pre><code>var example = new Example();
example.func(example.someFunc1)
// or like this, depending on what I want
example.func(example.someFunc2)
</code></pre>

<p>Now I stub <code>Example#someFunc1()</code> as follows in my test:</p>

<pre><code>var example = new Example();
sinon.stub(example, 'someFunc1').returns(...);
exmaple.func(example.someFunc1);
</code></pre>

<p>Problem is that <code>Example#someFunc1()</code> is not being stubbed this way and being called normally. What can I do in such situation ?</p>