StandardWorker implements FsWorker { public void put(byte[] data, File file) throws FsException { try (RandomAccessFile raf = new RandomAccessFile(checkNonExistent(file), "rw")){ raf.write(data); } catch (Exception e) { throw wrapException(e); } }  byte[] get(File file); void put(byte[] data, File file);  }
@Test public void testPutFileExists() throws Exception { FsWorker worker = createWorker(); String[] testFiles = createTestFiles(); try { worker.put(DATA.getBytes(), new File(baseDir, testFiles[0])); fail(); } catch (FsException e) { } }