Udemy
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
Development
Web Development Data Science Mobile Development Programming Languages Game Development Database Design & Development Software Testing Software Engineering Development Tools No-Code Development
Business
Entrepreneurship Communications Management Sales Business Strategy Operations Project Management Business Law Business Analytics & Intelligence Human Resources Industry E-Commerce Media Real Estate Other Business
Finance & Accounting
Accounting & Bookkeeping Compliance Cryptocurrency & Blockchain Economics Finance Finance Cert & Exam Prep Financial Modeling & Analysis Investing & Trading Money Management Tools Taxes Other Finance & Accounting
IT & Software
IT Certification Network & Security Hardware Operating Systems Other IT & Software
Office Productivity
Microsoft Apple Google SAP Oracle Other Office Productivity
Personal Development
Personal Transformation Personal Productivity Leadership Career Development Parenting & Relationships Happiness Esoteric Practices Religion & Spirituality Personal Brand Building Creativity Influence Self Esteem & Confidence Stress Management Memory & Study Skills Motivation Other Personal Development
Design
Web Design Graphic Design & Illustration Design Tools User Experience Design Game Design Design Thinking 3D & Animation Fashion Design Architectural Design Interior Design Other Design
Marketing
Digital Marketing Search Engine Optimization Social Media Marketing Branding Marketing Fundamentals Marketing Analytics & Automation Public Relations Advertising Video & Mobile Marketing Content Marketing Growth Hacking Affiliate Marketing Product Marketing Other Marketing
Lifestyle
Arts & Crafts Beauty & Makeup Esoteric Practices Food & Beverage Gaming Home Improvement Pet Care & Training Travel Other Lifestyle
Photography & Video
Digital Photography Photography Portrait Photography Photography Tools Commercial Photography Video Design Other Photography & Video
Health & Fitness
Fitness General Health Sports Nutrition Yoga Mental Health Dieting Self Defense Safety & First Aid Dance Meditation Other Health & Fitness
Music
Instruments Music Production Music Fundamentals Vocal Music Techniques Music Software Other Music
Teaching & Academics
Engineering Humanities Math Science Online Education Social Science Language Teacher Training Test Prep Other Teaching & Academics
AWS Certification Microsoft Certification AWS Certified Solutions Architect - Associate AWS Certified Cloud Practitioner CompTIA A+ Cisco CCNA Amazon AWS CompTIA Security+ Microsoft AZ-900
Photoshop Graphic Design Adobe Illustrator Drawing Digital Painting InDesign Character Design Canva Figure Drawing
Life Coach Training Neuro-Linguistic Programming Mindfulness Personal Development Personal Transformation Meditation Life Purpose Coaching Neuroscience
Web Development JavaScript React CSS Angular PHP WordPress Node.Js Python
Google Flutter Android Development iOS Development Swift React Native Dart Programming Language Mobile Development Kotlin SwiftUI
Digital Marketing Google Ads (Adwords) Social Media Marketing Google Ads (AdWords) Certification Marketing Strategy Internet Marketing YouTube Marketing Email Marketing Retargeting
SQL Microsoft Power BI Tableau Business Analysis Business Intelligence MySQL Data Analysis Data Modeling Big Data
Business Fundamentals Entrepreneurship Fundamentals Business Strategy Online Business Business Plan Startup Freelancing Blogging Home Business
Unity Game Development Fundamentals Unreal Engine C# 3D Game Development C++ Unreal Engine Blueprints 2D Game Development Blender
30-Day Money-Back Guarantee

This course includes:

  • 4 hours on-demand video
  • 7 articles
  • 1 downloadable resource
  • Full lifetime access
  • Access on mobile and TV
Development Web Development Unit Testing

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
Rating: 4.5 out of 54.5 (2,705 ratings)
13,584 students
Created by in28Minutes Official
Last updated 12/2020
English
English [Auto], French [Auto], 
30-Day Money-Back Guarantee

What you'll learn

  • 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
Curated for the Udemy for Business collection

Course content

