title: How do I instantiate an unirest HttpResponse<JsonNode> for my mock?
body: <p>Let's say I have a class called Api and it has a method:</p>
  
  <pre><code>public class Api{
      public HttpResponse&lt;JsonNode&gt; request() {
          try {
              return Unirest.get("http://localhost:8080").header("accept", "application/json").asJson();
          } catch (UnirestException e) {
              throw new RuntimeException(e);
          }
      }
  }
  </code></pre>
  
  <p>And I have a class:</p>
  
  <pre><code>public class Dao(){
  
      private Api api;
      public Dao(Api api){
          this.api = api;
      }
  
      public Integer test(){
          Integer result = api.request().getInteger("result");
          return result + 100;
      }
  }
  </code></pre>
  
  <p>In my test I want to test my business logic based on the response my API.request method returns.</p>
  
  <p>Something like: </p>
  
  <pre><code>import static org.mockito.Mockito.mock;
  import static org.mockito.Mockito.stub;
  import org.json.JSONObject;
  import com.mashape.unirest.http.HttpResponse;
  
  public class ApiTest {
      private API api = mock(API.class);
      public void test() {
          HttpResponse&lt;JsonNode&gt; response = null;
          JSONObject result = new JSONObject();
          response.getBody().getObject();
          stub(api.request("")).toReturn(response);
          Dao dao = new Dao(api);
          assertTrue(dao.test() &gt; 100);
      } 
  }
  </code></pre>
  
  <p>How do I instantiate the HttpResponse with a Body "{ number: 10 }" to be able to return it with the mock?</p>