Practical Junit & Mockito Test with Java SpringBoot & JPA

Practical Junit & Mockito Test with Java SpringBoot & JPA

Practical Junit & Mockito Test with Java SpringBoot & JPA

Learn about Test Driven Development & how its implemented in companies for Java SpringBoot project using Junit & Mockito

Language: english

Note: 4.3/5 (38 notes) 7,805 students

Instructor(s): Ranjan Pandey

Last update: 2022-07-23

What you’ll learn

  • You will learn about Unit testing and Test Driven Development(TDD) Approach
  • You will learn to write Junit and Mockito test cases for various scenarios
  • You will learn about Spring, SpringBoot and Create REST API’s using different Annotations
  • You will learn to code with Layered Architecture approach
  • You will learn about Hibernate and JPA ORM framework and how to work with them
  • You will learn all this by the help of a project and complete hands-on



  • Basics of Java Programming Language



Welcome to this amazing course, where you will learn about:

  1. What is unit testing?

  2. Why is unit testing important?

  3. What is Test Driven Development(TDD) ?

  4. How to apply Test Driven Development to the projects?

  5. What is Junit and Mockito?

We will learn to write unit tests using Junit 5 Framework and Mockito Library.

We will start with how projects are developed in software companies using modern stacks like Java, Spring, SpringBoot, Hibernate, Spring Data JPA and Restful webservices.

In this course you will be understanding how different technology and its components work together to build a real world application which end users are able to use in real life. It will be a Property Management System.

We will also learn to relate different concepts with real world examples. In this course we will learn the following:

  • We will learn different concepts Spring Framework and RESTful webservices

  • We will learn about different design patterns like Singleton, Prototype, Factory, MVC, Adapter etc

  • We will learn to create production ready application in a layered architecture

  • We will learn about ORM and Spring data JPA(Java Persistence API)

  • What is Unit Testing

  • What is TDD(Test Driven Development)

  • Why is Testing important

  • What is Junit and Mockito

  • Different Annotations of Junit and Mockito

  • Comparison between Junit-4 and Junit-5

  • Writing Test cases for the project’s different API endpoints

  • Checking the code coverage & Debugging

  • Writing Test cases for Success, Failure and Error scenarios

  • Test cases for Model classes

  • You will also get the complete source code used in the course.


Who this course is for

  • Anyone who wants to become a real backend developer and start to work in companies as a developer of develop high quality projects of their own


Course content

  • Introduction Setup and Concept Building
    • Course Overview
    • About your Instructor
    • What is Unit Testing and Test Driven Development
    • Software Installation
    • Generating Springboot starter project
    • Walkthrough of Springboot starter project files and folders
    • Introduction to Spring Framework and SpringBoot
    • RESTful webservices Http methods Status code SpringBoot Annotation
    • MVC Design Pattern Part-1
    • MVC Design Pattern Part-2
    • Understanding and Creating DTO
    • Understanding RESTful webservice with practical example
    • Understanding RequestParam annotation with practical code example
    • Undesrtanding PathVariable annotation with practical code example
    • Undesrtanding Post Put Delete annotation and ResponseEntity with practical code
  • Layered Architecture, ORM Framework and Creating new property API
    • Save new property Post endpoint
    • Creating Service layer Dependency Injection Autowired Singleton Prototype
    • Understanding Layered Architecture and Need for different database in DTAP
    • Overview of Hibernate ORM Framework and JPA specification
    • Understanding how ORM framework like Hibernate work and different hibernate
    • Working on Entity class and understanding different JPA annotation
    • Saving Property in DB with PropertyRepository
    • MVC pattern
    • Added PropertyConverter for DTO to Entity
    • Sending back the new entity along with status using ResponseEntity
  • GET, PUT, PATCH, DELETE operation on properties
    • Get All Properties
    • PutMapping and full update of a property
    • Partial update of price or Description using patch operation
    • Delete property by property id and Delete mapping
  • Unit Test & Different Annotations
    • What is Junit
    • What are Annotations in Java
    • BeforeEach Annotation
    • AfterEach Annotation
    • BeforeAll and AfterAll Annotation
    • Test Annotation
    • Disabled Annotation
    • DisplayName Annotation
    • ParameterizedTest and ValueSource Annotation
    • RepeatedTest Annotation
    • Tag Annotation
  • Lifecycle of Test and Assertions
    • Life cycle of a Junit Test
    • What is meant by Assertion
    • Different Assertion methods
  • Writing Test Cases with JUnit 5
    • Package structure and Dependency
    • Writing Our First Junit and Mockito Test
    • Applying BeforeEach and AfterEach to our Test scenarios
    • Applying BeforeAll and AfterAll to the test scenarios
    • Code Coverage By Writing Test for Different Scenarios
    • Static Import of Assert Function
    • Writing Test for Complex Object with multiple Assertions
  • Writing Test Cases for Controller Layer
    • Writing Test for PropertyController & understanding why we need Mock Annotation
    • Usage of Mock Annotation to avoid dependencies getting null value
    • Using When Then to bypass the dependency in our testing logic
    • Test case for Get All Properties method in controller
    • Test case for update price method in controller
  • Writing Test Cases for Converter & Service layer
    • Test case for Converter DTO to Entity
    • Test case for Converter Entity to DTO
    • Testing Saved Property of Service Layer
    • Test case for Get All Properties in Service
    • Test case for Update All Properties in Service
    • Test case for Update Description for Property in Service
  • Writing Test cases for Exception and Model
    • Testing Exception Scenario – Part-1
    • Testing Exception Scenario – Part-2
    • Testing the Model or DTO classes
  • Source Code
    • Source Code


Practical Junit & Mockito Test with Java SpringBoot & JPAPractical Junit & Mockito Test with Java SpringBoot & JPA

Time remaining or 280 enrolls left


Don’t miss any coupons by joining our Telegram group 

Udemy Coupon Code 100% off | Udemy Free Course | Udemy offer | Course with certificate