try {
File file = File.createTempFile("test", "tmp");
assertTrue(file.exists());
file.deleteOnExit();
FileOutputStream fos = new FileOutputStream(file);
fos.write(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
fos.close();
String fileName = file.getCanonicalPath();
RandomAccessFile raf = new RandomAccessFile(fileName, "rw");
raf.close();
} catch (IOException ex) {
fail(ex.getLocalizedMessage());
}