### Question:
FileIOOperationsAOImpl extends IRODSGenericAO implements FileIOOperations { @Override public long seek(final int fd, final long seek, final SeekWhenceType whence) throws JargonException { if (whence == SeekWhenceType.SEEK_START || whence == SeekWhenceType.SEEK_CURRENT || whence == SeekWhenceType.SEEK_END) { } else { log.error("Illegal Argument exception, whence value in seek must be SEEK_START, SEEK_CURRENT, or SEEK_END"); throw new IllegalArgumentException("whence value in seek must be SEEK_START, SEEK_CURRENT, or SEEK_END"); } if (fd <= 0) { log.error("no valid file handle provided"); throw new IllegalArgumentException("no valid file handle provided"); } Tag message; OpenedDataObjInp openedDataObjInp = OpenedDataObjInp.instanceForFileSeek(seek, fd, whence.ordinal()); message = getIRODSProtocol().irodsFunction(openedDataObjInp); return message.getTag(IRODSConstants.offset).getLongValue(); } FileIOOperationsAOImpl(final IRODSSession irodsSession, final IRODSAccount irodsAccount); @Override int write(final int fd, final byte buffer[], final int offset, final int length); @Override int fileRead(final int fd, final OutputStream destination, long length); @Override int fileRead(final int fd, final byte buffer[], final int offset, int length); @Override long seek(final int fd, final long seek, final SeekWhenceType whence); @Override ChecksumValue computeChecksumOnIrodsFile(final String irodsFileAbsolutePath);  }### Answer:
@Test public final void testSeek() throws Exception { String testFileName = "testfileseek.txt"; long fileLengthInBytes = 3072; String absPath = scratchFileUtils.createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH); String inputFileName = FileGenerator.generateFileOfFixedLengthGivenName(absPath, testFileName, fileLengthInBytes); IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); String targetIrodsCollection = testingPropertiesHelper .buildIRODSCollectionAbsolutePathFromTestProperties(testingProperties, IRODS_TEST_SUBDIR_PATH); StringBuilder fileNameAndPath = new StringBuilder(); fileNameAndPath.append(absPath); fileNameAndPath.append(testFileName); IRODSAccessObjectFactory accessObjectFactory = irodsFileSystem.getIRODSAccessObjectFactory(); DataTransferOperations dto = accessObjectFactory.getDataTransferOperations(irodsAccount); dto.putOperation(fileNameAndPath.toString(), targetIrodsCollection, testingProperties.getProperty(TestingPropertiesHelper.IRODS_RESOURCE_KEY), null, null); BufferedInputStream fis = new BufferedInputStream(new FileInputStream(inputFileName)); byte[] inputBytes = new byte[1024]; fis.read(inputBytes); fis.close(); IRODSFileFactory irodsFileFactory = accessObjectFactory.getIRODSFileFactory(irodsAccount); IRODSFile irodsFile = irodsFileFactory.instanceIRODSFile(targetIrodsCollection + '/' + testFileName); irodsFile.open(); FileIOOperations fileIOOperations = new FileIOOperationsAOImpl(irodsFileSystem.getIrodsSession(), irodsAccount); long seekVal = fileIOOperations.seek(irodsFile.getFileDescriptor(), 200L, FileIOOperations.SeekWhenceType.SEEK_START); Assert.assertEquals("did not move file pointer", 200L, seekVal); irodsFile.close(); }