4.44 out of 5
4.44
747 reviews on Udemy

Master Java Unit Testing with Spring Boot & Mockito

Learn to write awesome Java JUnit unit tests with Spring Boot, Mockito, JsonAssert, Hamcrest & JsonPath in 40 easy steps
Instructor:
in28Minutes Official
4,136 students enrolled
English [Auto-generated]
You will learn to WRITE GREAT UNIT and INTEGRATION Tests using Spring Boot Starter Test from SCRATCH
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 - @SpringBootTest, @WebMvcTest, @DataJpaTest and @MockBean
Use ALL the FRAMEWORKS in Spring Boot Starter Test - JUnit, Spring Test, Spring Boot Test, AssertJ, Hamcrest, Mockito, JSONassert and JsonPath.
You will learn to write unit tests using MOCKS and SPYS created with MOCKITO
You will learn to Write Integration Tests using an IN MEMORY DATABASE - H2

Great Programmers write Great Unit Tests. Want to Write Great Unit Tests for Spring Boot REST API ?

Spring Boot Test?   Yes.    Layered Unit Tests?  Yes. Of Course.    Spring Boot Integration Tests?   Yes.

Mockito?  Yes.                     JsonAssert, Hamcrest Matchers, and JsonPath?  Yes.  Included.

******* Some Amazing Reviews From Our Learners *******

★★★★★ This a very comprehensive introduction to spring boot test, which brings Mockito, Junit, JsonAssert, Spring Data JPA, REST, design pattern, and many more. Very valuable course. Thanks.

★★★★★ Excellent and to the point course on Unit testing with good references.

★★★★★ This is an excellent course for both beginners as well as experienced Java developers who which to hone their skill. The instructor was very knowledgeable and knew how to keep the course engaging while providing lots of tips. Highly recommended

******* Course Overview *******

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 most popular Java Unit Testing Framework.

In this course, you will learn to Write Great Unit Tests for Simple RESTful Services with Spring Boot Starter Test, Mockito and JUnit. You will learn to write independent unit tests for RESTful web services talking with multiple layers – web, business and data. You will learn how to write integration tests using an in memory database H2.

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 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 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.

******* What You Can Expect from Every in28Minutes Course *******

in28Minutes created 20 Best Selling Courses providing Amazing Learning Experiences to 250,000 Learners across the world.

Each of these courses come with

✔ Amazing Hands-on Step By Step Learning Experiences

✔ Real Project Experiences using the Best Tools and Frameworks

✔ Awesome Troubleshooting Guides with 200+ FAQs Answered

✔ Friendly Support in the Q&A section

✔ Free Udemy Certificate of Completion on Completion of Course

✔ 30 Day “No Questions Asked” Money Back Guarantee!

~~~ Here are a Few Reviews on The in28Minutes Way ~~~

★★★★★ Excellent, fabulous. The way he has prepared the material and the way he teaches is really awesome. What an effort .. Thanks a million

★★★★★ A lot of preparation work has taken place from the teacher and this is visible throughout the course.

★★★★★ This guy is fantastic. Really. Wonderful teaching skills, and goes well out of his way to make sure that everything he is doing is fully understood. This is the kind of tutorial that gets me excited to work with a framework that I may otherwise not be.

★★★★★ The best part of it is the hands-on approach which the author maintained throughout the course as he had promised at the beginning of the lecture. He explains the concepts really well and also makes sure that there is not a single line of code you type without understanding what it really does.

★★★★★ I also appreciate the mind and hands approach of teaching something and then having the student apply it. It makes everything a lot clearer for the student and uncovers issues that we will face in our project early.

★★★★★ Amazing course. Explained super difficult concepts (that I have spent hours on the internet finding a good explanation) in under 5 minutes.

Zero risk. 30 day money-back guarantee with every purchase of the course. You have nothing to lose!

Start Learning Now. Hit the Enroll Button!

******* Step By Step Details *******

Section 1 – Learning Mocking with Mockito

  • Step 01: Setting up the project using Spring Initializr

  • Step 02: Writing Unit Test for a Simple Business Service

  • Step 03: Setting up a Business Service to call a Data Service

  • Step 04: Writing your first unit test with Stub

    • Exercise – Update Tests 2 & 3

  • Step 05: Exercise Solution – Updating Tests 2 & 3 to use Stubs – Problem with Stubs.

  • Step 06: Writing Unit Tests with Mocking using Mockito

    • Exercise – Updating Tests 2 & 3 to use Mockito

  • Step 07: Exercise Solution – Updating Tests 2 & 3 to use Mockito

  • Step 08: More Refactoring – @Mock, @InjectMocks and @RunWith(MockitoJUnitRunner.class)

  • Step 09: Mockito Tips – Multiple Return Values and Specific Argument Matchers

  • Step 10: Mockito Tips – Argument Matchers

  • Step 11: Mockito Tips – Verify method calls

  • Step 12: Mockito Tips – Argument Capture

  • Step 13: Mockito Tips – Argument Capture on Multiple Calls

  • Step 14: Introduction to Spy

  • Step 15: Mockito FAQ

