### Question:
MemoryBasedTransferRestartManager extends AbstractRestartManager { @Override public void updateSegment(final FileRestartInfo fileRestartInfo, final FileRestartDataSegment fileRestartDataSegment) throws FileRestartManagementException { log.info("updateSegment()"); if (fileRestartInfo == null) { throw new IllegalArgumentException("null fileRestartInfo"); } if (fileRestartDataSegment == null) { throw new IllegalArgumentException("null fileRestartDataSegment"); } log.info("updating fileRestartInfo:{}", fileRestartInfo); log.info("updating fileRestartDataSegment:{}", fileRestartDataSegment); synchronized (this) { FileRestartInfo actualRestartInfo = retrieveRestart(fileRestartInfo.identifierFromThisInfo()); if (actualRestartInfo.getFileRestartDataSegments().size() < fileRestartDataSegment.getThreadNumber()) { log.error("fileRestartInfo does not contain the given segment:{}", fileRestartInfo); throw new FileRestartManagementException("unable to find segment"); } FileRestartDataSegment actualSegment = actualRestartInfo.getFileRestartDataSegments() .get(fileRestartDataSegment.getThreadNumber()); if (actualSegment.getThreadNumber() != fileRestartDataSegment.getThreadNumber()) { log.error("mismatch in thread number in update request for segment:{}", fileRestartDataSegment); throw new FileRestartManagementException("file segment does not match thread number"); } actualRestartInfo.getFileRestartDataSegments().set(actualSegment.getThreadNumber(), fileRestartDataSegment); storeRestart(actualRestartInfo); } } MemoryBasedTransferRestartManager(); @Override FileRestartInfoIdentifier storeRestart(final FileRestartInfo fileRestartInfo); @Override void deleteRestart(final FileRestartInfoIdentifier fileRestartInfoIdentifier); @Override FileRestartInfo retrieveRestart(final FileRestartInfoIdentifier fileRestartInfoIdentifier); @Override void updateSegment(final FileRestartInfo fileRestartInfo,
			final FileRestartDataSegment fileRestartDataSegment); @Override FileRestartInfo incrementRestartAttempts(final FileRestartInfo fileRestartInfo);  }### Answer:
@Test public void testUpdateSegment() throws Exception { long testLength = 800; MemoryBasedTransferRestartManager manager = new MemoryBasedTransferRestartManager(); String irodsPath = "/irods/path"; String localPath = "/local/path"; RestartType restartType = RestartType.GET; IRODSAccount account = TestingPropertiesHelper.buildBogusIrodsAccount(); FileRestartInfo fileRestartInfo = new FileRestartInfo(); fileRestartInfo.setIrodsAbsolutePath(irodsPath); fileRestartInfo.setLocalAbsolutePath(localPath); fileRestartInfo.setRestartType(restartType); fileRestartInfo.setIrodsAccountIdentifier(account.toString()); int nbrThreads = 4; for (int i = 0; i < nbrThreads; i++) { FileRestartDataSegment segment = new FileRestartDataSegment(i); fileRestartInfo.getFileRestartDataSegments().add(segment); } FileRestartInfoIdentifier actual = manager.storeRestart(fileRestartInfo); FileRestartDataSegment thirdSegment = fileRestartInfo.getFileRestartDataSegments().get(2); thirdSegment.setLength(testLength); manager.updateSegment(fileRestartInfo, thirdSegment); FileRestartInfo retrievedInfo = manager.retrieveRestart(actual); Assert.assertNotNull("did not retrieve info", retrievedInfo); Assert.assertEquals(retrievedInfo.getFileRestartDataSegments().get(2).getLength(), thirdSegment.getLength()); }