Booking options
拢29.99
拢29.99
On-Demand course
4 hours 28 minutes
All levels
Learn to effectively integrate and build RESTful API clients into Java and Spring Boot applications using WireMock.
WireMock is a simulator for HTTP-based APIs or MockServer. REST APIs are everywhere today as they're the modern and easiest way to build functionality and expose them to the real world. When it comes to writing unit test cases that involve REST-based interactions, there is always a challenge in testing error responses, network faults, latency, and timeouts. WireMock will solve the problem of application code that depends on an external service by mocking the actual service. In the microservices architecture, It is pretty common for services to depend on one another and it's always a challenge to write test cases for code that depends on other external services. WireMock provides the necessary tools to simulate an external service so that code that depends on the external service can be tested; this helps to build a robust REST client.
This course covers the following techniques using WireMock:
路 Service virtualization
路 Simulating an external service
路 Simulating latency
路 Simulating error responses
路 Simulating network errors Learn to integrate the most powerful HTTP Mock library, WireMock, into your applications to build a resilient and robust REST API client.
All the code and supporting files for this course are available at - https://github.com/PacktPublishing/WireMock-for-Java-Developers
Complete knowledge of how to build resilient RESTful API clients
Write automated tests which involve RESTful API clients using JUnit
Using WireMock as a powerful tool to simulate HTTP interactions
Mock an external service using WireMock
Build a robust REST client by simulating network errors, network latency
Learn to mock a RESTful Service
Learn to write unit tests that involve RESTful API interactions
This course is for developers who would like to learn to build RESTful API clients using Spring WebClient, Java developers who would like to learn to build resilient RESTful API clients and developers who are working in the microservice architecture and would like to learn how to simulate other services involving REST API invocations. Developers who would like to write unit tests that cover latency, timeouts, and network faults and also who would like to write unit tests that depend on other services.
This is a completely hands-on course where students will write a lot of code to learn WireMock concepts. Concepts are explained theoretically at first and then followed by a demo.
This course will help students to learn about how to write unit tests involving RESTful API integrations * Write unit tests that cover all possible scenarios in a REST-based interaction
https://github.com/packtpublishing/wiremock-for-java-developers
Dilip Sundarraj is a software engineer who has experience with building software since 2008. He is passionate about learning modern technologies and staying up to date with all the modern technologies, tools, frameworks, and more. He loves to share his knowledge with the world and that is one of the key reasons for him to be in the online teaching industry.
He loves interacting with other software developers and believes that this helps him share knowledge and learn from them. During his leisure time, he loves to play cricket, watch movies, and work out in the gym to have a balance between physical and mental strength.
Dilip has a YouTube channel named Code with Dilip, where he has been sharing a lot of technical content related to languages, frameworks, best practices, and more.
1. Getting Started with Course
1. Course Introduction & Objectives In this video, the author will give you all a quick introduction to the course and its objectives. |
2. Pre-Requisites In this video, the author will cover the pre-requisites that's needed to enrol in this course. |
2. Introduction to WireMock
1. Why WireMock? In this video, the author will explain about the need for WireMock and how it helps with seamless integration of RESTFUL API integrations into your project. |
2. What is WireMock? In this video, the author will give you all a quick introduction to What is Wiremock? |
3. WireMock vs Mocking Libraries In this tutorial, the author will cover the differences between wiremock and the mocking libraries in Java (Mockito). |
3. Setting up the WorkSpace for the course
1. Overview of the application In this video, the author will give you a quick overview of the application that we are going to build as part of this course. |
2. Set up the Movies RESTFUL Service In this video, the author will set up the movies restful service. |
3. Exploring the Movies RESTFUL Service In this video, the author will explore the different endpoints that's part of the Movies restful service. |
4. Build REST Clients using Spring WebClient - Hands On
1. Setting up the Movies App In this video, the author will set up MoviesApp client application. This is a gradle based project that uses Spring WebClient, Lombok, Jackson JSON library and Junit5. |
2. RestTemplate vs Spring WebClient In this video, the author will cover the differences between the Spring Webclient and RestTemplate. |
3. Setting up the Movies Domain In this video, the author will set up the movies domain object to parse the HttpRequest and response. |
4. Build Movies REST Client using Spring WebClient In this lecture the author will write code to build the MoviesRestClient class using the Spring WebClient. |
5. Build Movies REST Client test using JUnit5 In this video, the author will write the JUnit test for the MoviesRestClient using Junit 5 |
6. WebClient - Retrieve Movie by Movie-ID In this video, the author will write the code to build the REST client to retrieve the movie by movie-id. |
7. WebClient - Retrieve Movie by Movie-Name In this video, the author write the code to build the REST client to retrieve the movies by movie-name. |
8. WebClient - Retrieve Movie by Year In this video, the author writes the code to build the REST client to retrieve the movies by movie-year. |
9. WebClient - Add a new Movie -HTTP POST In this video, the author writes the code to build the REST client to perform a "POST" call to add a new movie to the service. |
10. WebClient - Update a Movie - HTTP PUT In this video, the author writes the code to build the REST client to perform a "PUT" http call to update an existing movie. |
11. WebClient - Delete a Movie - HTTP DELETE In this video, the author writes the code to build the REST client to perform a "DELETE" call to delete a movie using ID. |
5. Setting Up WireMock
1. Configuring WireMock In this video we will add necessary dependencies to set up wiremock in the JUnit Test Case for the Movies App application |
6. Build Stubs Using WireMock - Hands On
1. Overview In this video, the author will give you all a quick overview of whats covered in this section. |
2. Create the very first Stub In this video, we will code the first stub with wiremock using the anyUrl() method and have the RestClient interact with WireMock Server instead of the actual Movie Service. |
3. How WireMock works Behind the scenes and Matches the Stub? In this video, we will explain about how WireMock works behind the scenes to match the stub. |
4. URL Matching Stub - urlPathEqualTo() In this video, we will code and learn the different approaches of creating a stub matching the urls using the urlPathEqualTo(). |
5. URL Matching Stub using urlPathMatching() In this video, we will code and learn about how do we match a URL with path parameter and create a stub thats dynamic to read any path parameter value. |
6. Generate Dynamic Http Response using ResponseTemplateTransformer In this video, we will code and learn about how to dynamically generate the response based on the input to the httprequest. |
7. Stub with 400 HttpStatus as Response In this video, we will code and learn about how to create a wiremock stub thats going to return a 404 HttpResponse. |
8. Stub matches a Query Param using urlEqualTo() In this video, we will code and learn the urlEqualTo() method thats part of the WireMock DSL to match the correct HTTP request. |
9. Generate Dynamic Response Stub by reading Query Param from the request In this video, we will code and learn about how to build a dynamic response stub based on the input from the httprequest. |
10. Stub with RequestBody - HTTP POST In this video, we will code and learn about how to create a wiremock stub that matches a request body. |
11. Dynamic Response Stub - HTTP POST In this video, we will code and learn about how to create a dynamic wiremock stub using Response Templating. |
12. Stub with 400 Bad Request Response - HTTP POST In this video, we will code and learn about how to create a stub that's going to respond with 400 Bad Request response. |
13. Stub for HTTP PUT In this video, we will code and learn about how to create a stub for a HTTP PUT. |
14. Stub for HTTP Delete In this video we will code and learn about how to create a stub for a HTTP DELETE. |
7. Verifying the Stubs - Hands On
1. Why Verify the Stubs? In this video we will learn about "Why do we need to verify the Stub"? |
2. Explore the verify DSL In this video, we will code and learn about "How to use Verify DSL" to make sure the endpoint that returns no response body is invoked or not. |
8. Simulating Server/Fault Responses - Hands On
1. Introduction to Server/Fault Responses In this video, we will give you all quick introduction to server/fault responses in a REST based interaction. |
2. Simulating 5xx Response In this video, we will code and explore about how to create stubs for the 5xx Response Codes. |
3. Simulating Fault Responses - Network Errors In this video, we will code and learn about how to simulate network errors. |
9. Simulating Latency - Hands On
1. Configuring read/write Timeout - Spring Webclient In this video, we will code and learn about how to configure a read and write timeout in WebClient |
2. Simulating Latency In this video, we will code and learn about simulating Latency and testing the client times out within the given time. |
10. Selective Proxying - Hands On
1. What is Selective Proxying? In this video, we will learn about "What is Selective Proxying?" and what is the benefit that comes with selective proxying. |
2. Simulating Selective Proxying Learn more about simulated selective proxying. |
11. Running WireMock on Junit 4
1. WireMock on JUnit4 In this video, we will learn about changes that needs to be done to run WireMock in JUnit4 environment. |
2. Run WireMock on JUnit4 In this video, we will code and learn about how to run a WireMock in a JUnit4 based environment. |
12. Running WireMock on Spring Boot - Hands On
1. Overview and Project SetUp In this video, the author will give you all a quick overview of what's covered in this section and set up the base project for this section. |
2. Building the Client Code In this video, we will move the client code from the movie's app project to this one. |
3. Run WireMock on Spring Boot using @AutoConfigureWireMock - Approach 1 In this video, we will learn about writing unit tests that interact with wiremock server using the Spring boot annotation @AutoConfigureWireMock. |
4. Run WireMock on Spring Boot using WireMockRule- Approach 2 In this video, we will learn about how to write a JUNIT test using WireMockRule in a Spring Boot Project |
13. Running WireMock with Spring Boot and JUnit5
1. Configuring Spring Boot for JUnit5 In this video, we will code and learn about how to configure JUnit5 in a Spring Boot project. |
2. Run WireMock with Spring Boot and JUnit5 In this video, we will code and learn about how to configure and run WireMock in a JUnit5 Platform. |
3. Run WireMock with Spring Boot/JUnit5 using WireMockExtension In this video, we will code and learn about how to configure and run WireMock in a JUnit5 Platform using WireMockExtension annotation. |