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
1 changed files with 6 additions and 0 deletions

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()));