I am using Junit 5 and trying to write unit tests for a method which contains the following code
ListObjectsV2Request request = ListObjectsV2Request.builder().bucket("bucket").prefix("prefix").build();
ListObjectsV2Result result = s3Client.listObjectsV2(request);
for(S3ObjectSummary summary : result.getSummaries())
//process keys here
I've already tried mocking but that only creates an empty result which does not let me use the getSummaries() method. How do I go about mocking the ListObjectsV2Result? Or is my approach wrong in trying to test it.