Untitled

 avatar
vas
plain_text
2 months ago
660 B
3
Indexable
 @Test
    void delete_shouldReturnTrue_whenFileIsDeletedSuccessfully() throws FileDownloadException {
        // Arrange
        when(awsS3ClientBuilderService.createAwsS3Client(any(), any(), any())).thenReturn(s3Client);
        when(s3Client.listObjectsV2(any(String.class))).thenReturn(new ListObjectsV2Result());

        // Act
        boolean result = fileMgmtService.delete(AppTestConstants.BUCKET, AppTestConstants.FILENAME);

        // Assert
        assertTrue(result);
        verify(s3Client, times(1)).deleteObject(AppTestConstants.BUCKET, AppTestConstants.FILENAME);
        verify(awsS3ClientBuilderService, times(1)).shutdown(s3Client);
    }
Leave a Comment