From 067528211f0274922a92a3940155f67e71c66776 Mon Sep 17 00:00:00 2001 From: Alireza Tofighi Date: Fri, 21 May 2021 20:28:42 +0430 Subject: [PATCH] Add more tests for FilePathUtils.isValidDirectoryPath for better coverage --- .../java/org/schabi/newpipe/util/FilePathHelperTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/test/java/org/schabi/newpipe/util/FilePathHelperTest.java b/app/src/test/java/org/schabi/newpipe/util/FilePathHelperTest.java index 7cdc5f855..b81a06e30 100644 --- a/app/src/test/java/org/schabi/newpipe/util/FilePathHelperTest.java +++ b/app/src/test/java/org/schabi/newpipe/util/FilePathHelperTest.java @@ -12,6 +12,12 @@ import static org.junit.Assert.assertTrue; public class FilePathHelperTest { @Test public void testIsValidDirectoryPath() throws IOException { + // empty path is not valid + assertFalse(FilePathUtils.isValidDirectoryPath("")); + + // null path is not valid + assertFalse(FilePathUtils.isValidDirectoryPath(null)); + // path that exists final File dir1 = Files.createTempDirectory("dir1").toFile(); assertTrue(FilePathUtils.isValidDirectoryPath(dir1.getAbsolutePath()));