Untitled
vas
plain_text
a year ago
640 B
8
Indexable
@Test
void delete_shouldThrowException_whenBucketIsEmpty() {
// Arrange
when(awsS3ClientBuilderService.createAwsS3Client(any(), any(), any())).thenReturn(s3Client);
when(s3Client.listObjectsV2(any(String.class))).thenReturn(null);
// Act & Assert
FileDownloadException exception = assertThrows(FileDownloadException.class, () -> {
fileMgmtService.delete(AppTestConstants.BUCKET, AppTestConstants.FILENAME);
});
assertEquals(AppTestConstants.DELETE_FILE_ERROR_STR, exception.getMessage());
verify(awsS3ClientBuilderService, times(1)).shutdown(s3Client);
}Editor is loading...
Leave a Comment