Description
Course info
Level
Intermediate
Updated
Sep 26, 2019
Duration
2h 2m
Description

JUnit 5 is the de-facto standard testing framework on the JVM. It is used to test application code in many areas including enterprise, desktop, and mobile applications.

In this course, Unit Testing with JUnit 5 and Kotlin, you will learn how to set up JUnit to test Kotlin code, including some of the issues you will encounter that are unique to Kotlin.

First, you will see how to set up your environment to use JUnit 5 for Kotlin including setting up Gradle and Maven environments and using an IDE to run the tests.

Next, you will be introduced to Kluent, a Kotlin fluent assertions library. Then, you will see how to change assertions using this fluent syntax, as well as new, cleaner ways of writing assertions using the Kluent APIs.

Finally, you will explore ‘mocking’ using MockK, a mocking framework written in and for Kotlin.

When you are finished with this course, you will have the skills to test Kotlin code using JUnit and how to refactor code to make it testable.

About the author
About the author

Kevin has spent way too many years in the software industry. Starting on PL/1 on IBM mainframes then graduating through dBase IV to Windows and eventually onto Java, .Net and now JavaScript where he finally thinks he has found a home until the next new shiny comes along.

More from the author
Introduction to the Java API for Web Sockets
Intermediate
1h 53m
Jun 5, 2020
Architecting Web Applications with Spring
Intermediate
1h 58m
Jun 2, 2020
More courses by Kevin Jones
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone. My name is Kevin Jones, and welcome to my course, Unit Testing with JUnit 5 and Kotlin. I'm a developer and owner at Rock Solid Knowledge, a software development company based in the United Kingdom. Kotlin is the hot new language on the JVM, and like code written in any language, code written in Kotlin needs to be tested and testable. JUnit 5 is the latest version of the most widely-used testing framework in the Java world. And this course covers how these two fit together. As well as covering JUnit 5, mocking, and fluent APIs, the course will cover the difficult issues you come across when testing. How do you create tests with static code, how do you test code that relies on dates, and how do you test code that wants to access the file system? Some of the major topics we will cover include setting up and running tests with JUnit 5, creating and using mocks with MockK, using Kluent to create fluent APIs, wrapping the file API, and creating a date time provider. By the end of this course, you'll know how to test Kotlin code using JUnit, and understand how to refactor code so the previously-harder test code becomes testable. Before beginning the course, you should be familiar with programming Kotlin.