44import com .cloudinary .api .ApiResponse ;
55import com .cloudinary .api .exceptions .BadRequest ;
66import com .cloudinary .api .exceptions .NotFound ;
7+ import com .cloudinary .test .helpers .Feature ;
78import com .cloudinary .test .rules .RetryRule ;
89import com .cloudinary .transformation .TextLayer ;
910import com .cloudinary .utils .ObjectUtils ;
@@ -52,6 +53,7 @@ abstract public class AbstractApiTest extends MockableTest {
5253 private static final String CUSTOM_USER_AGENT_VERSION = "9.9.9" ;
5354 private static String assetId1 ;
5455 private static String assetId2 ;
56+ private static String assetId3 ;
5557
5658 private static final int SLEEP_TIMEOUT = 5000 ;
5759
@@ -77,6 +79,8 @@ public static void setUpClass() throws IOException {
7779 assetId2 = cloudinary .uploader ().upload (SRC_TEST_IMAGE , options ).get ("asset_id" ).toString ();
7880 options .remove ("public_id" );
7981
82+ assetId3 = cloudinary .uploader ().upload (SRC_TEST_IMAGE , ObjectUtils .asMap ("asset_folder" , "test_asset_folder" )).get ("public_id" ).toString ();
83+
8084 options .put ("eager" , Collections .singletonList (UPDATE_TRANSFORMATION ));
8185 cloudinary .uploader ().upload (SRC_TEST_IMAGE , options );
8286
@@ -292,6 +296,14 @@ public void testResourceByAssetId() throws Exception {
292296 assertEquals (API_TEST , result .get ("public_id" ).toString ());
293297 }
294298
299+ @ Test
300+ public void testResourceByAssetFolder () throws Exception {
301+ if (MockableTest .shouldTestFeature (Feature .DYNAMIC_FOLDERS )) {
302+ Map result = api .resourcesByAssetFolder ("test_asset_folder" , ObjectUtils .asMap ("tags" , true , "context" , true ));
303+ assertNotNull (findByAttr ((List <Map >) result .get ("resources" ), "public_id" , assetId3 ));
304+ }
305+ }
306+
295307 @ Test
296308 public void testResourcesByPublicIds () throws Exception {
297309 // should allow listing resources by public ids
0 commit comments