public void test_transferTo_couldDelete() throws Exception {
  writeDataToFile(fileOfReadOnlyFileChannel);
  writeDataToFile(fileOfWriteOnlyFileChannel);
  readOnlyFileChannel.transferTo(0,2,writeOnlyFileChannel);
  readOnlyFileChannel.close();
  writeOnlyFileChannel.close();
  boolean rDel=fileOfReadOnlyFileChannel.delete();
  boolean wDel=fileOfWriteOnlyFileChannel.delete();
  assertTrue("File " + readOnlyFileChannel + " exists",rDel);
  assertTrue("File " + writeOnlyFileChannel + " exists",wDel);
}

public void test_transferTo_couldDelete ( ) throws Exception { writeDataToFile ( fileOfReadOnlyFileChannel ) ; writeDataToFile ( fileOfWriteOnlyFileChannel ) ; readOnlyFileChannel . transferTo ( 0 , 2 , writeOnlyFileChannel ) ; readOnlyFileChannel . close ( ) ; writeOnlyFileChannel . close ( ) ; boolean rDel = fileOfReadOnlyFileChannel . delete ( ) ; boolean wDel = fileOfWriteOnlyFileChannel . delete ( ) ; assertTrue ( "File " + readOnlyFileChannel + " exists" , rDel ) ; assertTrue ( "File " + writeOnlyFileChannel + " exists" , wDel ) ; }
regression test for harmony - 3324 make sure we could delete the file after we called transferto ( ) method .
