What is JUnit 5? (+Video Tutorial)

What is JUnit 5? JUnit 5 is actually a combination of three main elements. It’s a mix of JUnit Platform, JUnit Jupiter API, and JUnit Vintage API.

Let’s break it down.

JUnit Platform

Think of JUnit 5 as having a solid foundation called the JUnit Platform. This platform is like the engine that gets your testing frameworks up and running on the Java Virtual Machine (JVM). It provides a Test Engine that lets you develop and execute your testing frameworks. What’s cool is that it’s supported by many popular Java development environments like Netbeans, IntelliJ, Eclipse, and also by build tools like Gradle, Maven, and Ant. So, essentially, it’s what makes your JUnit tests tick.

JUnit Jupiter API

Now, when it comes to writing those unit tests, that’s where the JUnit Jupiter API comes into play. Jupiter is the fancy name for the API you’ll be using to create your unit tests on the JUnit Platform. This API brings some fresh air with its new programming model and extension model. With Jupiter API, you get access to different test annotations and assertions to make your test methods solid. Plus, it comes with an extension API that lets you customize your own Test API, giving you even more flexibility.

JUnit Vintage

Before JUnit 5 came along, we had JUnit 3 and JUnit 4.

Now, if you still have projects using those older versions, don’t sweat it. JUnit Vintage is here to help. It’s a Test Engine designed specifically to run those older unit tests written with the previous JUnit API versions. This means you can have a project that mixes both the old and new JUnit methods – the vintage and the Jupiter – and they’ll work together just fine.

What is JUnit 5? (Video Lesson)


So, in a nutshell, JUnit 5 is all about these three components working together. You’ve got the JUnit Platform as the foundation, the Jupiter API for writing your tests, and the Vintage for those older tests. Together, they make JUnit 5, a powerful tool we’ll be using throughout this video course.

To learn more about JUnit 5 and Mockito, please check my Testing Java Code tutorials.