@@ -233,7 +233,7 @@ public void testTransformationsWithCursor() throws Exception {
233233 Map result = api .transformations (ObjectUtils .asMap ("max_results" , 500 , "next_cursor" , next_cursor ));
234234 transformations .addAll ((List ) result .get ("transformations" ));
235235 next_cursor = (String ) result .get ("next_cursor" );
236- } while (next_cursor != null );
236+ } while (next_cursor != null );
237237 assertThat (transformations , hasItem (allOf (hasEntry ("name" , "t_" + name ))));
238238 }
239239
@@ -447,6 +447,45 @@ public void test17aTransformationDeleteImplicit() throws Exception {
447447 api .deleteTransformation (DELETE_TRANSFORMATION_NAME , ObjectUtils .emptyMap ());
448448 }
449449
450+ @ Test
451+ public void testListTransformationByNamed () throws Exception {
452+ String name = "a_test_named_transformation_param" + SUFFIX ;
453+ try {
454+ api .createTransformation (name , "w_100" , null );
455+ name = "t_" + name ;
456+ List <Map > named = (List ) api .transformations (ObjectUtils .asMap ("max_results" , 30 , "named" , true )).get ("transformations" );
457+ List <Map > unnamed = (List ) api .transformations (ObjectUtils .asMap ("max_results" , 30 , "named" , false )).get ("transformations" );
458+
459+ // the named transformation should be present only in the named list:
460+ boolean unnamedFound = false ;
461+ boolean namedFound = false ;
462+
463+ for (Map t : unnamed ) {
464+ if (t .get ("name" ).equals (name )) {
465+ unnamedFound = true ;
466+ break ;
467+ }
468+ }
469+
470+ if (!unnamedFound ) {
471+ for (Map t : named ) {
472+ if (t .get ("name" ).equals (name )) {
473+ namedFound = true ;
474+ break ;
475+ }
476+ }
477+ }
478+
479+ assertTrue ("Named transformation wasn't returned with named=true param" , namedFound );
480+ assertFalse ("Named transformation returned with named=false param" , unnamedFound );
481+
482+ } finally {
483+ try {
484+ api .deleteTransformation (name , null );
485+ } catch (Exception ignored ){}
486+ }
487+ }
488+
450489 @ Test
451490 public void test20ResourcesContext () throws Exception {
452491 Map result = api .resourcesByContext (TEST_KEY , ObjectUtils .emptyMap ());
0 commit comments