LimitPaginationContextEngine { public PaginationContext createPaginationContext(final LimitSegment limitSegment, final List<Object> parameters) { return new PaginationContext(limitSegment.getOffset().orElse(null), limitSegment.getRowCount().orElse(null), parameters); }  PaginationContext createPaginationContext(final LimitSegment limitSegment, final List<Object> parameters);  }
@Test public void assertPaginationContextCreatedProperlyWhenPaginationValueSegmentIsNumberLiteralPaginationValueSegment() { LimitSegment limitSegment = new LimitSegment(0, 10, new NumberLiteralLimitValueSegment(0, 10, 1L), new NumberLiteralLimitValueSegment(10, 20, 2L)); PaginationContext paginationContext = new LimitPaginationContextEngine().createPaginationContext(limitSegment, Collections.emptyList()); assertTrue(paginationContext.isHasPagination()); }
@Test public void assertPaginationContextCreatedProperlyWhenOffsetAndRowCountAreBothNull() { PaginationContext paginationContext = new LimitPaginationContextEngine().createPaginationContext(new LimitSegment(0, 10, null, null), Collections.emptyList()); assertFalse(paginationContext.isHasPagination()); }
@Test public void assertPaginationContextCreatedProperlyWhenPaginationValueSegmentIsParameterMarkerPaginationValueSegment() { LimitSegment limitSegment = new LimitSegment(0, 10, new ParameterMarkerLimitValueSegment(0, 10, 0), new ParameterMarkerLimitValueSegment(10, 20, 1)); PaginationContext paginationContext = new LimitPaginationContextEngine().createPaginationContext(limitSegment, Lists.newArrayList(15L, 20L)); assertTrue(paginationContext.isHasPagination()); }