Untitled
vas
plain_text
a year ago
645 B
4
Indexable
@Test
void testDeleteFile_Success() throws Exception {
// Arrange
when(awsS3ClientBuilderService.createAwsS3Client(anyString(), anyString(), any(Regions.class)))
.thenReturn(s3Client);
doNothing().when(s3Client).deleteObject(anyString(), anyString());
// Act
boolean result = fileMgmtService.delete(AppTestConstants.BUCKET, AppTestConstants.FILENAME);
// Assert
assertTrue(result, "File should be deleted successfully");
verify(s3Client, times(1)).deleteObject(AppTestConstants.BUCKET, AppTestConstants.FILENAME);
verify(awsS3ClientBuilderService, times(1)).shutdown(s3Client);
}
Editor is loading...
Leave a Comment