@@ -45,8 +45,8 @@ public class MetadataCachingProviderDecoratorTest {
4545
4646 private final CloudPath rootDir = CloudPath .of ("" );
4747 private final CloudItemMetadata dir1Metadata = new CloudItemMetadata ("dir1" , rootDir .resolve ("dir1" ), CloudItemType .FOLDER );
48- private final CloudItemMetadata file1Metadata = new CloudItemMetadata ("file1.jpg" , rootDir .resolve ("file1.c9r " ), CloudItemType .FILE );
49- private final CloudItemMetadata file2Metadata = new CloudItemMetadata ("file2.mp4" , rootDir .resolve ("file2.c9r " ), CloudItemType .FILE );
48+ private final CloudItemMetadata file1Metadata = new CloudItemMetadata ("file1.jpg" , rootDir .resolve ("file1.jpg " ), CloudItemType .FILE );
49+ private final CloudItemMetadata file2Metadata = new CloudItemMetadata ("file2.mp4" , rootDir .resolve ("file2.mp4 " ), CloudItemType .FILE );
5050 private final CloudItemMetadata dir2Metadata = new CloudItemMetadata ("dir2" , rootDir .resolve ("dir1/dir2" ), CloudItemType .FOLDER );
5151 private final CloudItemMetadata file3Metadata = new CloudItemMetadata ("file3.txt" , rootDir .resolve ("dir1/file3.txt" ), CloudItemType .FILE );
5252 private final CloudItemMetadata file4Metadata = new CloudItemMetadata ("file4.png" , rootDir .resolve ("file4.png" ), CloudItemType .FILE );
@@ -276,13 +276,14 @@ public void testDeleteFolder() {
276276 public void testWriteToFile () {
277277 var updatedFile1Metadata = new CloudItemMetadata (file1Metadata .getName (), file1Metadata .getPath (), CloudItemType .FILE , Optional .of (Instant .EPOCH ), Optional .of (15l ));
278278
279- Mockito .when (cloudProvider .write (Mockito .eq (file1Metadata .getPath ()), Mockito .eq (false ), Mockito .any (InputStream .class ), Mockito .eq (15l ), Mockito .eq (Optional .empty ( )), Mockito .eq (ProgressListener .NO_PROGRESS_AWARE )))
279+ Mockito .when (cloudProvider .write (Mockito .eq (file1Metadata .getPath ()), Mockito .eq (false ), Mockito .any (InputStream .class ), Mockito .eq (15l ), Mockito .eq (Optional .of ( Instant . EPOCH )), Mockito .eq (ProgressListener .NO_PROGRESS_AWARE )))
280280 .thenReturn (CompletableFuture .completedFuture (null ));
281281
282- var futureResult = decorator .write (file1Metadata .getPath (), false , new ByteArrayInputStream ("TOPSECRET!" .getBytes (UTF_8 )), 15l , Optional .empty ( ), ProgressListener .NO_PROGRESS_AWARE );
282+ var futureResult = decorator .write (file1Metadata .getPath (), false , new ByteArrayInputStream ("TOPSECRET!" .getBytes (UTF_8 )), 15l , Optional .of ( Instant . EPOCH ), ProgressListener .NO_PROGRESS_AWARE );
283283 Assertions .assertTimeoutPreemptively (Duration .ofMillis (100 ), () -> futureResult .toCompletableFuture ().get ());
284284
285- Assertions .assertEquals (0l , decorator .itemMetadataCache .size ());
285+ Assertions .assertEquals (1l , decorator .itemMetadataCache .size ());
286+ Assertions .assertEquals (updatedFile1Metadata , decorator .itemMetadataCache .getIfPresent (updatedFile1Metadata .getPath ()).toCompletableFuture ().join ());
286287 }
287288
288289 @ Test
0 commit comments