4 sections • 55 lectures • 3h 59m total length

  • Preview03:25
  • Preview02:12

  • Preview01:32
  • Preview02:56
  • COURSE UPDATE: JUNIT 4 vs JUNIT 5
    00:14
  • Preview06:03
  • Step 03 - Setting up a Business Service to call a Data Service
    03:49
  • Step 04 - Writing your first unit test with Stub
    04:56
  • Step 05 - Exercise Solution - Updating Tests 2 & 3 to use Stubs
    03:47
  • Step 06 - Writing Unit Tests with Mocking using Mockito
    05:38
  • Step 07 - Exercise Solution - Updating Tests 2 & 3 to use Mockito
    04:11
  • JUnit 5 Alert
    00:07
  • Step 08 - More Refactoring - @Mock, @InjectMocks and @RunWith(MockitoJUnitRunner
    03:25
  • Step 09 - Mockito Tips - Multiple Return Values and Specific Argument Matchers
    05:52
  • Step 10 - Mockito Tips - Argument Matchers
    02:58
  • Step 11 - Mockito Tips - Verify method calls
    06:40
  • Step 12 - Mockito Tips - Argument Capture
    04:04
  • Step 13 - Mockito Tips - Argument Capture on Multiple Calls
    02:33
  • Step 14 - Introduction to Spy
    07:42
  • Step 15 - Mockito FAQ
    03:24

  • Preview02:46
  • Preview00:22
  • Step 01 - Creating a Hello World Controller
    03:40
  • JUnit 5 Alert
    00:10
  • Step 02 - Using Mock Mvc to test Hello World Controller
    12:40
  • Step 03 - Using Response Matchers to check status and content
    05:07
  • Step 04 - Creating a Basic REST Service in Item Controller
    05:08
  • Step 05 - Unit Testing Item Controller and Basic JSON Assertions
    04:05
  • Step 06 - Digging deeper into JSON Assert
    12:26
  • Step 07 - Writing a REST Service talking to Business Layer
    04:10
  • Step 08 - Writing Unit Test for REST Service mocking Business Layer
    06:51
  • Step 09 - 00 - Overview of Steps 09 to 15
    01:41
  • COURSE UPDATE : H2 Database URL
    00:15
  • Step 09 - 01 - Prepare Data Layers with JPA, Hibernate and H2
    03:24
  • Step 10 - Create Item Entity and Populate data with data.sql
    06:00
  • Step 11 - Create a RESTful Service talking to the database
    07:54
  • Step 12 - Writing Unit Test for Web Layer - Controller - Using Mock MVC
    06:11
  • Step 13 - Exercise & Solution - Writing Unit Test for Business Layer - Mocking
    05:27
  • JUnit 5 Alert
    00:10
  • Step 14 - Writing Unit Test for Data Layer - Data JPA Test
    08:01
  • JUnit 5 Alert
    00:10
  • Step 15 - Writing an Integration Test using @SpringBootTest
    08:51
  • Step 16 - Tip - Using @MockBean to mock out dependencies you do not want to talk
    05:03
  • Step 17 - Tip - Creating Different Test Configuration
    03:40
  • Step 18 - Writing Unit Tests for Other Request Methods
    03:28
  • Step 19 - Refactor SomeBusinessImpl to use Functional Programming
    03:49
  • Step 20 - Better Assertions with Hamcrest - HamcrestMatcherTest
    08:37
  • Step 21 - Better Assertions with AssertJ - AssertJTest
    06:27
  • Step 22 - Better Assertions with JSONPath - JSONPathTest
    09:38
  • Step 23 - Tip Patterns - xunitpatterns
    01:22
  • Step 24 - Tip - Measuring Test Coverage with Eclipse
    04:25
  • Step 25 - Tip - Keep an eye on performance of unit tests!
    03:03
  • Step 26 - Good Unit Tests
    05:34

  • Bonus Lecture
    02:44
  • Next Steps
    00:50

Requirements

  • You have an attitude to learn while having fun :)
  • You should have working knowledge of Java, Junit, Spring, Spring Boot and JPA/Hibernate.
  • We will help you install Eclipse and get up and running with Maven and Tomcat.

Description

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.


WHAT OUR LEARNERS ARE SAYING:

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

5 STARS - Excellent and to the point course on Unit testing with good references.

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

5 STARS - Great Course to learn Junit Testing. Great content and great examples to explain each scenarios of writing test cases. If you want to write java test cases then definitely go through this course.

5 STARS - This course is a great introduction to unit and integration testing using Spring Boot, Mockito, and a number of other libraries that can help to write effective tests. It is easy to follow along with and has plenty of references where to look for more information.

5 STARS - Needed it for new client project. Excellent source of concise tutorials for JUnit of microservices.

5 STARS - I was drowning in unit test concepts and this course cleared up what read about them. And have a simple but clear explanation of when is good and how to create unit test in your app.


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.


