I have successfully downloaded the directory from S3 Bucket using transfer manager builder. The code is given below.
TransferManager transferManager =
TransferManagerBuilder.standard().withS3Client(client).build();
MultipleFileDownload download =
transferManager.downloadDirectory(bname, key, destfile);
Now i am trying to write test for the same. I have mocked Amazon s3Client code below.
AmazonS3 client = Mockito.mock(AmazonS3.class);
There is a null pointer exception in
transferManager.downloadDirectory(bname, key, destfile);
Kindly help me in writing the unit test!
Don't mock what you don't own .
Mocking somebody else's code makes assumptions that you cannot guarantee, especially if you ever upgrade the library you're using.
There are a couple of things you can do instead:
You could (and probably should) use both.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.