55import com .cloudinary .Transformation ;
66import com .cloudinary .api .ApiResponse ;
77import com .cloudinary .api .exceptions .AlreadyExists ;
8+ import com .cloudinary .api .exceptions .NotFound ;
89import com .cloudinary .utils .ObjectUtils ;
910import org .hamcrest .Matcher ;
1011import org .hamcrest .Matchers ;
@@ -113,7 +114,7 @@ public void testUpdate() throws Exception {
113114 assertThat (profile , (Matcher ) hasEntry ("name" , (Object ) UPDATE_PROFILE_NAME ));
114115 assertThat (profile , Matchers .hasEntry (equalTo ("representations" ), (Matcher ) hasItem (hasKey ("transformation" ))));
115116 final Map representation = (Map ) ((List ) profile .get ("representations" )).get (0 );
116- Map transformation = (Map ) ((List )representation .get ("transformation" )).get (0 );
117+ Map transformation = (Map ) ((List ) representation .get ("transformation" )).get (0 );
117118 assertThat (transformation , allOf (
118119 (Matcher ) hasEntry ("width" , 800 ),
119120 (Matcher ) hasEntry ("height" , 800 ),
@@ -123,14 +124,22 @@ public void testUpdate() throws Exception {
123124 }
124125
125126 @ AfterClass
126- public static void tearDownClass () {
127+ public static void tearDownClass () throws Exception {
127128 Api api = new Cloudinary ().api ();
128129 try {
129130 api .deleteStreamingProfile (CREATE_PROFILE_NAME );
130- api .deleteStreamingProfile (DELETE_PROFILE_NAME );
131+ } catch (NotFound ignored ) {
132+ }
133+
134+ try {
131135 api .deleteStreamingProfile (UPDATE_PROFILE_NAME );
132- } catch (Exception e ) {
133- e .printStackTrace ();
136+ } catch (NotFound ignored ) {
137+ }
138+
139+ try {
140+ // this should already be gone but in case that deletion-test failed we still need to cleanup the account.
141+ api .deleteStreamingProfile (DELETE_PROFILE_NAME );
142+ } catch (NotFound ignored ) {
134143 }
135144 }
136145}
0 commit comments