@Test
public void compressNoOverwrite() throws Exception {

    // test file to use for tests
    File originalSourceFile = new File(TEST_FILE);
    // copy original source to build directory -- becomes our actual source file
    File sourceFile = new File("target", originalSourceFile.getName());
    FileUtil.copy(originalSourceFile, sourceFile, true);
    // NOTE: just for junit, let's make sure the compressed file does not exist yet
    // it may exist if "ant clean" not run between tests
    Algorithm a = Algorithm.findByName("gzip");
    File expectedCompressedFile = new File(sourceFile.getParentFile(), sourceFile.getName() + "." + a.getFileExtension());
    expectedCompressedFile.delete();
    // compress the source file (original should have been deleted)
    CompressionUtil.compress(sourceFile, a.getName(), false);
    try {
        CompressionUtil.compress(sourceFile, a.getName(), false);
        Assert.fail("Should have failed");
    } catch (FileAlreadyExistsException e) {
        // correct behavior
    }
}