title: Override a method in a mock object
body: <p>I need to write a unit test in which one of the dependencies of the tested object will be mocked. In that mocked object I would like to override one function (I do not care about the other functions at all).</p>
  
  <p>What I need to do, is to provide a completely new implementation of that function. I am not particularly happy with providing mockito-style <code>when / thenResult</code> pairs for each potential input, i.e. I do not want to write:</p>
  
  <pre><code>when(mock.foo(5)).thenResult(3)
  when(mock.foo(7)).thenResult(121)
  ...
  </code></pre>
  
  <p>I would rather like to write something like:</p>
  
  <pre><code>mock.foo = (a: Int) =&gt; if (a == 5) 3 else ...
  </code></pre>
  
  <p>Which mocking framework should I choose to substitute the whole implementation of a function in an easy way? </p>