### Question:
QueryTaskClientHelper { public static <T extends ServiceDocument> QueryTaskClientHelper<T> create(Class<T> type) { return new QueryTaskClientHelper<T>(type); } private  QueryTaskClientHelper(Class<T> type); static QueryTaskClientHelper<T> create(Class<T> type); QueryTaskClientHelper<T> setDocumentLink(String documentSelfLink); QueryTaskClientHelper<T> setUpdatedDocumentSince(long documentSinceUpdateTimeMicros,
            String documentSelfLink); QueryTaskClientHelper<T> setUpdatedSince(long documentSinceUpdateTimeMicros); QueryTaskClientHelper<T> sendWith(ServiceHost serviceHost); QueryTaskClientHelper<T> sendWith(Service service); QueryTaskClientHelper<T> setQueryTask(QueryTask queryTask); QueryTaskClientHelper<T> setBaseUri(URI baseUri); QueryTaskClientHelper<T> setFactoryPath(String factoryPath); QueryTaskClientHelper<T> setResultHandler(ResultHandler<T> resultHandler); static long getDefaultQueryExpiration(); QueryElementResult<T> result(Object json, long count); static QueryElementResult<S> resultLink(
            String selfLink, long count); static QueryElementResult<S> countResult(
            long count); static QueryElementResult<S> noResult(); static final long QUERY_RETRIEVAL_RETRY_INTERVAL_MILLIS; static final long DEFAULT_EXPIRATION_TIME_IN_MICROS; static final Integer DEFAULT_QUERY_RESULT_LIMIT; }### Answer:
@Test public void testCountQuery() throws Throwable { int numberOfServices = 20; this.services = this.host.doThroughputServiceStart(numberOfServices, MinimalTestService.class, this.host.buildMinimalTestState(), EnumSet.of(ServiceOption.PERSISTENCE), null); Query query = Builder.create().addKindFieldClause(MinimalTestServiceState.class).build(); QueryTask q = QueryTask.Builder.createDirectTask() .addOption(QueryOption.COUNT) .setQuery(query).build(); List<Long> results = new ArrayList<>(); query(q, (r, e) -> { if (e != null) { this.host.failIteration(e); } else if (!r.hasResult()) { this.host.completeIteration(); } else { results.add(r.getCount()); } }); assertEquals(1, results.size()); assertEquals(20, results.get(0).intValue()); }