From cefc31d88c36e774d1bc1eaa2d8e9d1711164637 Mon Sep 17 00:00:00 2001 From: Si Jie Date: Sun, 10 Feb 2019 15:18:56 +0800 Subject: [PATCH] JUnit: Upgrade to JUnit 5.4.0 We write our tests using the JUnit 5.1.0 API. The JUnit 5.1.0 API contains most features we require, such as assertTrue or assertThrows. We have unit tests such as StorageManagerTest#prefsReadSave that require writing to the filesystem. These tests need to make use of temporary directories. This is so that (1) we can begin with a clean, known state at the start of each test and (2) we can prevent our test output from polluting the user's file system. However, JUnit 5.1.0 does not support creating temporary directories natively, so developers need to create a custom TemporaryDirectory implementation or rely on JUnit-Pioneer library [1]. Both of these solutions make it complicated to implement and for future developers to understand. JUnit 5.4.0 is the first version of JUnit that has a native temporary directory API [2]. By upgrading to JUnit 5.4.0, we can directly use the org.junit.jupiter.api.io.TempDir API. This reduces the complexity of implementing a temporary directory. Let's upgrade to use JUnit 5.4.0. [1] https://medium.com/@GalletVictor/migration-from-junit-4-to-junit-5-d8fe38644abe [2] https://github.com/junit-team/junit5/issues/1247 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 50d578df7c4e..faea9a366bd9 100644 --- a/build.gradle +++ b/build.gradle @@ -43,7 +43,7 @@ test { dependencies { String testFxVersion = '4.0.15-alpha' - String jUnitVersion = '5.1.0' + String jUnitVersion = '5.4.0' implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.7.0' implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.7.4'