Master Java Unit Testing with Spring Boot and Mockito
Video description
Learn to write awesome Java JUnit unit tests with Spring Boot, Mockito, JSONassert, Hamcrest, and JSONPath in 40 easy steps.
About This Video
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
In Detail
Spring Boot is the …
Master Java Unit Testing with Spring Boot and Mockito
Video description
Learn to write awesome Java JUnit unit tests with Spring Boot, Mockito, JSONassert, Hamcrest, and JSONPath in 40 easy steps.
About This Video
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
In Detail
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.
Who this book is for
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.
Chapter 3 : Unit Testing with Spring Boot and Mockito
Step 00 - Section Introduction - Unit Testing with Spring Boot and Mockito
Step 01 - Creating a Hello World Controller
Step 02 - Using MockMvc to Test the Hello World Controller
Step 03 - Using Response Matchers to Check Status and Content
Step 04 - Creating a Basic REST Service in Item Controller
Step 05 - Unit Testing Item Controller and Basic JSON Assertions
Step 06 - Digging Deeper into JSONassert
Step 07 - Writing a REST Service talking to Business Layer
Step 08 - Writing Unit Test for REST Service Mocking Business Layer
Step 09 - 00 - Overview of Steps 09 to 15
Step 09 - 01 - Prepare Data Layers with JPA, Hibernate, and H2
Step 10 - Create Item Entity and Populate Data with data.sql
Step 11 - Create a RESTful Service Talking to the Database
Step 12 - Writing Unit Test for Web Layer - Controller - Using MockMvc
Step 13 - Exercise and Solution - Writing Unit Test for Business Layer ? Mocking
Step 14 - Writing Unit Test for Data Layer - Data JPA Test
Step 15 - Writing an Integration Test Using @SpringBootTest
Step 16 - Tip - Using @MockBean to Mock Out Dependencies that are Not Required
Step 17 - Tip - Creating Different Test Configuration
Step 18 - Writing Unit Tests for Other Request Methods
Step 19 - Refactor SomeBusinessImpl to Use Functional Programming
Step 20 - Better Assertions with Hamcrest ? HamcrestMatcherTest
Step 21 - Better Assertions with AssertJ ? AssertJTest
Step 22 - Better Assertions with JSONPath ? JSONPathTest
Step 23 - Tip Patterns ? xunitpatterns
Step 24 - Tip - Measuring Test Coverage with Eclipse
Step 25 - Tip - Keep an Eye on Performance of Unit Tests!
Step 26 - Good Unit Tests
Chapter 4 : Congratulations
Next Steps
Start your Free Trial Self paced Go to the Course We have partnered with providers to bring you collection of courses, When you buy through links on our site, we may earn an affiliate commission from provider.
This site uses cookies. By continuing to use this website, you agree to their use.I Accept