MongoQueryExecutor implements QueryExecutor { @Override public <T, R> R findOne(Query<T, R> query) { try { final MongoResults<R> results = fetch(translate(query).limit(1), query); return results.hasNext() ? results.next() : null; } catch (final MongoException mx) { throw new DataStoreException(mx.getMessage(), mx); } } MongoQueryExecutor(
            DB db,
            WriteConcern writeConcern,
            MongoQueryTranslator queryTranslator,
            EntityResolver entityResolver,
            final int batchSize);  MongoQueryExecutor(
            DB db,
            WriteConcern writeConcern,
            MongoQueryTranslator queryTranslator,
            EntityResolver entityResolver);  MongoQueryExecutor(
            Mongo mongo,
            String database,
            WriteConcern writeConcern,
            MongoQueryTranslator queryTranslator,
            EntityResolver entityResolver);  MongoQueryExecutor(
            Mongo mongo,
            String database,
            WriteConcern writeConcern,
            MongoQueryTranslator queryTranslator,
            EntityResolver entityResolver,
            final int batchSize); DB getDB(); DBCollection getCollection(Class<?> entityClass); void remove(Query<T, R> query); void removeAll(Class<?> entityClass); @Override Iterable<R> find(Query<T, R> query); @Override R findOne(Query<T, R> query); @Override T save(T entity); @Override Iterable<T> save(Iterable<T> entities);  }
@Test public void findOne() { final DBCursor cursor = new MockDBCursor(collection, toDBObject(t1)); executor.cursor = cursor; final TestClass found = executor.findOne(query); assertEquals(t1, found); verify(queryTranslator).translate(query); }