1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 16:40:32 +00:00

Add more tests for FilePathUtils.isValidDirectoryPath for better coverage

This commit is contained in:
Alireza Tofighi 2021-05-21 20:28:42 +04:30
parent 92ab9cae27
commit 067528211f

View File

@ -12,6 +12,12 @@ import static org.junit.Assert.assertTrue;
public class FilePathHelperTest { public class FilePathHelperTest {
@Test @Test
public void testIsValidDirectoryPath() throws IOException { 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 // path that exists
final File dir1 = Files.createTempDirectory("dir1").toFile(); final File dir1 = Files.createTempDirectory("dir1").toFile();
assertTrue(FilePathUtils.isValidDirectoryPath(dir1.getAbsolutePath())); assertTrue(FilePathUtils.isValidDirectoryPath(dir1.getAbsolutePath()));