package seedu.tasklist.commons.util;

import static org.junit.Assert.assertEquals;

import java.io.File;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

public class FileUtilTest {

    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @Test
    public void getPath() {

        // valid case
        assertEquals("folder" + File.separator + "sub-folder", FileUtil.getPath("folder/sub-folder"));

        // null parameter -> assertion failure
        thrown.expect(AssertionError.class);
        FileUtil.getPath(null);

        // no forwards slash -> assertion failure
        thrown.expect(AssertionError.class);
        FileUtil.getPath("folder");
    }

}

@@ -80,28 +80,143 @@
 ls;%0A
-%0Aimport java.io.File
+import static org.junit.Assert.assertFalse;%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport java.io.File;%0Aimport java.io.IOException
 ;%0A%0Ai
@@ -833,12 +833,977 @@
 );%0A    %7D
+%0A//@@author A0141993X%0A    @Test%0A    public void isFileExists_fileExists_returnsTrue() throws IOException %7B%0A        String filePath = %22filePathExists.xml%22;%0A        File file = new File(filePath);%0A        FileUtil.createFile(file);%0A        assertTrue(FileUtil.isFileExists(file));%0A    %7D%0A%0A    @Test%0A    public void isFileExists_fileDoesNotExist_returnsFalse() %7B%0A        String filePath = %22fileDoesNotExist.xml%22;%0A        File file = new File (filePath);%0A        assertFalse(FileUtil.isFileExists(file));%0A    %7D%0A%0A    @Test%0A    public void createDirs_validDirectory_successful() throws IOException %7B%0A        String dir = %22Users/test/saveData%22;%0A        File dirFile = new File(dir);%0A        FileUtil.createDirs(dirFile);%0A    %7D%0A%0A    @Test  (expected = IOException.class)%0A    public void createDirs_invalidDirectory_throwsException() throws IOException %7B%0A        String dir = %22test%3C %5C0? save%22;%0A        File dirFile = new File(dir);%0A        FileUtil.createDirs(dirFile);%0A    %7D
 %0A%0A%7D%0A

Add test cases to improve code coverage