1717
1818public abstract class AbstractStructuredMetadataTest extends MockableTest {
1919 private static final String METADATA_UPLOADER_TAG = SDK_TEST_TAG + "_uploader" ;
20-
20+ private static final String PUBLIC_ID = "before_class_public_id" + SUFFIX ;
2121 protected Api api ;
2222 public static final List <String > metadataFieldExternalIds = new ArrayList <String >();
2323
@@ -27,6 +27,8 @@ public static void setUpClass() throws IOException {
2727 if (cloudinary .config .apiSecret == null ) {
2828 System .err .println ("Please setup environment for Upload test to run" );
2929 }
30+
31+ cloudinary .uploader ().upload (SRC_TEST_IMAGE , asMap ("public_id" , PUBLIC_ID ));
3032 }
3133
3234 @ AfterClass
@@ -221,25 +223,25 @@ public void testUploaderUpdateMetadata() throws Exception {
221223 StringMetadataField field = newFieldInstance ("testUploaderUpdateMetadata" );
222224 ApiResponse fieldResult = addFieldToAccount (field );
223225 String fieldId = fieldResult .get ("external_id" ).toString ();
224- Map result = cloudinary .uploader ().updateMetadata (Collections .<String , Object >singletonMap (fieldId , "123456" ), new String []{"sample" }, null );
226+ Map result = cloudinary .uploader ().updateMetadata (Collections .<String , Object >singletonMap (fieldId , "123456" ), new String []{PUBLIC_ID }, null );
225227 assertNotNull (result );
226- assertEquals ("sample" , ((List ) result .get ("public_ids" )).get (0 ).toString ());
228+ assertEquals (PUBLIC_ID , ((List ) result .get ("public_ids" )).get (0 ).toString ());
227229 }
228230
229231 @ Test
230232 public void testSetField () throws Exception {
231233 SetMetadataField field = createSetField ("test123" );
232234 ApiResponse fieldResult = addFieldToAccount (field );
233235 String fieldId = fieldResult .get ("external_id" ).toString ();
234- Map result = cloudinary .uploader ().updateMetadata (asMap (fieldId , new String []{"id2" , "id3" }), new String []{"sample" }, null );
236+ Map result = cloudinary .uploader ().updateMetadata (asMap (fieldId , new String []{"id2" , "id3" }), new String []{PUBLIC_ID }, null );
235237 assertNotNull (result );
236- assertEquals ("sample" , ((List ) result .get ("public_ids" )).get (0 ).toString ());
238+ assertEquals (PUBLIC_ID , ((List ) result .get ("public_ids" )).get (0 ).toString ());
237239 List <String > list = new ArrayList <String >(2 );
238240 list .add ("id1" );
239241 list .add ("id2" );
240- result = cloudinary .uploader ().updateMetadata (asMap (fieldId , list ), new String []{"sample" }, null );
242+ result = cloudinary .uploader ().updateMetadata (asMap (fieldId , list ), new String []{PUBLIC_ID }, null );
241243 assertNotNull (result );
242- assertEquals ("sample" , ((List ) result .get ("public_ids" )).get (0 ).toString ());
244+ assertEquals (PUBLIC_ID , ((List ) result .get ("public_ids" )).get (0 ).toString ());
243245 }
244246 // Metadata test helpers
245247 private SetMetadataField createSetField (String labelPrefix ) {
0 commit comments