@@ -27,7 +27,7 @@ abstract public class AbstractUploaderTest extends MockableTest {
27
27
private static final String UPLOADER_TAG = SDK_TEST_TAG + "_uploader" ;
28
28
public static final int SRC_TEST_IMAGE_W = 241 ;
29
29
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 <>();
31
31
32
32
@ BeforeClass
33
33
public static void setUpClass () throws IOException {
@@ -61,7 +61,8 @@ public static void tearDownClass() {
61
61
for (String type : toDelete .keySet ()) {
62
62
try {
63
63
api .deleteResources (toDelete .get (type ), Collections .singletonMap ("type" , type ));
64
- }catch ( Exception ignored ){}
64
+ } catch (Exception ignored ) {
65
+ }
65
66
}
66
67
67
68
toDelete .clear ();
@@ -77,7 +78,7 @@ public void setUp() {
77
78
assumeNotNull (cloudinary .config .apiSecret );
78
79
}
79
80
80
-
81
+
81
82
@ Test
82
83
public void testUtf8Upload () throws IOException {
83
84
@@ -215,7 +216,7 @@ public void testEager() throws IOException {
215
216
216
217
@ Test
217
218
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 )));
219
220
assertEquals ((String ) result .get ("status" ), "pending" );
220
221
}
221
222
@@ -438,13 +439,15 @@ public void testCategorizationRequest() {
438
439
@ Test
439
440
public void testDetectionRequest () {
440
441
//should support requesting detection
442
+ String message = null ;
441
443
try {
442
444
cloudinary .uploader ().upload (SRC_TEST_IMAGE , asMap ("detection" , "illegal" , "tags" , Arrays .asList (SDK_TEST_TAG , UPLOADER_TAG )));
443
445
} catch (Exception e ) {
444
- assertTrue ( e .getMessage (). matches ( "(.*)(Illegal value|not a valid)(.*)" ) );
446
+ message = e .getMessage ();
445
447
}
446
- }
447
448
449
+ assertTrue ("Detection is invalid" .equals (message ));
450
+ }
448
451
449
452
450
453
@ Test
@@ -573,7 +576,7 @@ public void testCreateArchive() throws Exception {
573
576
cloudinary .api ().deleteResources (toDelete , asMap ("resource_type" , "raw" ));
574
577
}
575
578
576
-
579
+
577
580
@ Test
578
581
public void testCreateArchiveRaw () throws Exception {
579
582
Map result = cloudinary .uploader ().createArchive (new ArchiveParams ().tags (new String []{ARCHIVE_TAG }).resourceType ("raw" ));
@@ -668,9 +671,10 @@ public void testQualityAnalysis() throws IOException {
668
671
assertNotNull (result .get ("quality_analysis" ));
669
672
670
673
}
671
- private void addToDeleteList (String type , String id ){
674
+
675
+ private void addToDeleteList (String type , String id ) {
672
676
Set <String > ids = toDelete .get (type );
673
- if (ids == null ){
677
+ if (ids == null ) {
674
678
ids = new HashSet <>();
675
679
toDelete .put (type , ids );
676
680
}
0 commit comments