DatastoreStore extends StoreBase { @Override public int getSize() throws IOException { log.debug("Accessing sessions count, be cautious this operation can cause performance issues"); Query<Key> query = Query.newKeyQueryBuilder().build(); QueryResults<Key> results = datastore.run(query); long count = Streams.stream(results).count(); return Math.toIntExact(count); }  @Override int getSize(); @Override String[] keys(); @Override Session load(String id); @Override void remove(String id); @Override void clear(); @Override void save(Session session); @Override void processExpires(); void setNamespace(String namespace); void setSessionKind(String sessionKind); void setTraceRequest(boolean traceRequest);  }
@Test public void testGetStoreSize() throws Exception { int size = store.getSize(); verify(datastore).run(any(KeyQuery.class)); assertEquals(1, size); }