COURSE HIGHLIGHTS


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


Start Learning Now. Hit the Enroll Button!


Who this course 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 to write great asserts with Hamcrest Matchers, JSON Assert, Assert J and JSON Path libraries

Featured review

Abdul Wajeed
Abdul Wajeed
16 courses
14 reviews
Rating: 4.5 out of 5a year ago
The way the lectures were presented,Easy to approach instruction. Very organised and helpful at anytime. Great teacher, who knows the material. I am confident that I firmly understand Mockito framework from Ranga teaching.

Instructor

in28Minutes Official
DevOps, AWS, Docker, Kubernetes, Java & Spring Boot Experts
in28Minutes Official
  • 4.5 Instructor Rating
  • 125,326 Reviews
  • 620,118 Students
  • 43 Courses

Ranga is an AWS Certified Solutions Architect Associate, AWS Certified Developer Associate and AWS Certified Cloud Practitioner.

We are teaching 30+ Courses to 450K Learners on DevOps, Cloud ( AWS, PCF, GCP, and Azure ), Full Stack (  React, Angular ), Java Programming, and Java Frameworks ( Spring, Spring Boot, Spring MVC,  Hibernate ).

[LEARNING PATHS 00 to 06 for DevOps, Full Stack, Cloud,  Spring Boot and Java in the FAQ below]

We use Problem-Solution based Step-By-Step Hands-on Approach With Practical, Real-World Application Examples.

We have a wide range of courses focused on Spring Boot -  Creating APIs and Microservices, Deploying to Cloud ( AWS, Azure, Docker, Kubernetes, Azure ), and Integrating with Full Stack Front end frameworks ( React & Angular ).


[LEARNING PATHS]


[LEARNING PATH 00] - DevOps 

Master DevOps with Docker, Kubernetes and Azure DevOps


[LEARNING PATH 00] - DevOps 

Master DevOps with Docker, Kubernetes and Azure DevOps


[LEARNING PATH 01] - Spring and Spring Boot Web Applications & API Developer

Spring Framework Master Class - Learn Spring the Modern Way!

Learn Spring Boot in 100 Steps - Beginner to Expert

Master Java Web Services and RESTful API with Spring Boot

Master Hibernate and JPA with Spring Boot in 100 Steps

Master Java Unit Testing with Spring Boot & Mockito


[LEARNING PATH 02] - Full Stack Developer with Spring Boot, React and Angular

Go Java Full Stack with Spring Boot and React

Go Java Full Stack with Spring Boot and Angular


[LEARNING PATH 03] - Cloud Microservices with Spring Boot, Docker & Kubernetes

Master Microservices with Spring Boot and Spring Cloud

Master Docker with Java - DevOps for Spring Microservices

Master Kubernetes with Docker on Google Cloud, AWS & Azure


[LEARNING PATH 04] - Cloud Developer with Spring Boot, AWS, Azure, and PCF

Learn AWS - Deploy Java Spring Boot to AWS Elastic Beanstalk

Master Azure Web Apps - Take Java Spring Boot Apps to Azure

Master Pivotal Cloud Foundry with Spring Boot Microservices


[LEARNING PATH 05] - Learn AWS with Microservices, Docker, and Kubernetes

Learn AWS - Deploy Java Spring Boot to AWS Elastic Beanstalk

Master AWS Fargate & ECS with Java Spring Boot Microservices

Master Kubernetes with Docker on Google Cloud, AWS & Azure


[LEARNING PATH 06] - GET AWS CERTIFIED

AWS Certified Cloud Practitioner - Step By Step

AWS Certified Developer Associate  - Step By Step

AWS Certified Solutions Architect Associate - Step By Step


[OUR BELIEFS]

Best Courses are interactive and fun.

Foundations for building high-quality applications are best laid down while learning.


[OUR APPROACH]

We use the 80-20 Rule. We discuss 20% of things used 80% of the time in depth. We touch upon other things briefly equipping you with enough knowledge to find out more on your own.

Problem Solution based Step by Step Hands-on Learning.


  • Udemy for Business
  • Teach on Udemy
  • Get the app
  • About us
  • Contact us
  • Careers
  • Blog
  • Help and Support
  • Affiliate
  • Terms
  • Privacy policy
  • Cookie settings
  • Sitemap
  • Featured courses
Udemy
© 2021 Udemy, Inc.