> +        }
> +    }
> +
> +    @Test
> +    public void testListLicensesPaginatedCollection() throws Exception {
> +        CloudSigma2Api api = requestSendsResponse(
> +                getBuilder()
> +                    .endpoint(endpoint + "licenses/?limit=3&offset=3")
> +                    .build()
> +                , responseBuilder()
> +                    
> .payload(payloadFromResourceWithContentType("/licences.json", 
> MediaType.APPLICATION_JSON))
> +                    .build());
> +
> +        for(License license : api.listLicenses(new 
> PaginationOptions.Builder().limit(3).offset(3).build())){
> +            assertNotNull(license);
> +        }
>      }
>  }

You can test that the pagination stuff works with the expect tests. Take a look 
at [this example in the Abiquo 
provider](https://github.com/jclouds/jclouds-labs/blob/master/abiquo/src/test/java/org/jclouds/abiquo/features/CloudApiExpectTest.java#L64-L101),
 to see how you can do it.

Basically, to test the "listAll" method (the one that returns the 
`PagedIterable`), you configure two requests: the initial one, and the 
"auto-generated" request for the next page (each returning a single page). This 
way you can call the "listAll" methods, iterate the list, and verify that it 
contains the elements in both pages (the advancing logic and the underlying 
request are working).

Could you add these tests so the unit tests properly verify the page advancing 
mechanism is working properly?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/35/files#r7620008

Reply via email to