@Test
public void testWipeOldFilesWithOldFilesWhileLockingDirectory() throws FileNotFoundException, IOException {

stem.out.println("Test: " + "testWipeOldFilesWithOldFilesWhileLockingDirectory");
    Collection<File> result = new ArrayList<File>();
    File directory = new File(this.tempDir);
    String singleFile = this.tempDir
            + System.getProperty("file.separator")
            + "Sample_Files"
            + System.getProperty("file.separator")
            + "Shapefiles"
            + System.getProperty("file.separator")
            + "demo_HUCs.dbf";
    // Lock a file
    File file1 = new File(singleFile);
    file1.setReadOnly();
    result = FileHelper.wipeOldFiles(directory, 1l, true);
    // Test that the locked file doesnt show up in the deleted files list
    boolean containsFail = true;
    for (File file : result) {
        if (file.getPath().equals(singleFile)) {
            containsFail = false;
        }
    }
    assertTrue(containsFail);
    //Unlock the files
    file1.setWritable(false);
    // really delete the directory
    FileHelper.wipeOldFiles(directory, 1l, true);
}