From the course: Gradle for Java-Based Applications and Libraries
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Using the JUnit 5 test framework
From the course: Gradle for Java-Based Applications and Libraries
Using the JUnit 5 test framework
- [Instructor] In the optimal case, developers write test code alongside the production source code to verify that the changes they made work as expected. The Java ecosystem embraced a JUnit as the de facto test framework. In this video, we'll set up a test case with the help of the latest JUnit version, JUnit 5. The following videos we'll then touch on the Gradle automation aspects for exercising the tests and inspecting the generated reports. The Gradle Java plugin expects to find test source code in the directory, source test Java. If you need additional resource files, you'd place them in the directory source test resources. I already set up a project that contains a test class, named CalculatorTest.java. It tests the functionality of the production class, calculator.java, and therefore adds the suffix, test, to its name. You can see here that the test class contains four methods, one method for each function of the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.