Skip to content

Commit 98bc0d7

Browse files
committed
Fix illegal detection error message test
1 parent dca6b14 commit 98bc0d7

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ abstract public class AbstractUploaderTest extends MockableTest {
2727
private static final String UPLOADER_TAG = SDK_TEST_TAG + "_uploader";
2828
public static final int SRC_TEST_IMAGE_W = 241;
2929
public static final int SRC_TEST_IMAGE_H = 51;
30-
private static Map<String,Set<String>> toDelete = new HashMap<>();
30+
private static Map<String, Set<String>> toDelete = new HashMap<>();
3131

3232
@BeforeClass
3333
public static void setUpClass() throws IOException {
@@ -61,7 +61,8 @@ public static void tearDownClass() {
6161
for (String type : toDelete.keySet()) {
6262
try {
6363
api.deleteResources(toDelete.get(type), Collections.singletonMap("type", type));
64-
}catch ( Exception ignored){}
64+
} catch (Exception ignored) {
65+
}
6566
}
6667

6768
toDelete.clear();
@@ -77,7 +78,7 @@ public void setUp() {
7778
assumeNotNull(cloudinary.config.apiSecret);
7879
}
7980

80-
81+
8182
@Test
8283
public void testUtf8Upload() throws IOException {
8384

@@ -215,7 +216,7 @@ public void testEager() throws IOException {
215216

216217
@Test
217218
public void testUploadAsync() throws IOException {
218-
Map result = cloudinary.uploader().upload(SRC_TEST_IMAGE, asMap("transformation", new Transformation().crop("scale").width(2.0), "async", true, "tags", Arrays.asList(SDK_TEST_TAG, UPLOADER_TAG)));
219+
Map result = cloudinary.uploader().upload(SRC_TEST_IMAGE, asMap("transformation", new Transformation().crop("scale").width(2.0), "async", true, "tags", Arrays.asList(SDK_TEST_TAG, UPLOADER_TAG)));
219220
assertEquals((String) result.get("status"), "pending");
220221
}
221222

@@ -438,13 +439,15 @@ public void testCategorizationRequest() {
438439
@Test
439440
public void testDetectionRequest() {
440441
//should support requesting detection
442+
String message = null;
441443
try {
442444
cloudinary.uploader().upload(SRC_TEST_IMAGE, asMap("detection", "illegal", "tags", Arrays.asList(SDK_TEST_TAG, UPLOADER_TAG)));
443445
} catch (Exception e) {
444-
assertTrue(e.getMessage().matches("(.*)(Illegal value|not a valid)(.*)"));
446+
message = e.getMessage();
445447
}
446-
}
447448

449+
assertTrue("Detection is invalid".equals(message));
450+
}
448451

449452

450453
@Test
@@ -573,7 +576,7 @@ public void testCreateArchive() throws Exception {
573576
cloudinary.api().deleteResources(toDelete, asMap("resource_type", "raw"));
574577
}
575578

576-
579+
577580
@Test
578581
public void testCreateArchiveRaw() throws Exception {
579582
Map result = cloudinary.uploader().createArchive(new ArchiveParams().tags(new String[]{ARCHIVE_TAG}).resourceType("raw"));
@@ -668,9 +671,10 @@ public void testQualityAnalysis() throws IOException {
668671
assertNotNull(result.get("quality_analysis"));
669672

670673
}
671-
private void addToDeleteList(String type, String id){
674+
675+
private void addToDeleteList(String type, String id) {
672676
Set<String> ids = toDelete.get(type);
673-
if (ids == null){
677+
if (ids == null) {
674678
ids = new HashSet<>();
675679
toDelete.put(type, ids);
676680
}

0 commit comments

Comments
 (0)