title: Mocking simple property access with JMockIt
body: <p>I have a simple get-set interface:</p>
  
  <pre><code>public interface Foo {
  
      void setBaz(String baz);
      String getProcessedBaz();    
  }
  </code></pre>
  
  <p><br>
  This interface is a dependency of my actual class under test. I'm trying to mock out <code>Foo</code> to have this effective behavior:</p>
  
  <pre><code>public class MockedFoo implements Foo {
  
      private String bazField;
  
      @Override
      public void setBaz(String baz) {
          bazField = baz;
      }
  
      @Override
      public String getProcessedBaz() {
          return "PROCESSED_" + bazField;
      }
  }
  </code></pre>
  
  <p><br>
  So my expected result is:</p>
  
  <pre><code>mockedFoo.setBaz("ABC");
  assertEquals("PROCESSED_ABC", mockedFoo.getProcessedBaz());
  </code></pre>
  
  <p><br>
  I was able to capture the method argument using <code>withCapture</code> in a <code>Verification</code>, but how do I set up an <code>Expectation</code> with that same input value? It seems you can do either one or the other.</p>
  
  <p>Is there a way to express this in JMockIt? I'm using the latest version (1.9).</p>
  
  <hr>
  
  <p><strong>NOTE</strong>: I'm aware that I can simply set up a <code>Mockup&lt;Foo&gt;</code> instance and put in all the code above. However, my real code is much more complex and I would prefer not to hand-craft the entire mock class.</p>