title: How to mock the WebResource Rest call
body: <p>How to mock the following  lines of code </p>
  
  <pre><code>WebResource jobBuilder = restClient.resource(jobBuilderUrl);
  String jobXml = jobBuilder
      .accept(MediaType.APPLICATION_XML)
      .type(MediaType.APPLICATION_JSON)
      .entity(request)
      .post(String.class);
  </code></pre>
  
  <p>I have tried to mock it using easy mock with the following code but it is returning a NullPointerException</p>
  
  <pre><code>WebResource jobBuilder = EasyMock.createMock(WebResource.class);
  expect(jobBuilder
      .accept(MediaType.APPLICATION_XML)
      .type(MediaType.APPLICATION_JSON)
      .entity(EasyMock.notNull())
      .post(String.class)).andReturn("&lt;test&gt;&lt;/test&gt;");
  replay(jobBuilder);
  </code></pre>