@@ -289,55 +289,105 @@ void objectLambdaArnBucketProvided_shouldThrowException() {
289289 }
290290
291291 @ Test
292- void mrapArnProvided_shouldThrowException () {
292+ void uploadFile_mrapArn_returnsResponse () {
293293 String mrapArn = "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap" ;
294+ PutObjectResponse response = PutObjectResponse .builder ().build ();
295+ when (mockS3Crt .putObject (any (PutObjectRequest .class ), any (AsyncRequestBody .class )))
296+ .thenReturn (CompletableFuture .completedFuture (response ));
294297
295- assertThatThrownBy (() -> tm .uploadFile (b -> b .putObjectRequest (p -> p .bucket (mrapArn ).key ("key" ))
296- .source (Paths .get ("." )))
297- .completionFuture ().join ())
298- .hasMessageContaining ("multi-region access point ARN" ).hasCauseInstanceOf (IllegalArgumentException .class );
298+ CompletedFileUpload completedFileUpload = tm .uploadFile (u -> u .putObjectRequest (p -> p .bucket (mrapArn ).key ("key" ))
299+ .source (Paths .get ("." )))
300+ .completionFuture ().join ();
299301
300- assertThatThrownBy (() -> tm .upload (b -> b .putObjectRequest (p -> p .bucket (mrapArn ).key ("key" ))
301- .requestBody (AsyncRequestBody .fromString ("foo" )))
302- .completionFuture ().join ())
303- .hasMessageContaining ("multi-region access point ARN" ).hasCauseInstanceOf (IllegalArgumentException .class );
302+ assertThat (completedFileUpload .response ()).isEqualTo (response );
303+ }
304304
305- assertThatThrownBy (() -> tm .downloadFile (b -> b .getObjectRequest (p -> p .bucket (mrapArn ).key ("key" ))
306- .destination (Paths .get ("." )))
307- .completionFuture ().join ())
308- .hasMessageContaining ("multi-region access point ARN" ).hasCauseInstanceOf (IllegalArgumentException .class );
305+ @ Test
306+ void upload_mrapArn_returnsResponse () {
307+ String mrapArn = "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap" ;
308+ PutObjectResponse response = PutObjectResponse .builder ().build ();
309+ when (mockS3Crt .putObject (any (PutObjectRequest .class ), any (AsyncRequestBody .class )))
310+ .thenReturn (CompletableFuture .completedFuture (response ));
311+
312+ CompletedUpload completedUpload = tm .upload (u -> u .putObjectRequest (p -> p .bucket (mrapArn ).key ("key" ))
313+ .requestBody (AsyncRequestBody .fromString ("foo" )))
314+ .completionFuture ().join ();
315+
316+ assertThat (completedUpload .response ()).isEqualTo (response );
317+ }
318+
319+ @ Test
320+ void downloadFile_mrapArn_returnsResponse () {
321+ String mrapArn = "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap" ;
322+ GetObjectResponse response = GetObjectResponse .builder ().build ();
323+ when (mockS3Crt .getObject (any (GetObjectRequest .class ), any (AsyncResponseTransformer .class )))
324+ .thenReturn (CompletableFuture .completedFuture (response ));
325+
326+ CompletedFileDownload completedFileDownload = tm .downloadFile (d -> d .getObjectRequest (g -> g .bucket (mrapArn ).key ("key" ))
327+ .destination (Paths .get ("." )))
328+ .completionFuture ().join ();
329+
330+ assertThat (completedFileDownload .response ()).isEqualTo (response );
331+ }
332+
333+ @ Test
334+ void download_mrapArn_returnsResponse () {
335+ String mrapArn = "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap" ;
336+ GetObjectResponse response = GetObjectResponse .builder ().build ();
337+ when (mockS3Crt .getObject (any (GetObjectRequest .class ), any (AsyncResponseTransformer .class )))
338+ .thenReturn (CompletableFuture .completedFuture (response ));
309339
310340 DownloadRequest <ResponseBytes <GetObjectResponse >> downloadRequest =
311341 DownloadRequest .builder ()
312342 .getObjectRequest (g -> g .bucket (mrapArn ).key ("key" ))
313343 .responseTransformer (AsyncResponseTransformer .toBytes ()).build ();
314344
315- assertThatThrownBy (() -> tm . download ( downloadRequest ). completionFuture (). join ())
316- . hasMessageContaining ( "multi-region access point ARN" ). hasCauseInstanceOf ( IllegalArgumentException . class );
345+ CompletedDownload < ResponseBytes < GetObjectResponse >> completedDownload =
346+ tm . download ( downloadRequest ). completionFuture (). join ( );
317347
318- assertThatThrownBy (() -> tm .uploadDirectory (b -> b .bucket (mrapArn )
319- .source (Paths .get ("." )))
320- .completionFuture ().join ())
321- .hasMessageContaining ("multi-region access point ARN" ).hasCauseInstanceOf (IllegalArgumentException .class );
348+ assertThat (completedDownload ).isNotNull ();
349+ }
322350
323- assertThatThrownBy (() -> tm .downloadDirectory (b -> b .bucket (mrapArn )
324- .destination (Paths .get ("." )))
325- .completionFuture ().join ())
326- .hasMessageContaining ("multi-region access point ARN" ).hasCauseInstanceOf (IllegalArgumentException .class );
351+ @ Test
352+ void copy_mrapArn_returnsResponse () {
353+ String mrapArn = "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap" ;
354+ CopyObjectResponse response = CopyObjectResponse .builder ().build ();
355+ when (mockS3Crt .copyObject (any (CopyObjectRequest .class )))
356+ .thenReturn (CompletableFuture .completedFuture (response ));
327357
328- assertThatThrownBy (() -> tm .copy (b -> b .copyObjectRequest (p -> p .sourceBucket (mrapArn )
329- .sourceKey ("sourceKey" )
330- .destinationBucket ("bucket" )
331- .destinationKey ("destKey" )))
332- .completionFuture ().join ())
333- .hasMessageContaining ("multi-region access point ARN" ).hasCauseInstanceOf (IllegalArgumentException .class );
358+ CompletedCopy completedCopy = tm .copy (u -> u .copyObjectRequest (p -> p .sourceBucket (mrapArn )
359+ .sourceKey ("sourceKey" )
360+ .destinationBucket ("bucket" )
361+ .destinationKey ("destKey" )))
362+ .completionFuture ().join ();
334363
335- assertThatThrownBy (() -> tm .copy (b -> b .copyObjectRequest (p -> p .sourceBucket ("bucket" )
336- .sourceKey ("sourceKey" )
337- .destinationBucket (mrapArn )
338- .destinationKey ("destKey" )))
339- .completionFuture ().join ())
340- .hasMessageContaining ("multi-region access point ARN" ).hasCauseInstanceOf (IllegalArgumentException .class );
364+ assertThat (completedCopy .response ()).isEqualTo (response );
365+
366+ completedCopy = tm .copy (u -> u .copyObjectRequest (p -> p .sourceBucket ("bucket" )
367+ .sourceKey ("sourceKey" )
368+ .destinationBucket (mrapArn )
369+ .destinationKey ("destKey" )))
370+ .completionFuture ().join ();
371+
372+ assertThat (completedCopy .response ()).isEqualTo (response );
373+ }
374+
375+ @ Test
376+ void uploadDirectory_mrapArn_returnsResponse () {
377+ String mrapArn = "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap" ;
378+
379+ tm .uploadDirectory (u -> u .source (Paths .get ("." )).bucket (mrapArn ));
380+
381+ verify (uploadDirectoryHelper ).uploadDirectory (any (UploadDirectoryRequest .class ));
382+ }
383+
384+ @ Test
385+ void downloadDirectory_mrapArn_returnsResponse () {
386+ String mrapArn = "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap" ;
387+
388+ tm .downloadDirectory (d -> d .destination (Paths .get ("." )).bucket (mrapArn ));
389+
390+ verify (downloadDirectoryHelper ).downloadDirectory (any (DownloadDirectoryRequest .class ));
341391 }
342392
343393 @ Test
0 commit comments