@Test(expected = OverlappingFileLockException.class)
@SuppressFBWarnings("PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS")
public void testFileLock() throws IOException {

  File tmp = File.createTempFile("test", ".lock");
  tmp.deleteOnExit();
  RandomAccessFile file = new RandomAccessFile(tmp, "rws");
  FileChannel channel = file.getChannel();
  FileLock lock = channel.lock();
  FileLock lock1 = channel.lock();
  Assert.fail();
  lock1.release();
  lock.release();
}