@@ -971,6 +971,32 @@ public void testRestore() throws Exception {
971971 assertEquals (resource .get ("bytes" ), 3381 );
972972 }
973973
974+ @ Test
975+ public void testRestoreByAssetIds () throws Exception {
976+
977+ // Upload
978+ cloudinary .uploader ().upload (SRC_TEST_IMAGE ,
979+ ObjectUtils .asMap ("public_id" , API_TEST_RESTORE , "backup" , true , "tags" , UPLOAD_TAGS ));
980+ Map resource = api .resource (API_TEST_RESTORE , ObjectUtils .emptyMap ());
981+ assertEquals (resource .get ("bytes" ), 3381 );
982+
983+ //Delete
984+ api .deleteResources (Collections .singletonList (API_TEST_RESTORE ), ObjectUtils .emptyMap ());
985+ resource = api .resource (API_TEST_RESTORE , ObjectUtils .emptyMap ());
986+ String assetId = (String ) resource .get ("asset_id" );
987+ assertEquals (resource .get ("bytes" ), 0 );
988+ assertNotNull (assetId );
989+ assertTrue ((Boolean ) resource .get ("placeholder" ));
990+
991+ //Restore
992+ Map response = api .restoreByAssetIds (Collections .singletonList (assetId ), ObjectUtils .emptyMap ());
993+ Map info = (Map ) response .get (assetId );
994+ assertNotNull (info );
995+ assertEquals (info .get ("bytes" ), 3381 );
996+ resource = api .resource (API_TEST_RESTORE , ObjectUtils .emptyMap ());
997+ assertEquals (resource .get ("bytes" ), 3381 );
998+ }
999+
9741000 @ Test
9751001 public void testRestoreDifferentVersionsOfDeletedAsset () throws Exception {
9761002 final String TEST_RESOURCE_PUBLIC_ID = "api_test_restore_different_versions_single_asset" + SUFFIX ;
0 commit comments