Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Coursera

Master Java Unit Testing with Spring Boot and Mockito

Packt via Coursera

Overview

In this course, you will embark on a journey to master unit testing using Mockito and Spring Boot. Starting with an introduction to Mockito, you'll learn how to set up your projects using Spring Initializr and write your first unit tests. As you progress, you'll delve deeper into creating business services, utilizing stubs, and updating tests to use Mockito effectively. The course meticulously guides you through various unit testing scenarios, including setting up business services to call data services, writing unit tests with stubs, and mocking using Mockito. You'll explore advanced techniques such as refactoring with @Mock, @InjectMocks, and @RunWith(MockitoJUnitRunner), and learn valuable tips for argument matchers, verify method calls, and argument capture. In the final sections, the focus shifts to integrating Mockito with Spring Boot. You'll create and test RESTful services, work with data layers using JPA and Hibernate, and perform integration tests with @SpringBootTest. Each module is designed to build on the previous one, ensuring a seamless and comprehensive learning experience. This course is ideal for Java developers with a basic understanding of Spring Boot who are looking to enhance their unit testing capabilities. A fundamental knowledge of Java and familiarity with basic Spring Boot concepts are prerequisites.

Syllabus

  • Introduction
    • In this module, we will introduce the course, outlining its goals and structure. You will gain an understanding of the importance of unit testing and the key technologies we will cover, including Spring Boot and Mockito.
  • Mocking with Mockito
    • In this module, we will dive into mocking with Mockito, starting with setting up a Spring Boot project. You will learn to write unit tests for business services, explore the use of stubs and mocks, and master Mockito annotations and techniques for effective mocking.
  • Unit Testing with Spring Boot and Mockito
    • In this module, we will cover unit testing with Spring Boot and Mockito, focusing on creating and testing RESTful services. You will write unit tests for various application layers, explore integration testing, and enhance test assertions using advanced libraries like Hamcrest and AssertJ.
  • Congratulations
    • In this module, we will discuss the next steps after completing the course. You will be guided towards additional resources for further learning, explore advanced unit testing topics, and reflect on how to apply your newly acquired skills in real-world scenarios.

Taught by

Packt

Reviews

Start your review of Master Java Unit Testing with Spring Boot and Mockito

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.