Reputation: 63
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!
Upvotes: 0
Views: 1365
Reputation: 7553
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.
Upvotes: 1