1996fanrui commented on code in PR #23218: URL: https://github.com/apache/flink/pull/23218#discussion_r1321290658
########## flink-runtime/src/test/java/org/apache/flink/runtime/state/SnapshotDirectoryTest.java: ########## @@ -19,180 +19,167 @@ package org.apache.flink.runtime.state; import org.apache.flink.util.FileUtils; -import org.apache.flink.util.TestLogger; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.util.Arrays; import java.util.UUID; -/** Tests for the {@link SnapshotDirectory}. */ -public class SnapshotDirectoryTest extends TestLogger { +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; - private static TemporaryFolder temporaryFolder; +/** Tests for the {@link SnapshotDirectory}. */ +class SnapshotDirectoryTest { - @BeforeClass - public static void beforeClass() throws IOException { - temporaryFolder = new TemporaryFolder(); - temporaryFolder.create(); - } - - @AfterClass - public static void afterClass() { - temporaryFolder.delete(); - } + @TempDir private Path temporaryFolder; /** Tests if mkdirs for snapshot directories works. */ @Test - public void mkdirs() throws Exception { - File folderRoot = temporaryFolder.getRoot(); + void mkdirs() throws Exception { + File folderRoot = temporaryFolder.toFile(); File newFolder = new File(folderRoot, String.valueOf(UUID.randomUUID())); File innerNewFolder = new File(newFolder, String.valueOf(UUID.randomUUID())); Path path = innerNewFolder.toPath(); - Assert.assertFalse(newFolder.isDirectory()); - Assert.assertFalse(innerNewFolder.isDirectory()); + assertThat(newFolder).doesNotExist(); + assertThat(innerNewFolder).doesNotExist(); SnapshotDirectory snapshotDirectory = SnapshotDirectory.permanent(path); - Assert.assertFalse(snapshotDirectory.exists()); - Assert.assertFalse(newFolder.isDirectory()); - Assert.assertFalse(innerNewFolder.isDirectory()); - - Assert.assertTrue(snapshotDirectory.mkdirs()); - Assert.assertTrue(newFolder.isDirectory()); - Assert.assertTrue(innerNewFolder.isDirectory()); - Assert.assertTrue(snapshotDirectory.exists()); + assertThat(snapshotDirectory.exists()).isFalse(); + assertThat(newFolder).doesNotExist(); + assertThat(innerNewFolder).doesNotExist(); Review Comment: Thanks for the clarification, sounds good to me! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org