@Test public void test12Transformations() throws Exception { // should allow listing transformations Map result = api.transformations(Cloudinary.emptyMap()); Map transformation = findByAttr((List<Map>) result.get("transformations"), "name", "c_scale,w_100"); assertNotNull(transformation); assertTrue((Boolean) transformation.get("used")); }
@Test public void testApiLimits() throws Exception { // should support reporting the current API limits found in the response header ApiResponse result1 = api.transformations(Cloudinary.emptyMap()); ApiResponse result2 = api.transformations(Cloudinary.emptyMap()); assertNotNull(result1.apiRateLimit()); assertNotNull(result2.apiRateLimit()); assertEquals(result1.apiRateLimit().getRemaining() - 1, result2.apiRateLimit().getRemaining()); assertTrue(result2.apiRateLimit().getLimit() > result2.apiRateLimit().getRemaining()); assertEquals(result1.apiRateLimit().getLimit(), result2.apiRateLimit().getLimit()); assertEquals(result1.apiRateLimit().getReset(), result2.apiRateLimit().getReset()); assertTrue(result2.apiRateLimit().getReset().after(new java.util.Date())); }