title: Mock chained methods using EasyMock
body: <p>How do you mock a chained method call in EasyMock? I have a chained method call:</p>
  
  <pre><code>srvc.getServiceManager().getDetails(Integer.parseInt(msgId));
  </code></pre>
  
  <p>I've tried to do </p>
  
  <pre><code>expect(srvc.getServiceManager().getDetails(Integer.parseInt(msgId)))
    .andReturn((String) notNull());
  </code></pre>
  
  <p>This throws a <code>NullPointerException.</code> </p>
  
  <p>Trying to break this into two expectations also does not work. In that case I get </p>
  
  <blockquote>
    <p>matcher calls were used outside expectations</p>
  </blockquote>
  
  <p>How do I get around this issue?</p>