Source:
<code>public void testTombstoneExpiryGuardedDeleteRawCreate() throws Exception { boolean allowAuthoritative = authoritative; Path testFilePath = path("TEGDRC-" + UUID.randomUUID()); LOG.info("Allow authoritative param: {}", allowAuthoritative); String originalText = "some test"; String newText = "the new originalText for test"; final ITtlTimeProvider originalTimeProvider = guardedFs.getTtlTimeProvider(); try { final AtomicLong now = new AtomicLong(1); final AtomicLong metadataTtl = new AtomicLong(1); ITtlTimeProvider testTimeProvider = new ITtlTimeProvider() { @Override public long getNow() { return now.get(); } @Override public long getMetadataTtl() { return metadataTtl.get(); } }; guardedFs.setTtlTimeProvider(testTimeProvider); writeTextFile(guardedFs, testFilePath, originalText, true); final FileStatus origStatus = awaitFileStatus(rawFS, testFilePath); assertNotNull("Create file status should not be null", origStatus); guardedFs.delete(testFilePath, true); final PathMetadata metadata = guardedFs.getMetadataStore().get(testFilePath); assertNotNull("Created file metadata should not be null in ms", metadata); assertEquals("Created file metadata should equal with mocked now", now.get(), metadata.getLastUpdated()); writeTextFile(rawFS, testFilePath, newText, true); final FileStatus newStatus = awaitFileStatus(rawFS, testFilePath); assertNotNull("Newly created file status should not be null.", newStatus); <START> long willExpire = now.get() + metadataTtl.get() + 1l; <END> now.set(willExpire); LOG.warn("WILLEXPIRE: {}, ttlNow: {}; ttlTTL: {}", willExpire, testTimeProvider.getNow(), testTimeProvider.getMetadataTtl()); final FSDataInputStream in = guardedFs.open(testFilePath); byte[] bytes = new byte[newText.length()]; in.read(bytes, 0, bytes.length); LOG.info("Old: {}, New: {}", originalText, newText); assertTrue(new String(bytes).equals(newText)); } finally { guardedFs.delete(testFilePath, true); guardedFs.setTtlTimeProvider(originalTimeProvider); } }</code><technical_language>nit: 1L</technical_language>

Target:
public void testTombstoneExpiryGuardedDeleteRawCreate() throws Exception { boolean allowAuthoritative = authoritative; Path testFilePath = path("TEGDRC-" + UUID.randomUUID() + "/file"); LOG.info("Allow authoritative param: {}", allowAuthoritative); String originalText = "some test"; String newText = "the new originalText for test"; final ITtlTimeProvider originalTimeProvider = guardedFs.getTtlTimeProvider(); try { final AtomicLong now = new AtomicLong(1); final AtomicLong metadataTtl = new AtomicLong(1); ITtlTimeProvider testTimeProvider = new ITtlTimeProvider() { @Override public long getNow() { return now.get(); } @Override public long getMetadataTtl() { return metadataTtl.get(); } }; guardedFs.setTtlTimeProvider(testTimeProvider); createAndAwaitFs(guardedFs, testFilePath, originalText); deleteGuardedTombstoned(guardedFs, testFilePath, now); createAndAwaitFs(rawFS, testFilePath, newText); checkListingDoesNotContainPath(guardedFs, testFilePath); long willExpire = now.get() + metadataTtl.get() + 1L; now.set(willExpire); LOG.info("willExpire: {}, ttlNow: {}; ttlTTL: {}", willExpire, testTimeProvider.getNow(), testTimeProvider.getMetadataTtl()); String newRead = readBytesToString(guardedFs, testFilePath, newText.length()); checkListingContainsPath(guardedFs, testFilePath); LOG.info("Old: {}, New: {}, Read: {}", originalText, newText, newRead); assertEquals("The text should be modified with a new.", newText, newRead); } finally { guardedFs.delete(testFilePath, true); guardedFs.setTtlTimeProvider(originalTimeProvider); } }