Section 2 – Unit Testing RESTful Services 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: 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 to!

  • 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: Easier Static Imports

  • Step 24: Tip : Measuring Test Coverage with Eclipse

  • Step 25: Tip : Keep an eye on performance of unit tests!

  • Step 26: Good Unit Tests

Zero risk. 30 day money-back guarantee with every purchase of the course. You have nothing to lose!

Start Learning Now. Hit the Enroll Button!

Introduction

1
Introduction
2
Course Overview

Section 1 - Mocking With Mockito

1
Step 00 - Section Introduction - Mocking with Mockito
2
Step 01 - Setting up the project using Spring Initializr
3
Step 02 - Writing Unit Test for a Simple Business Service
4
Step 03 - Setting up a Business Service to call a Data Service
5
Step 04 - Writing your first unit test with Stub
6
Step 05 - Exercise Solution - Updating Tests 2 & 3 to use Stubs
7
Step 06 - Writing Unit Tests with Mocking using Mockito
8
Step 07 - Exercise Solution - Updating Tests 2 & 3 to use Mockito
9
Step 08 - More Refactoring - @Mock, @InjectMocks and @RunWith(MockitoJUnitRunner
10
Step 09 - Mockito Tips - Multiple Return Values and Specific Argument Matchers
11
Step 10 - Mockito Tips - Argument Matchers
12
Step 11 - Mockito Tips - Verify method calls
13
Step 12 - Mockito Tips - Argument Capture
14
Step 13 - Mockito Tips - Argument Capture on Multiple Calls
15
Step 14 - Introduction to Spy
16
Step 15 - Mockito FAQ

Section 2 - Unit Testing With Spring Boot And Mockito

1
Step 00 - Section Introduction - Unit Testing with Spring Boot and Mockito
2
Fastest Approach to Solve All Your Exceptions
3
Step 01 - Creating a Hello World Controller
4
Step 02 - Using Mock Mvc to test Hello World Controller
5
Step 03 - Using Response Matchers to check status and content
6
Step 04 - Creating a Basic REST Service in Item Controller
7
Step 05 - Unit Testing Item Controller and Basic JSON Assertions
8
Step 06 - Digging deeper into JSON Assert
9
Step 07 - Writing a REST Service talking to Business Layer
10
Step 08 - Writing Unit Test for REST Service mocking Business Layer
11
Step 09 - 00 - Overview of Steps 09 to 15
12
Step 09 - 01 - Prepare Data Layers with JPA, Hibernate and H2
13
Step 10 - Create Item Entity and Populate data with data.sql
14
Step 11 - Create a RESTful Service talking to the database
15
Step 12 - Writing Unit Test for Web Layer - Controller - Using Mock MVC
16
Step 13 - Exercise & Solution - Writing Unit Test for Business Layer - Mocking
17
Step 14 - Writing Unit Test for Data Layer - Data JPA Test
18
Step 15 - Writing an Integration Test using @SpringBootTest
19
Step 16 - Tip - Using @MockBean to mock out dependencies you do not want to talk
20
Step 17 - Tip - Creating Different Test Configuration
21
Step 18 - Writing Unit Tests for Other Request Methods
22
Step 19 - Refactor SomeBusinessImpl to use Functional Programming
23
Step 20 - Better Assertions with Hamcrest - HamcrestMatcherTest
24
Step 21 - Better Assertions with AssertJ - AssertJTest
25
Step 22 - Better Assertions with JSONPath - JSONPathTest
26
Step 23 - Tip Patterns - xunitpatterns
27
Step 24 - Tip - Measuring Test Coverage with Eclipse
28
Step 25 - Tip - Keep an eye on performance of unit tests!
29
Step 26 - Good Unit Tests

Congratulations

1
Bonus Lecture : Coupons for My Best-Selling Courses -30 Day Money Back Guarantee
2
Next Steps
You can view and review the lecture materials indefinitely, like an on-demand channel.
Definitely! If you have an internet connection, courses on Udemy are available on any device at any time. If you don't have an internet connection, some instructors also let their students download course lectures. That's up to the instructor though, so make sure you get on their good side!
4.4
4.4 out of 5
747 Ratings

Detailed Rating

Stars 5
329
Stars 4
326
Stars 3
80
Stars 2
12
Stars 1
4
db1032ead5fb9a1b7b90bd4db11d5550
30-Day Money-Back Guarantee

Includes

4 hours on-demand video
2 articles
Full lifetime access
Access on mobile and TV
Certificate of Completion