@@ -441,4 +441,80 @@ void testUpdateExpirationTimeThrowsExceptionForNullArguments() {
441441 NullPointerException .class , () -> fileClientImpl .updateExpirationTime (null , null )
442442 );
443443 }
444+
445+ @ Test
446+ void testIsDeletedReturnsTrueForDeletedFile () throws HieroException {
447+ final FileId fileId = FileId .fromString ("1.2.3" );
448+ final FileInfoResponse fileInfoResponse = Mockito .mock (FileInfoResponse .class );
449+ when (protocolLayerClient .executeFileInfoQuery (any (FileInfoRequest .class )))
450+ .thenReturn (fileInfoResponse );
451+ when (fileInfoResponse .deleted ()).thenReturn (true );
452+
453+ boolean result = fileClientImpl .isDeleted (fileId );
454+ assertTrue (result );
455+ verify (protocolLayerClient , times (1 ))
456+ .executeFileInfoQuery (any (FileInfoRequest .class ));
457+ }
458+
459+ @ Test
460+ void testIsDeletedReturnsFalseForActiveFile () throws HieroException {
461+ final FileId fileId = FileId .fromString ("1.2.3" );
462+ final FileInfoResponse fileInfoResponse = Mockito .mock (FileInfoResponse .class );
463+
464+ when (protocolLayerClient .executeFileInfoQuery (any (FileInfoRequest .class )))
465+ .thenReturn (fileInfoResponse );
466+ when (fileInfoResponse .deleted ()).thenReturn (false );
467+
468+ boolean result = fileClientImpl .isDeleted (fileId );
469+
470+ assertFalse (result );
471+ verify (protocolLayerClient , times (1 ))
472+ .executeFileInfoQuery (any (FileInfoRequest .class ));
473+ }
474+
475+ @ Test
476+ void testIsDeletedThrowsExceptionForNullFileId () {
477+ final String message = "fileId must not be null" ;
478+
479+ final NullPointerException exception = assertThrows (
480+ NullPointerException .class , () -> fileClientImpl .isDeleted (null )
481+ );
482+ assertTrue (exception .getMessage ().contains (message ));
483+ }
484+
485+ @ Test
486+ void isDeleted_ReturnsTrue_WhenFileIsDeleted () throws HieroException {
487+ FileId fileId = FileId .fromString ("1.2.3" );
488+ FileInfoResponse mockResponse = mock (FileInfoResponse .class );
489+ when (mockResponse .deleted ()).thenReturn (true );
490+ when (protocolLayerClient .executeFileInfoQuery (any (FileInfoRequest .class )))
491+ .thenReturn (mockResponse );
492+
493+ boolean result = fileClientImpl .isDeleted (fileId );
494+ assertTrue (result );
495+ verify (protocolLayerClient ).executeFileInfoQuery (any (FileInfoRequest .class ));
496+ }
497+
498+ @ Test
499+ void isDeleted_ReturnsFalse_WhenFileIsNotDeleted () throws HieroException {
500+ FileId fileId = FileId .fromString ("1.2.3" );
501+ FileInfoResponse mockResponse = mock (FileInfoResponse .class );
502+ when (mockResponse .deleted ()).thenReturn (false );
503+ when (protocolLayerClient .executeFileInfoQuery (any (FileInfoRequest .class )))
504+ .thenReturn (mockResponse );
505+
506+ boolean result = fileClientImpl .isDeleted (fileId );
507+
508+ assertFalse (result );
509+ verify (protocolLayerClient ).executeFileInfoQuery (any (FileInfoRequest .class ));
510+ }
511+ @ Test
512+ void isDeleted_ThrowsNullPointerException_WhenFileIdIsNull () {
513+ NullPointerException exception = assertThrows (
514+ NullPointerException .class ,
515+ () -> fileClientImpl .isDeleted (null )
516+ );
517+ assertEquals ("fileId must not be null" , exception .getMessage ());
518+ }
519+
444520}
0 commit comments