Showing posts with the label Apache HttpClient

Unit testing Apache HttpClient with MockWebServer from OkHttp

Hello everyone, here you will learn unit testing Apache HttpClient with MockWebServer from OkHttp.  The  Source code download link is provided at the end of this tutorial. The Apache HttpClient library allows handling HTTP requests. To use this library add a dependency to your Maven or Gradle build file. You find the latest version here: MockWebServer makes it possible to facilely test how our apps comport when making HTTP/HTTPS calls. A mock web server is a program that mocks the behaviour of an actual remote server but doesn't make calls over the internet world. Technologies Used: Java 17 Apache HttpClient OkHttp MockWebServer Maven 3+ Jackson databinder Final project directory: Apache HttpClient, Okhttp mockwebserver, Jackson databinder dependencies <properties> <> 17 </> <maven.compiler.source> 17 </maven.compiler.source>