@Test public void testZipFile_fixture_2() throws Exception { ZipFiles fixture2 = getFixture(); String filePath = "0123456789"; String result = fixture2.zipFile(filePath); File file = new File(filePath + ".zip"); file.delete(); assertEquals(null, result); }
public String zipFile(String filePath) { try { OutputStream zipOutput = new FileOutputStream(new File(filePath + ".zip")); ArchiveOutputStream logicalZip = new ArchiveStreamFactory() .createArchiveOutputStream(ArchiveStreamFactory.ZIP, zipOutput); logicalZip.putArchiveEntry(new ZipArchiveEntry(FilenameUtils.getName(filePath))); IOUtils.copy(new FileInputStream(new File(filePath)), logicalZip); logicalZip.closeArchiveEntry(); logicalZip.finish(); zipOutput.close(); } catch (Exception e) { System.err.println(e.getMessage()); return null; } return filePath + ".zip"; }
ZipFiles { public String zipFile(String filePath) { try { OutputStream zipOutput = new FileOutputStream(new File(filePath + ".zip")); ArchiveOutputStream logicalZip = new ArchiveStreamFactory() .createArchiveOutputStream(ArchiveStreamFactory.ZIP, zipOutput); logicalZip.putArchiveEntry(new ZipArchiveEntry(FilenameUtils.getName(filePath))); IOUtils.copy(new FileInputStream(new File(filePath)), logicalZip); logicalZip.closeArchiveEntry(); logicalZip.finish(); zipOutput.close(); } catch (Exception e) { System.err.println(e.getMessage()); return null; } return filePath + ".zip"; } }
ZipFiles { public String zipFile(String filePath) { try { OutputStream zipOutput = new FileOutputStream(new File(filePath + ".zip")); ArchiveOutputStream logicalZip = new ArchiveStreamFactory() .createArchiveOutputStream(ArchiveStreamFactory.ZIP, zipOutput); logicalZip.putArchiveEntry(new ZipArchiveEntry(FilenameUtils.getName(filePath))); IOUtils.copy(new FileInputStream(new File(filePath)), logicalZip); logicalZip.closeArchiveEntry(); logicalZip.finish(); zipOutput.close(); } catch (Exception e) { System.err.println(e.getMessage()); return null; } return filePath + ".zip"; }  }
ZipFiles { public String zipFile(String filePath) { try { OutputStream zipOutput = new FileOutputStream(new File(filePath + ".zip")); ArchiveOutputStream logicalZip = new ArchiveStreamFactory() .createArchiveOutputStream(ArchiveStreamFactory.ZIP, zipOutput); logicalZip.putArchiveEntry(new ZipArchiveEntry(FilenameUtils.getName(filePath))); IOUtils.copy(new FileInputStream(new File(filePath)), logicalZip); logicalZip.closeArchiveEntry(); logicalZip.finish(); zipOutput.close(); } catch (Exception e) { System.err.println(e.getMessage()); return null; } return filePath + ".zip"; }  String zipFile(String filePath); }
ZipFiles { public String zipFile(String filePath) { try { OutputStream zipOutput = new FileOutputStream(new File(filePath + ".zip")); ArchiveOutputStream logicalZip = new ArchiveStreamFactory() .createArchiveOutputStream(ArchiveStreamFactory.ZIP, zipOutput); logicalZip.putArchiveEntry(new ZipArchiveEntry(FilenameUtils.getName(filePath))); IOUtils.copy(new FileInputStream(new File(filePath)), logicalZip); logicalZip.closeArchiveEntry(); logicalZip.finish(); zipOutput.close(); } catch (Exception e) { System.err.println(e.getMessage()); return null; } return filePath + ".zip"; }  String zipFile(String filePath);  }