Master Java Unit Testing with Spring Boot and Mockito [Video]

Master Java Unit Testing with Spring Boot and Mockito [Video]

Ranga Karanam
New Release!

Learn to Write Awesome Java JUnit Unit Tests with Spring Boot and Mockito in 40 Easy Steps
Mapt Subscription
FREE
€29.73/m after trial
Video
€158.80
RRP €186.81
Save 14%
What do I get with a Mapt subscription?
  • Unlimited access to all Packt’s 6,000+ eBooks and Videos
  • 100+ new titles a month, learning paths, assessments & code files
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
€0.00
€158.80
€29.74 p/m after trial
RRP €186.81
Subscription
Video
Start 14 Day Trial

Frequently bought together


Master Java Unit Testing with Spring Boot and Mockito [Video] Book Cover
Master Java Unit Testing with Spring Boot and Mockito [Video]
€ 186.81
€ 158.80
Master Java Web Services and REST API with Spring Boot [Video] Book Cover
Master Java Web Services and REST API with Spring Boot [Video]
€ 196.33
€ 166.89
Buy 2 for €35.42
Save €292.20
Add to Cart

Video Details

ISBN 139781789346077
Course Length3 hours 55 minites

Video Description

Spring Boot is the most popular framework to develop RESTful services. It has awesome unit testing capabilities through 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 (dependencies 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 learn to use the most important unit testing annotations - @RunWith(SpringRunner.class), @SpringBootTest, @WebMvcTest, @DataJpaTest and @MockBean.

Style and Approach

In this course, you will learn to build unit tests for simple RESTful services with Spring Boot Starter Test, Mockito and JUnit.

Table of Contents

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 Mock Mvc to test 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 JSON Assert
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 Mock MVC
Step 13 - Exercise & 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 you do not want to talk
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
Congratulations

What You Will Learn

  • You will learn to write great Unit and Integration tests using Spring Boot Starter Test
  • You will learn to write unit tests using Mocks and Spys created with Mockito
  • You will learn to write independent unit tests for RESTful web services talking with multiple layers - web, business and data
  • You will learn to use the most important Unit Testing Annotations - @RunWith(SpringRunner), @SpringBootTest, @WebMvcTest, @DataJpaTest, and @MockBean.
  • You will learn to use all the frameworks that are part of Spring Boot Starter Test - JUnit, Spring Test, Spring Boot Test, AssertJ, Hamcrest, Mockito, JSONassert, and JsonPath.
  • You will learn to write integration tests using an in-memory database - H2

Authors

Table of Contents

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 Mock Mvc to test 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 JSON Assert
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 Mock MVC
Step 13 - Exercise & 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 you do not want to talk
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
Congratulations

Video Details

ISBN 139781789346077
Course Length3 hours 55 minites
Read More

Read More Reviews

Recommended for You

Master Java Web Services and REST API with Spring Boot [Video] Book Cover
Master Java Web Services and REST API with Spring Boot [Video]
€ 196.33
€ 166.89
Master Microservices with Spring Boot and Spring Cloud [Video] Book Cover
Master Microservices with Spring Boot and Spring Cloud [Video]
€ 196.33
€ 166.89
Master Hibernate and JPA with Spring Boot in 100 Steps [Video] Book Cover
Master Hibernate and JPA with Spring Boot in 100 Steps [Video]
€ 196.33
€ 166.89
Learn Java Unit Testing with JUnit 5 in 20 Steps [Video] Book Cover
Learn Java Unit Testing with JUnit 5 in 20 Steps [Video]
€ 186.81
€ 158.80
Hands-On Full Stack Development with Spring Boot 2.0 and React Book Cover
Hands-On Full Stack Development with Spring Boot 2.0 and React
€ 35.68
€ 24.99
Mastering The Faster Web with PHP, MySQL, and JavaScript Book Cover
Mastering The Faster Web with PHP, MySQL, and JavaScript
€ 30.92
€ 21.65