title: Test service with 3rd party API calls
body: <p>I have a service with business logic and http calls (using Unirest) to a third party service.</p>
  <p>public PaymentLinkResult generatePaymentLink(PaymentLinkParams paymentLinkParams) throws GatewayException {</p>
  <pre><code>    // BUSINESS LOGIC
  
      HttpResponse&lt;JsonNode&gt; response;
      try (UnirestInstance service = Unirest.spawnInstance()) {
          response = service.post(apiBaseUrl + &quot;/api/v1/openOrder.do&quot;)
                  .body(body)
                  .asJson();
      }
  
      if (response.getBody() == null) {
          // BUSINESS LOGIC
      }
  
      // BUSINESS LOGIC
  }
  </code></pre>
  <p>I created a test for this service,  my goal is to test the business logic without making a real HTTP call to the 3rd party service. Basically i want to test if the request is created correctly and if the output is correct.</p>
  <p>I'm struggling to find the best way to handle this scenario with Spring Boot. I know how to mock the entire method but i would like to mock only the HTTP call part.</p>