DefaultQueryDslPredicateExecutor extends PagingAndSortingSupport implements DataStoreAware { public long count(Predicate predicate) { return ((CollQuery) CollQueryFactory.from(alias, dataStore.retrieveAll()).where(predicate)).fetchCount(); }  Object findOne(Predicate predicate); Iterable findAll(Predicate predicate); Iterable findAll(Predicate predicate, Sort sort); Page findAll(Predicate predicate, Pageable pageable); long count(Predicate predicate); boolean exists(Predicate predicate); Iterable findAll(OrderSpecifier... orders); Iterable findAll(Predicate predicate, OrderSpecifier... orders); @Override void setDataStore(DataStore dataStore);  }
@Test public void testCount() { dataStore.save("1", new Person().setId("1").setAge(30)); dataStore.save("2", new Person().setId("2").setAge(25)); dataStore.save("3", new Person().setId("3").setAge(20)); dataStore.save("4", new Person().setId("4").setAge(15)); dataStore.save("5", new Person().setId("5").setAge(10)); final Person person = alias(Person.class); final long count = executor.count($(person.getAge()).gt(20).or($(person.getAge()).eq(20))); assertThat(count, is((long) 3)); }