@@ -318,12 +318,20 @@ public void testComposeBlobFail() {
318318 public void testCopyBlob () {
319319 String sourceBlobName = "test-copy-blob-source" ;
320320 BlobId source = BlobId .of (BUCKET , sourceBlobName );
321- assertNotNull (storage .create (BlobInfo .builder (source ).build (), BLOB_BYTE_CONTENT ));
321+ ImmutableMap <String , String > metadata = ImmutableMap .of ("k" , "v" );
322+ BlobInfo blob = BlobInfo .builder (source )
323+ .contentType (CONTENT_TYPE )
324+ .metadata (metadata )
325+ .build ();
326+ assertNotNull (storage .create (blob , BLOB_BYTE_CONTENT ));
322327 String targetBlobName = "test-copy-blob-target" ;
323- BlobInfo target = BlobInfo .builder (BUCKET , targetBlobName ).contentType ( CONTENT_TYPE ). build ();
328+ BlobInfo target = BlobInfo .builder (BUCKET , targetBlobName ).build ();
324329 Storage .CopyRequest req = Storage .CopyRequest .of (source , target );
325330 CopyWriter copyWriter = storage .copy (req );
326- assertEquals (copyWriter .result (), storage .get (BUCKET , targetBlobName ));
331+ assertEquals (BUCKET , copyWriter .result ().bucket ());
332+ assertEquals (targetBlobName , copyWriter .result ().name ());
333+ assertEquals (CONTENT_TYPE , copyWriter .result ().contentType ());
334+ assertEquals (metadata , copyWriter .result ().metadata ());
327335 assertTrue (copyWriter .isDone ());
328336 assertTrue (storage .delete (BUCKET , sourceBlobName ));
329337 assertTrue (storage .delete (BUCKET , targetBlobName ));
@@ -334,14 +342,18 @@ public void testCopyBlobUpdateMetadata() {
334342 String sourceBlobName = "test-copy-blob-update-metadata-source" ;
335343 BlobId source = BlobId .of (BUCKET , sourceBlobName );
336344 assertNotNull (storage .create (BlobInfo .builder (source ).build (), BLOB_BYTE_CONTENT ));
337- String targetBlobName = "test-copy-blob-target" ;
345+ String targetBlobName = "test-copy-blob-update-metadata-target" ;
346+ ImmutableMap <String , String > metadata = ImmutableMap .of ("k" , "v" );
338347 BlobInfo target = BlobInfo .builder (BUCKET , targetBlobName )
339348 .contentType (CONTENT_TYPE )
340- .metadata (ImmutableMap . of ( "k" , "v" ) )
349+ .metadata (metadata )
341350 .build ();
342351 Storage .CopyRequest req = Storage .CopyRequest .of (source , target );
343352 CopyWriter copyWriter = storage .copy (req );
344- assertEquals (copyWriter .result (), storage .get (BUCKET , targetBlobName ));
353+ assertEquals (BUCKET , copyWriter .result ().bucket ());
354+ assertEquals (targetBlobName , copyWriter .result ().name ());
355+ assertEquals (CONTENT_TYPE , copyWriter .result ().contentType ());
356+ assertEquals (metadata , copyWriter .result ().metadata ());
345357 assertTrue (copyWriter .isDone ());
346358 assertTrue (storage .delete (BUCKET , sourceBlobName ));
347359 assertTrue (storage .delete (BUCKET , targetBlobName ));
0 commit comments