Booking options
£89.99
£89.99
On-Demand course
3 hours 55 minutes
All levels
This is a very comprehensive introduction to Spring Boot Test, which includes Mockito, JUnit, JSONassert, Spring Data JPA, REST, design pattern, and many more. You will learn to write JUnit tests with Spring Boot and Mockito for RESTful services.
Spring Boot is the most popular framework to develop RESTful services. It has awesome unit testing capabilities through the Spring Boot Starter Test. Mockito is the most popular mocking framework. JUnit is the most popular Java unit testing framework. You will build the unit tests step by step (in 40 easy steps). This course would be a perfect first step as an introduction to unit testing with the Spring Boot and Mockito frameworks. You will be using Spring (dependency management), Spring Boot, Maven (dependency management), Eclipse (IDE), in-memory database H2 and Tomcat embedded web server. We will help you set up each one of these. You will use all the frameworks that are part of the Spring Boot Starter Test: JUnit, Spring Test, Spring Boot Test, AssertJ, Hamcrest, Mockito, JSONassert, and JSONPath. You will also learn how to use the most important unit testing annotations: @RunWith(SpringRunner.class), @SpringBootTest, @WebMvcTest, @DataJpaTest, and @MockBean. By the end of this course, you will be able to write awesome unit tests for your RESTful services. The code files and resource files are uploaded on the GitHub repository at https://github.com/packtpublishing/master-java-unit-testing-with-spring-boot-and-mockito
Write great unit and integration tests using Spring Boot Starter Test
Write unit tests using Mocks and Spys created with Mockito
Use Mock Mvc to test hello world controller
Use the most important unit testing annotations
Learn and use all frameworks of Spring Boot Starter Test
Write integration tests using an in-memory database, H2
You are a Spring / Spring Boot / Java programmer, and you want to write awesome unit tests for your RESTful services. You want to write awesome unit tests with mocking. You want to understand the best practices in writing great unit tests with JUnit, Mockito, and Spring Boot Starter Test. You want to learn how to write great asserts with Hamcrest Matchers, JSONassert, Assert J, and JSON Path libraries.
This course uses a hands-on approach to teach you how to build unit tests for simple RESTful services with Spring Boot Starter Test, Mockito, and JUnit.
Build the unit tests step-by-step in 40 easy steps * Write independent unit tests for RESTful web services talking with multiple layers-web, business, and data * Write awesome unit tests for simple RESTful services with Spring Boot Starter Test, Mockito, and JUnit
https://github.com/packtpublishing/master-java-unit-testing-with-spring-boot-and-mockito
Ranga Karanam is a seasoned technologist and architect with over two decades of expertise in programming, design, and architecture. He founded in28Minutes with the goal of helping students master cutting-edge cloud-native technologies such as AWS, Azure, Google Cloud, Docker, and Kubernetes. With 15 years of experience in Java programming and design, Ranga has collaborated with top banking clients worldwide. His passion for creating hands-on courses with real-world projects motivated him to develop the Step-By-Step series of courses that follow a problem-solution-based approach, with practical and real-world application examples. Ranga and his team at in28Minutes specialize in Java and related frameworks such as Spring, Spring Boot, Spring MVC, Struts, and Hibernate. They are committed to equipping learners with the skills and knowledge necessary to succeed in today's rapidly evolving technology landscape.
1. Introduction
1. Introduction This video provides an introduction to the course. |
2. Course Overview This video provides an overview and structure of this course. |
2. Mocking with Mockito
1. Step 00 - Section Introduction - Mocking with Mockito This video provides an overview of Mockito. |
2. Step 01 - Setting Up the Project Using Spring Initializr This video explains how you set up the project using Spring Initializr. |
3. Step 02 - Writing a Unit Test for a Simple Business Service This video demonstrates how to write a unit test for a simple business service. |
4. Step 03 - Setting Up a Business Service to call a Data Service Step 03 - Setting Up a Business Service to call a Data Service |
5. Step 04 - Writing Your First Unit Test with Stub This video explains writing your first unit test with Stub. |
6. Step 05 - Exercise Solution - Updating Tests 2 and 3 to Use Stub This video provides a solution to the exercise - updating tests 2 and 3 to use Stub. |
7. Step 06 - Writing Unit Tests with Mocking Using Mockito This video explains how to write tests with mocking using Mockito. |
8. Step 07 - Exercise Solution - Updating Tests 2 and 3 to Use Mockito This video provides a solution to the exercise - updating tests 2 and 3 to use Mockito. |
9. Step 08 - More Refactoring - @Mock, @InjectMocks, and @RunWith(MockitoJUnitRunner) This video explains refactoring with @Mock, @InjectMocks, and @RunWith(MockitoJUnitRunner). |
10. Step 09 - Mockito Tips - Multiple Return Values and Specific Argument Matchers This video explores Mockito tips on multiple return values and specific argument matchers. |
11. Step 10 - Mockito Tips - Argument Matchers This video explores Mockito tips on argument matchers. |
12. Step 11 - Mockito Tips - Verify Method Calls This video explores Mockito tips on method calls. |
13. Step 12 - Mockito Tips - Argument Capture This video explores Mockito tips on argument capture. |
14. Step 13 - Mockito Tips - Argument Capture on Multiple Calls This video explores Mockito tips on argument capture on multiple calls. |
15. Step 14 - Introduction to Spy This video introduces you to Spy. |
16. Step 15 - Mockito FAQs This video demonstrates Mockito FAQs. |
3. Unit Testing with Spring Boot and Mockito
1. Step 00 - Section Introduction - Unit Testing with Spring Boot and Mockito This video provides an introduction to unit testing with Spring Boot and Mockito. |
2. Step 01 - Creating a Hello World Controller This video demonstrates how to create a Hello World controller. |
3. Step 02 - Using MockMvc to Test the Hello World Controller This video explains how to use MockMvc to test the Hello World controller. |
4. Step 03 - Using Response Matchers to Check Status and Content This video explains how to use response matchers to check status and content. |
5. Step 04 - Creating a Basic REST Service in Item Controller This video explains how to create a basic REST service in Item controller. |
6. Step 05 - Unit Testing Item Controller and Basic JSON Assertions This video explains about the unit testing Item controller and basic JSON assertions. |
7. Step 06 - Digging Deeper into JSONassert This video helps you dig deeper into JSONassert. |
8. Step 07 - Writing a REST Service talking to Business Layer This video shows how to write a REST service talking to business layer. |
9. Step 08 - Writing Unit Test for REST Service Mocking Business Layer This video provides knowledge on writing unit tests for REST service mocking business layer. |
10. Step 09 - 00 - Overview of Steps 09 to 15 This video provides an overview of concepts we learned from steps 9 to 15. |
11. Step 09 - 01 - Prepare Data Layers with JPA, Hibernate, and H2 This video explains how to prepare data layers with JPA, Hibernate, and H2. |
12. Step 10 - Create Item Entity and Populate Data with data.sql This video explains how to create item entity and populate data with data.sql. |
13. Step 11 - Create a RESTful Service Talking to the Database This video shows how to create a RESTful service talking to the database. |
14. Step 12 - Writing Unit Test for Web Layer - Controller - Using MockMvc This video will dive deep into writing a unit test for web layer and controller using MockMvc. |
15. Step 13 - Exercise and Solution - Writing Unit Test for Business Layer ? Mocking This is an exercise and solution video where you will be writing a unit test for business layer and mocking. |
16. Step 14 - Writing Unit Test for Data Layer - Data JPA Test This video shows how to write a unit test for data layer using data JPA test. |
17. Step 15 - Writing an Integration Test Using @SpringBootTest This video shows how to write an integration test using @SpringTest. |
18. Step 16 - Tip - Using @MockBean to Mock Out Dependencies that are Not Required This video provides a tip that is about using @MockBean to mock out dependencies you do not want to talk about. |
19. Step 17 - Tip - Creating Different Test Configuration This video explains how to create different test configuration. |
20. Step 18 - Writing Unit Tests for Other Request Methods This video explains how to execute unit tests for other request methods. |
21. Step 19 - Refactor SomeBusinessImpl to Use Functional Programming This video explains how to refactor SomeBusinessImpl to use functional programming. |
22. Step 20 - Better Assertions with Hamcrest ? HamcrestMatcherTest In this video, you?ll see better assertions with Hamcrest ? HamcrestMatcherTest. |
23. Step 21 - Better Assertions with AssertJ ? AssertJTest This video demonstrates better assertions with AssertJ ? AssertJTest. |
24. Step 22 - Better Assertions with JSONPath ? JSONPathTest This video shows how to do better Assertions with JSONPath ? JSONPathTest. |
25. Step 23 - Tip Patterns ? xunitpatterns This video explains about xunitpatterns. |
26. Step 24 - Tip - Measuring Test Coverage with Eclipse This video shows how to measure test coverage with eclipse. |
27. Step 25 - Tip - Keep an Eye on Performance of Unit Tests! This video provides us with a tip on how to keep an eye on the performance of unit tests. |
28. Step 26 - Good Unit Tests This video shows what are good unit tests. |
4. Congratulations
1. Next Steps This video tells what your next steps should be post completion of this course. |