DefaultQueryService implements QueryService { @Override public List<? extends IdentifiableObject> query( Query query ) { return queryObjects( query ); } DefaultQueryService( QueryParser queryParser, QueryPlanner queryPlanner,
        CriteriaQueryEngine<? extends IdentifiableObject> criteriaQueryEngine,
        InMemoryQueryEngine<? extends IdentifiableObject> inMemoryQueryEngine ); @Override List<? extends IdentifiableObject> query( Query query ); @Override @SuppressWarnings( { "unchecked", "rawtypes" } ) List<? extends IdentifiableObject> query( Query query, ResultTransformer transformer ); @Override int count( Query query ); @Override Query getQueryFromUrl( Class<?> klass, List<String> filters, List<Order> orders, Pagination pagination); @Override Query getQueryFromUrl( Class<?> klass, List<String> filters, List<Order> orders, Pagination pagination, Junction.Type rootJunction ); @Override Query getQueryFromUrl( Class<?> klass, List<String> filters, List<Order> orders, Pagination pagination, Junction.Type rootJunction, boolean restrictToCaptureScope ); @Override Query getQueryFromUrl( Class<?> klass, List<String> filters, List<Order> orders );  }
@Test public void verifyQueryEngineUsesPaginationInformation() { Query query = Query.from( new OrganisationUnitSchemaDescriptor().getSchema() ); query.setFirstResult( 100 ); query.setMaxResults( 50 ); when( criteriaQueryEngine.query( argThat( new QueryWithPagination( query ) ) ) ) .thenReturn( createOrgUnits( 20 ) ); List<? extends IdentifiableObject> orgUnits = subject.query( query ); assertThat( orgUnits.size(), is( 20 ) ); }