title: Mock Rest Server Response for Unit Testing
body: <p>In integration testing, I use a real remote server to consume REST APIs. 
  What's the simplest way to provide those responses within a unit test w/o depending on external entity. </p>
  
  <p>One possible approach is to build </p>
  
  <pre><code>public class TestHttpResponse implements   org.apache.http.client.methods.CloseableHttpResponse
  
  override
  
   @Override
      public StatusLine getStatusLine() {
        return new StatusLine() {
          @Override
          public ProtocolVersion getProtocolVersion() {
            return null;
          }
  
          @Override
          public int getStatusCode() {
            return statusCode;
          }
  
          @Override
          public String getReasonPhrase() {
            return reasonPhrase;
          }
        };
      }
     ...
  </code></pre>
  
  <p>Is there a simpler and better way for mocking REST API response payloads?</p>