@@ -230,7 +230,8 @@ public void testDeleteFile() {
230230 var futureResult = decorator .deleteFile (file4Metadata .getPath ());
231231 Assertions .assertTimeoutPreemptively (Duration .ofMillis (100 ), () -> futureResult .toCompletableFuture ().get ());
232232
233- Assertions .assertEquals (decorator .itemMetadataCache .size (), 0l );
233+ Assertions .assertEquals (decorator .itemMetadataCache .size (), 1l );
234+ Assertions .assertEquals (decorator .itemMetadataCache .getIfPresent (file4Metadata .getPath ()), Optional .empty ());
234235 }
235236
236237 @ Test
@@ -242,7 +243,8 @@ public void testDeleteFileNotFound() {
242243
243244 Assertions .assertThrows (NotFoundException .class , () -> decorator .deleteFile (file4Metadata .getPath ()).toCompletableFuture ().join ());
244245
245- Assertions .assertEquals (decorator .itemMetadataCache .size (), 0l );
246+ Assertions .assertEquals (decorator .itemMetadataCache .size (), 1l );
247+ Assertions .assertEquals (decorator .itemMetadataCache .getIfPresent (file4Metadata .getPath ()), Optional .empty ());
246248 }
247249
248250 @ Test
@@ -255,7 +257,8 @@ public void testDeleteFolder() {
255257 var futureResult = decorator .deleteFolder (dir1Metadata .getPath ());
256258 Assertions .assertTimeoutPreemptively (Duration .ofMillis (100 ), () -> futureResult .toCompletableFuture ().get ());
257259
258- Assertions .assertEquals (decorator .itemMetadataCache .size (), 0l );
260+ Assertions .assertEquals (decorator .itemMetadataCache .size (), 1l );
261+ Assertions .assertEquals (decorator .itemMetadataCache .getIfPresent (dir1Metadata .getPath ()), Optional .empty ());
259262 }
260263
261264 @ Test
@@ -266,7 +269,7 @@ public void testWriteToFile() {
266269 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 )))
267270 .thenReturn (CompletableFuture .completedFuture (null ));
268271
269- var futureResult = decorator .write (file1Metadata .getPath (), false , new ByteArrayInputStream ("TOPSECRET!" .getBytes (UTF_8 )),15l , Optional .empty (), ProgressListener .NO_PROGRESS_AWARE );
272+ var futureResult = decorator .write (file1Metadata .getPath (), false , new ByteArrayInputStream ("TOPSECRET!" .getBytes (UTF_8 )), 15l , Optional .empty (), ProgressListener .NO_PROGRESS_AWARE );
270273 Assertions .assertTimeoutPreemptively (Duration .ofMillis (100 ), () -> futureResult .toCompletableFuture ().get ());
271274
272275 Assertions .assertEquals (decorator .itemMetadataCache .size (), 0l );
@@ -280,7 +283,7 @@ public void testWriteToFileNotFound() {
280283 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 )))
281284 .thenReturn (CompletableFuture .failedFuture (new NotFoundException ()));
282285
283- Assertions .assertThrows (NotFoundException .class , () -> decorator .write (file1Metadata .getPath (), false , new ByteArrayInputStream ("TOPSECRET!" .getBytes (UTF_8 )),15l , Optional .empty (), ProgressListener .NO_PROGRESS_AWARE ).toCompletableFuture ().join ());
286+ Assertions .assertThrows (NotFoundException .class , () -> decorator .write (file1Metadata .getPath (), false , new ByteArrayInputStream ("TOPSECRET!" .getBytes (UTF_8 )), 15l , Optional .empty (), ProgressListener .NO_PROGRESS_AWARE ).toCompletableFuture ().join ());
284287
285288 Assertions .assertNull (decorator .itemMetadataCache .getIfPresent (file1Metadata .getPath ()));
286289 }
0 commit comments