Code example for FileLock

Methods: position

0
		assertEquals(20, fileLock1.position());
 
		final long position = ((long) Integer.MAX_VALUE + 1);
		FileLock fileLock2 = new MockFileLock(readWriteChannel, position, 100,
				true); 
		assertEquals(position, fileLock2.position());
	} 
 
	/** 
	 * @tests java.nio.channels.FileLock#size() 
	 */ 
	public void test_size() { 
		FileLock fileLock1 = new MockFileLock(readWriteChannel, 20, 100, true);
		assertEquals(100, fileLock1.size());
 
		final long position = 0x0FFFFFFFFFFFFFFFL;
		final long size = ((long) Integer.MAX_VALUE + 1);
		FileLock fileLock2 = new MockFileLock(readWriteChannel, position, size,
				true); 
		assertEquals(size, fileLock2.size());
Experience pair programming with AI  Get Codota for Java