FileManagement package

Lots of work this past week on the FileManagement package.  Not yet finished, but getting close.  Note that JavaDoc comments are in need of tweaking and should not be trusted.
In these tests that have been written thus far, it’s not that I wanted to assert that an exception was thrown but rather I wanted the test to fail if the temp files or folders I’m creating for the purpose of the tests cannot be created.

 

- Jeff

 

From: Spencer Marks [mailto:notifications@github.com] 
Sent: Monday, June 23, 2014 7:41 AM
To: JeffBlodgett/FileSieve
Cc: Jeff Blodgett
Subject: Re: [FileSieve] FileManagement package (#5)

 

In src/test/java/FileSieve/BusinessLogic/FileManagement/ConcurrentFileManagerTest.java:

> +            // Ignore exceptions
> +        }
> +    }
> +
> +    @Test
> +    public void testDeletePathname() {
> +        Path folderFile1 = new File(folder + "/testFile1.txt").toPath();
> +        Path folderFile2 = new File(folder + "/testFile2.txt").toPath();
> +        Path subFolderFile1 = new File(subFolder + "/testDeletePathname1.txt").toPath();
> +        Path subFolderFile2 = new File(subFolder + "/testDeletePathname2.txt").toPath();
> +
> +        try {
> +            Assert.assertFalse("Attempted deletion of non-existent file should return false", fileManager.deletePathname(file));
> +        } catch (SecurityException | IOException e) {
> +            Assert.fail(e.getClass().getSimpleName() + " while attempting to delete non-existent file \"" + file.toFile().getName() + "\" in temp folder");
> +        }

if you want to assert a specific exception was thrown use the annotation like this:

@Test <https://github.com/Test> (expected=IndexOutOfBoundsException.class)
public void testIndexOutOfBoundsException() {
ArrayList emptyList = new ArrayList();
Object o = emptyList.get(0);
}

—
Reply to this email directly or view it on GitHub <https://github.com/JeffBlodgett/FileSieve/pull/5/files#r14070883> .  <https://github.com/notifications/beacon/7633920__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxOTE0Mjg3OCwiZGF0YSI6eyJpZCI6MzQ2NTg1MTl9fQ==--65d7ad8e4514684740cc01c4c84ba383e1b184f8.gif>