Beispiel #1
0
  /** Test. */
  public void testDeleteFile() {

    File fileMock = EasyMock.createNiceMock(File.class);
    EasyMock.expect(fileMock.isDirectory()).andReturn(false).anyTimes();
    EasyMock.replay(fileMock);
    FileSupport.deleteFile(fileMock);

    File directoryMock = EasyMock.createNiceMock(File.class);
    EasyMock.expect(directoryMock.isDirectory()).andReturn(true);
    EasyMock.expect(directoryMock.listFiles()).andReturn(new File[] {fileMock}).anyTimes();
    EasyMock.replay(directoryMock);
    FileSupport.deleteFile(directoryMock);
  }
Beispiel #2
0
 /**
  * Test.
  *
  * @throws IOException IOException
  * @throws InterruptedException InterruptedException
  */
 @Test
 public void testZip() throws IOException, InterruptedException {
   final byte[] result = FileSupport.zip(new File(directory, "data"));
   Assert.assertTrue(result.length > 0);
 }
Beispiel #3
0
 /**
  * Test.
  *
  * @throws IOException IOException
  * @throws InterruptedException InterruptedException
  */
 @Test
 public void testZipToFile() throws IOException, InterruptedException {
   final File tempFile = new File(directory, UUID.randomUUID().toString() + ".zip");
   FileSupport.zipToFile(data, tempFile);
   Assert.assertTrue(tempFile.exists());
 }