title: EasyMock Expect Field Value is Null
body: <p>I am new to EasyMock, usually use Mockito, so please excuse this if it is a stupid question, but I have an expect call that uses one of the fields from the class I am testing. The problem is that since execute is ran before the actually method call, the field is null.</p>
  
  <pre><code>public class ClassToTest {
      SomeObject someObject = null;
      AnotherObject anotherObject;
  
      public String testMethod() {
          someObject = new SomeObject();
          String result = anotherObject.someMethod(someObject);
          System.out.println(result);
      }
  
      // Some other code here
  }
  </code></pre>
  
  <p><code>ClassToTest testClass = new ClassToTest();
  AnotherObject mockedObject = createMock(AnotherObject.class);
  expect(mockedObject.someMethod(testClass.someObject)).andStubReturn("test");
  testClass.testMethod();</code></p>
  
  <p>In Mockito this would be written as
  <code>when(mockObject.someMethod(testClass.someObject)).thenReturn("test");</code>
  and whatever someObject is at that point in execution would be used. However, using EasyMock, since someObject is null at the time that the expect call is set up, the call expects null as a parameter.</p>
  
  <p>Is there a way in EasyMock to instead get whatever the field is at the point in the code when someMethod is actually called?</p>