Learn the ins and outs of the most popular mocking framework for Java applications
... with this comprehensive hands-on online course about Mockito.
New to mocking Java objects for your unit tests?
With this course you'll learn the ins and outs of Mockito
and build a solid foundation for your testing success.
We start from zero. No prior Mockito knowledge is required. After explaining why we need mocks for our unit tests, we'll go through Mockito's API step-by-step.
At the end of the course, you'll have a wide-ranged knowledge about the features of Mockito. From now on, mocking objects becomes easy.
It doesn't matter which application framework (Spring Boot, Jakarta EE, Micronaut, Helidon, Quarkus, MicroProfile, etc.) you use as Mockito is omnipresent in the Java testing ecosystem.
@Mock, @Spy, @Captor, when(), verify(),
thenReturn(), ArgumentMatcher, ...
... one might get easily overwhelmed when starting to learn Mockito ...
You are a Java developer struggling to mock the collaborators of your class under test?
You just learned the basics of testing Java applications and now need a solid understanding of Mockito?
You are getting NullPointerExceptions because your mocks do not behave as you want them to?
Let's face reality. Most of your Java classes are not as simple as a MyCalculator class. Our classes have collaborators for which we need to instruct the behavior for our tests.
Mocking is part of your daily work when testing your applications.
For Java (and also Kotlin & Scala), we have a mature and well-adopted solution for creating and instructing mocks: Mockito.
As Mockito is so omnipresent in the JVM testing landscape, a solid understanding of it is essential as a Java developer.
If you are coming from a different programming language, you'll love the user-friendly API of Mockito.
With Mockito that's different.
Compared to other programming languages and their mocking frameworks, Mockito has the most intuitive API and the steepest learning curve.
The knowledge you gain with this course applies to testing all your applications, independent of the framework (Spring Boot, Jakarta EE, Micronaut, Helidon, Quarkus, etc.).
Here’s What People Are Saying About the Course
Awesome course! I have been using Mockito for more than a couple of years, but had not figured out some of the intricacies of the library. Your explanation and examples were great and really helped clear some of the mystery around it. I now feel a lot more informed and can use that to make my tests easier and more robust.
About The Course Teacher, Philip (rieckpil)
Philip is an independent IT-Consultant living in Berlin. He started with Spring Boot back in 2015 and has used it for multiple applications in several industries. Testing is an integral part of his daily work as he is a profound craftsman.
Once Philip understood the ins and outs of the Java testing landscape, writing tests makes as much fun as writing production code for him. He is also a won around TDD (Test Driven Development) practitioner and regularly shares testing techniques among his colleagues and clients.
He started teaching Java topics on YouTube in 2018 and is writing content about the Java ecosystem on his blog since 2017.
Besides that, he's also actively helping developers on StackOverflow with their questions around testing.
Here’s what people are saying about the course instructor
Philip is a dedicated developer and doesn't give up until he has understood the details of a topic.
In his courses and articles, he transfers this knowledge to you and they leave you smarter than before.
Looking forward to working with you in the future, Philip
Philip is a very skilled content creator who managed to publish high quality articles and videos that cover a wide range of topics, like Spring, Java EE, or Jakarta EE.
He pays a lot of attention to details, so if you enjoyed his articles and videos, you are surely going to love his video courses.
What this course is not
course for dummies
course on unit testing Java applications
course about JUnit 5
...this course explains all the
essential features of Mockito using hands-on examples.
The structure of this course mirrors the lifecycle of your mocks.
Answering the question: "Why do we actually need mocks for our tests?"
Creating Mocks With Mockito
You'll learn all different ways to create mocks and get a basic understanding of how Mockito internally creates them.
Stubbing Method Calls Of A Mock
Without stubbing, mocks are just an empty shell. You'll learn how to instruct your mock's behavior (ArgumentMatchers, BDD vs. non-BDD style, stubbing void methods, etc.).
Verifying The Interaction Of A Mock
Inspect the actual interaction of your mocks and verify how your mocks were used during your test.
Miscellaneous & Advanced Topics
The final module covers several advanced topics: @Spy vs. @Mock, @MockBean vs. @Mock, mocking static methods, deep stubbing, etc.
Build Your Testing Success On Top Of a Solid Foundation
With this right-sized online course you get a practical introduction to Mockito and learn about all its features.
100% Satisfaction Guarantee for 30-Days
You are not satisfied with the content of this Mockito course? No problem!
Contact me (via Mail, Slack, Twitter, etc.) within 30 days after you got access to this course and I'll send you a refund.
Frequently asked questions
The 27 video lessons have a total length of ~ 2 hours.
As I recommend to code in parallel, I assume you'll need 3-4 hours to complete the course.
Yes, you can get a refund within 30 days if the content of this course doesn't meet your expectations.
I'm constantly update all dependencies of the course application and try to be up-to-date.
Right now the course uses Mockito 5.1.1 and JUnit 5.9.2.
As I might forget to update this section, please refer to the pom.xml of the project for the latest version.
last updated: 3rd of Februrary 2023