use of org.zalando.nakadi.domain.PaginationWrapper in project nakadi by zalando.
the class PaginationServiceTest method testPaginationPrevAndNext.
@Test
public void testPaginationPrevAndNext() {
final PaginationService paginationService = new PaginationService();
final PaginationWrapper paginationWrapper = paginationService.paginate(2, 3, "/schemas", (o, l) -> Lists.newArrayList("One", "Two", "Three", "Four"), () -> 1);
Assert.assertEquals("/schemas?offset=5&limit=3", paginationWrapper.getLinks().getNext().get().getHref());
Assert.assertEquals("/schemas?offset=0&limit=3", paginationWrapper.getLinks().getPrev().get().getHref());
}
use of org.zalando.nakadi.domain.PaginationWrapper in project nakadi by zalando.
the class SubscriptionAT method testListSubscriptions.
@Test
public void testListSubscriptions() throws IOException {
final String etName = createEventType().getName();
final String filterApp = randomUUID();
final Subscription sub1 = createSubscription(RandomSubscriptionBuilder.builder().withEventType(etName).withOwningApplication(filterApp).buildSubscriptionBase());
final Subscription sub2 = createSubscription(RandomSubscriptionBuilder.builder().withEventType(etName).withOwningApplication(filterApp).buildSubscriptionBase());
createSubscription(RandomSubscriptionBuilder.builder().withEventType(etName).buildSubscriptionBase());
final PaginationWrapper expectedList = new PaginationWrapper(ImmutableList.of(sub2, sub1), new PaginationLinks());
given().param("owning_application", filterApp).get("/subscriptions").then().statusCode(HttpStatus.SC_OK).body(JSON_HELPER.matchesObject(expectedList));
}
Aggregations