DatastoreStore extends StoreBase { @Override public String[] keys() throws IOException { String[] keys; Query<Key> query = Query.newKeyQueryBuilder().build(); QueryResults<Key> results = datastore.run(query); keys = Streams.stream(results) .map(key -> key.getNameOrId().toString()) .toArray(String[]::new); if (keys == null) { keys = new String[0]; } return keys; }  @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 testEnumerateKeys() throws Exception { String[] keys = store.keys(); verify(datastore).run(any(KeyQuery.class)); assertEquals(1, keys.length); assertEquals(keyId, keys[0]); }