JUnit 5: Java Unit Tests for Beginners
4.3 (316 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
1,442 students enrolled

JUnit 5: Java Unit Tests for Beginners

Learn to write Java unit tests in practice with JUnit 5. Online course with exercises and an extra JUnit cheat sheet.
4.3 (316 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
1,442 students enrolled
Created by Adrian Więch
Last updated 5/2020
English [Auto-generated]
Current price: $69.99 Original price: $99.99 Discount: 30% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 1 hour on-demand video
  • 3 articles
  • 6 downloadable resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • Write a variety of unit test types
  • Create practical, real-world test scenarios
  • Follow unit testing best practices
  • Understand JUnit test lifecycle
  • Run unit tests in Eclipse
Course content
Expand all 25 lectures 01:09:05
+ First things first
3 lectures 07:27

Learn about the course, its author and his motivations.

Preview 01:42

Learn the essential theory of unit testing in just a few minutes.

Preview 03:17

Make sure you have the IDE and project files ready.

Preview 02:28
+ JUnit 5 – Basics
8 lectures 26:37

Write your first real-world unit test!

Preview 03:53

Learn the most fundamental rules of good unit tests.

Best practices
Test exceptions
Test with multiple assertions
Test null values
Test array equality
@BeforeEach and @AfterEach
@BeforeAll and @AfterAll
+ JUnit 5 – More Advanced Concepts
10 lectures 24:56
Parameterized Tests – ValueSource
Parameterized Tests – CsvSource
Parameterized Tests – CsvFileSource
Repeated tests
Test performance
Organise your code with @Nested
Other annotations
JUnit 5 Cheat Sheet
+ Additional videos
2 lectures 09:11
JUnit 5 vs. JUnit 4
Test-Driven Development (TDD)
+ Exercises
2 lectures 00:53
Write unit tests for RealEstateApp
Write unit tests for RealEstateApp - solution
  • Basic Java programming skills – you should be able to create classes with fields and methods, recognize primitive data types like int or String, and understand the basics of lists
  • Eclipse IDE – you can download the IDE for free

If you want to apply for your first job as a Java Developer but have never written a unit test before – this is the right course for you.

According to statistics, nearly 80% of all Java developers write unit tests with JUnit, and my developing practice proves it. It is a basic skill required by most employees, so if you want to start your Java Developer professional career, you have to master JUnit.


In this course, I'll teach you the practical basics of JUnit 5 – the latest version of the most popular Java unit testing framework.

I’ll introduce only the essential theory behind unit testing, and then dive straight into the code to get you started as quickly as possible. I’ll use an example of a simple, yet practical Java project to show you a variety of unit test types. You'll also learn the best practices and coding standards for unit tests based on my developing experience.

This course comes with additional exercises to help you review everything you have learnt from my video lectures. I’ll also provide you with a sample solution to the exercises so that you can compare your answers. As a bonus, you will get a one-page cheat sheet for a quick JUnit 5 reference.


concise – my short video lectures focused on the most important info help you save time and learn maximally effectively,

based on practice – instead of useless academic theory, you learn the best developing practices drawn from my work experience,

reasonably priced – compared to stationary developer bootcamps, the course is much cheaper, so you save not only time but also money,

available anywhere, anytime – the online form lets you run the course in the most convenient place (at home, work or in a café) and time (while commuting by metro or relaxing at home after work), so you can adjust it to your agenda,

accessible on desktop, mobile and TV – you can display my lectures on the device of your choice, so you don’t have to stick to your PC,

certificate of completion – after completing the course, you will receive a printable certificate that will make your resume more attractive.

Intro video music courtesy of Bensound

Who this course is for:
  • People with basic Java knowledge who want to learn unit testing from scratch
  • Students who want to prepare for their first IT job
  • Developers who know JUnit 4 but want to learn JUnit 5