Skip to content

Commit 95d2b33

Browse files
authored
Fix post-test cleanup for eval upload parameter
1 parent a0ccbc4 commit 95d2b33

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

cloudinary-test-common/src/main/java/com/cloudinary/test/AbstractUploaderTest.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ abstract public class AbstractUploaderTest extends MockableTest {
3434
private static final String UPLOADER_TEST_PUBLIC_ID = "uploader_test";
3535
public static final String SRC_FULLY_QUALIFIED_IMAGE="image/upload/" + UPLOADER_TEST_PUBLIC_ID;
3636
public static final String SRC_FULLY_QUALIFIED_VIDEO="video/upload/dog";
37-
public static final String SRC_TEST_EVAL= "if (resource_info['width'] < 450) { upload_options['tags'] = 'a,b' };" + "upload_options['context'] = 'width=' + resource_info['width'];";
38-
private static final ArrayList<String> TEST_EVAL_TAGS_RESULT = new ArrayList<String>(Arrays.asList("a","b"));
37+
public static final String SRC_TEST_EVAL= "if (resource_info['width'] < 450) { upload_options['quality_analysis'] = true };" + "upload_options['context'] = 'width=' + resource_info['width'];";
3938

4039

4140
@BeforeClass
@@ -275,8 +274,12 @@ public void testImageUploadTag() {
275274

276275
@Test
277276
public void testEvalUploadParameter() throws IOException {
278-
Map result = cloudinary.uploader().upload(SRC_TEST_IMAGE, asMap("eval",SRC_TEST_EVAL));
279-
assertEquals(result.get("tags"), TEST_EVAL_TAGS_RESULT);
277+
Map result = cloudinary.uploader().upload(SRC_TEST_IMAGE, asMap(
278+
"eval",SRC_TEST_EVAL,
279+
"tags", Arrays.asList(SDK_TEST_TAG, UPLOADER_TAG)
280+
));
281+
assertTrue(result.get("quality_analysis")!=null &&
282+
((HashMap)result.get("quality_analysis")).containsKey("focus"));
280283
Map custom= (Map)((Map) result.get("context")).get("custom");
281284
assertEquals(custom.get("width"),Integer.toString(SRC_TEST_IMAGE_W));
282285
}

0 commit comments

Comments
 (0)