title: Is there a way to partially mock an object using EasyMock?
body: <p>E.g. let's say I have this class:</p>
  
  <pre><code>public class Foo Implements Fooable {
    public void a() {
      // does some stuff
      bar = b();
      // moar coadz
    }
    public Bar b() {
      // blah
    }
    // ...
  }
  </code></pre>
  
  <p>And I want to test <code>Foo.a</code>. I want to mock <code>Foo.b</code>, because I'm testing that method separately. What I'm imagining is something like this:</p>
  
  <pre><code>public class FooTest extends TestCase {
    public void testA() {
      Fooable foo = createPartialMock(
        Fooable.class,  // like with createMock
        Foo  // class where non-mocked method implementations live
      );
  
      // Foo's implementation of b is not used.
      // Rather, it is replaced with a dummy implementation
      // that records calls that are supposed to be made;
      // and returns a hard coded value (i.e. new Bar()).
      expect(foo.b()).andReturn(new Bar());
  
      // The rest is the same as with createMock:
      //   1. Stop recording expected calls.
      //   2. Run code under test.
      //   3. Verify that recorded calls were made.
      replay(foo);
      foo.a();
      verify(foo);
    }
  }
  </code></pre>
  
  <p>I know I can write my own <code>Foo</code> subclass to do this sort of thing for me. But I don't want to do that if I don't have to, because it's tedious i.e. should be automated.</p>